Google images view button

Re-adds the "View Image" button to Google Images result pages. The only script I found to be working. Got it off /g/ on 4chan, thank you, anon!!

当前为 2018-02-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Google images view button
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @author anon
  6. // @include https://*.google.*/*
  7. // @grant none
  8. // @run-at document-idle
  9. // @description Re-adds the "View Image" button to Google Images result pages. The only script I found to be working. Got it off /g/ on 4chan, thank you, anon!!
  10.  
  11.  
  12.  
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. var element = document.querySelectorAll("._FKw td:nth-child(1)");
  18. var elementtimer = setInterval(function(){
  19. var element = document.querySelectorAll("._FKw td:nth-child(1)");
  20. if (element.length) {
  21. var newElement = document.createElement("td");
  22. var link = document.createElement("a");
  23. link.href = 'javascript:void function(){function isElementVisible(el){var rect=el.getBoundingClientRect(),vWidth=window.innerWidth||doc.documentElement.clientWidth,vHeight=window.innerHeight||doc.documentElement.clientHeight,efp=function(x,y){return document.elementFromPoint(x,y)};return rect.right<0||rect.bottom<0||rect.left>vWidth||rect.top>vHeight%3F!1:el.contains(efp(rect.left,rect.top))||el.contains(efp(rect.right,rect.top))||el.contains(efp(rect.right,rect.bottom))||el.contains(efp(rect.left,rect.bottom))}"undefined"==typeof window.isElementVisible;{var imgs=document.querySelectorAll(".irc_mi");imgs.forEach(function(img){isElementVisible(img)%26%26window.open(img.src)})}}();';
  24. var span = document.createElement("span");
  25. span.classList.add("_WKw");
  26. span.appendChild(document.createTextNode("View Image"));
  27. link.appendChild(span);
  28. newElement.appendChild(link);
  29. for (var i = 0; i < element.length;i++) {
  30. element[i].after(newElement.cloneNode(true));
  31. }
  32. clearInterval(elementtimer);
  33. }
  34. },100);
  35. })();