Google Drive generate html code for photos direct links

generate html code for all pictures in the folder

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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();
    }
}