Google Drive generate html code for photos direct links

generate html code for all pictures in the folder

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Google Drive generate html code for photos direct links
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  generate html code for all pictures in the folder
// @author       Cold Liu
// @match        *://drive.google.com/drive/*
// @grant        none
// ==/UserScript==

//waiting for page loading done and then show the button
window.onload = function(){
    var input=document.createElement("input");
    input.type="button";
    input.value="產生貼圖語法";
    input.onclick = go;
    input.setAttribute("style", "font-size:18px;position:absolute;top:700px;left:28px");
    document.body.appendChild(input);
};

function go(){
    var a = document.createElement("a");
    var html = ""; //string for the .txt content
    var m = document.getElementsByClassName('WYuW0e'); //find the number of photo
    if(m.length>0){
        for(var i=0;i<m.length;i++)
        {
            html += '<img src="https://drive.google.com/uc?id=' + m[i].dataset.id + '"><br>'; //generate html code for all of photos
        }
        a.href += "data:text,"+ html; //write to .txt file
        a.download = "html.txt"; //download .txt file
        a.click();
    }
}