Images from Google books preview

Provides a button to open an auto updating page containing only images from the book preview of Google books

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Images from Google books preview
// @namespace    https://heterorrhina.in/
// @version      0.1
// @description  Provides a button to open an auto updating page containing only images from the book preview of Google books
// @author       Umesh Mohan
// @match        https://books.google.co.in/books*
// @grant        none
// ==/UserScript==
var imgsrcL, imgWindow, br, viewport, link;

function updateimgList() {
    var imgL = viewport.getElementsByTagName("img"), imgN, imgsrc, img;
    for (imgN in imgL) {
        imgsrc = imgL[imgN].src;
        if (imgsrc == undefined || imgsrc == "") {continue;}
        if (imgsrcL.indexOf(imgsrc) == -1) {
            imgsrcL.push(imgsrc);
            img = imgWindow.document.createElement("img");
            img.style.width = "100%";
            img.src = imgsrc;
            imgWindow.document.body.appendChild(img);
            imgWindow.document.body.appendChild(br);
        }
    }
}

function Refresh() {
    viewport = document.getElementById("viewport")
    viewport.addEventListener("DOMSubtreeModified",updateimgList,false);
    imgWindow = window.open();
    br = imgWindow.document.createElement("br");
    imgsrcL = [];
    updateimgList();
    imgWindow.document.title = document.title;
}

link = document.createElement("a");
link.innerHTML = "?";
link.style.cursor = "pointer";
link.onclick = Refresh;
document.getElementsByClassName("kd-appname")[0].appendChild(link);