Honokachan

Restore View Full Size Image to Google - JS

Feb 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         New Userscript
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       Honoka-chan
  7. // @include      https://*.google.hu/*
  8. // @include      https://google.hu/*
  9. // @include      https://*.google.com/*
  10. // @include      https://google.com/*
  11. // @grant        none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15.     'use strict';
  16.         var element = document.querySelectorAll("._FKw td:nth-child(1)");
  17.         var elementtimer = setInterval(function(){
  18.         var element = document.querySelectorAll("._FKw td:nth-child(1)");
  19.         if (element.length) {
  20.             var newElement = document.createElement("td");
  21.             var link = document.createElement("a");
  22.             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)})}}();';
  23.             var span = document.createElement("span");
  24.             span.classList.add("_WKw");
  25.             span.appendChild(document.createTextNode("View Image"));
  26.             link.appendChild(span);
  27.             newElement.appendChild(link);
  28.             for (var i = 0; i < element.length;i++) {
  29.                 element[i].after(newElement.cloneNode(true));
  30.             }
  31.             clearInterval(elementtimer);
  32.         }
  33.     },100);
  34. })();
Add Comment
Please, Sign In to add comment