Images from Google books preview

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

  1. // ==UserScript==
  2. // @name Images from Google books preview
  3. // @namespace https://heterorrhina.in/
  4. // @version 0.1
  5. // @description Provides a button to open an auto updating page containing only images from the book preview of Google books
  6. // @author Umesh Mohan
  7. // @match https://books.google.co.in/books*
  8. // @grant none
  9. // ==/UserScript==
  10. var imgsrcL, imgWindow, br, viewport, link;
  11.  
  12. function updateimgList() {
  13. var imgL = viewport.getElementsByTagName("img"), imgN, imgsrc, img;
  14. for (imgN in imgL) {
  15. imgsrc = imgL[imgN].src;
  16. if (imgsrc == undefined || imgsrc == "") {continue;}
  17. if (imgsrcL.indexOf(imgsrc) == -1) {
  18. imgsrcL.push(imgsrc);
  19. img = imgWindow.document.createElement("img");
  20. img.style.width = "100%";
  21. img.src = imgsrc;
  22. imgWindow.document.body.appendChild(img);
  23. imgWindow.document.body.appendChild(br);
  24. }
  25. }
  26. }
  27.  
  28. function Refresh() {
  29. viewport = document.getElementById("viewport")
  30. viewport.addEventListener("DOMSubtreeModified",updateimgList,false);
  31. imgWindow = window.open();
  32. br = imgWindow.document.createElement("br");
  33. imgsrcL = [];
  34. updateimgList();
  35. imgWindow.document.title = document.title;
  36. }
  37.  
  38. link = document.createElement("a");
  39. link.innerHTML = "?";
  40. link.style.cursor = "pointer";
  41. link.onclick = Refresh;
  42. document.getElementsByClassName("kd-appname")[0].appendChild(link);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址