az4521

Re-Add Google Images View Image Button (Tampermonkey)

Feb 16th, 2018
3,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         images button
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  add back view image to google images
  6. // @author       az4521
  7. // google has too many domains
  8. // @match http*://*.google.ac/*
  9. // @match http*://*.google.ad/*
  10. // @match http*://*.google.ae/*
  11. // @match http*://*.google.al/*
  12. // @match http*://*.google.am/*
  13. // @match http*://*.google.as/*
  14. // @match http*://*.google.at/*
  15. // @match http*://*.google.az/*
  16. // @match http*://*.google.ba/*
  17. // @match http*://*.google.be/*
  18. // @match http*://*.google.bf/*
  19. // @match http*://*.google.bg/*
  20. // @match http*://*.google.bi/*
  21. // @match http*://*.google.biz/*
  22. // @match http*://*.google.bj/*
  23. // @match http*://*.google.bs/*
  24. // @match http*://*.google.bt/*
  25. // @match http*://*.google.by/*
  26. // @match http*://*.google.ca/*
  27. // @match http*://*.google.cat/*
  28. // @match http*://*.google.cd/*
  29. // @match http*://*.google.cf/*
  30. // @match http*://*.google.cg/*
  31. // @match http*://*.google.ch/*
  32. // @match http*://*.google.ci/*
  33. // @match http*://*.google.cl/*
  34. // @match http*://*.google.cm/*
  35. // @match http*://*.google.cn/*
  36. // @match http*://*.google.co.ao/*
  37. // @match http*://*.google.co.bw/*
  38. // @match http*://*.google.co.ck/*
  39. // @match http*://*.google.co.cr/*
  40. // @match http*://*.google.co.hu/*
  41. // @match http*://*.google.co.id/*
  42. // @match http*://*.google.co.il/*
  43. // @match http*://*.google.co.in/*
  44. // @match http*://*.google.co.jp/*
  45. // @match http*://*.google.co.ke/*
  46. // @match http*://*.google.co.kr/*
  47. // @match http*://*.google.co.ls/*
  48. // @match http*://*.google.co.ma/*
  49. // @match http*://*.google.co.mz/*
  50. // @match http*://*.google.co.nz/*
  51. // @match http*://*.google.co.th/*
  52. // @match http*://*.google.co.tz/*
  53. // @match http*://*.google.co.ug/*
  54. // @match http*://*.google.co.uk/*
  55. // @match http*://*.google.co.uz/*
  56. // @match http*://*.google.co.ve/*
  57. // @match http*://*.google.co.vi/*
  58. // @match http*://*.google.co.za/*
  59. // @match http*://*.google.co.zm/*
  60. // @match http*://*.google.co.zw/*
  61. // @match http*://*.google.com/*
  62. // @match http*://*.google.com.af/*
  63. // @match http*://*.google.com.ag/*
  64. // @match http*://*.google.com.ai/*
  65. // @match http*://*.google.com.ar/*
  66. // @match http*://*.google.com.au/*
  67. // @match http*://*.google.com.bd/*
  68. // @match http*://*.google.com.bh/*
  69. // @match http*://*.google.com.bn/*
  70. // @match http*://*.google.com.bo/*
  71. // @match http*://*.google.com.br/*
  72. // @match http*://*.google.com.bz/*
  73. // @match http*://*.google.com.ca/*
  74. // @match http*://*.google.com.ch/*
  75. // @match http*://*.google.com.co/*
  76. // @match http*://*.google.com.cu/*
  77. // @match http*://*.google.com.cy/*
  78. // @match http*://*.google.com.do/*
  79. // @match http*://*.google.com.ec/*
  80. // @match http*://*.google.com.eg/*
  81. // @match http*://*.google.com.et/*
  82. // @match http*://*.google.com.fj/*
  83. // @match http*://*.google.com.gh/*
  84. // @match http*://*.google.com.gi/*
  85. // @match http*://*.google.com.gt/*
  86. // @match http*://*.google.com.hk/*
  87. // @match http*://*.google.com.jm/*
  88. // @match http*://*.google.com.kh/*
  89. // @match http*://*.google.com.kw/*
  90. // @match http*://*.google.com.lb/*
  91. // @match http*://*.google.com.ly/*
  92. // @match http*://*.google.com.mm/*
  93. // @match http*://*.google.com.mt/*
  94. // @match http*://*.google.com.mx/*
  95. // @match http*://*.google.com.my/*
  96. // @match http*://*.google.com.na/*
  97. // @match http*://*.google.com.nf/*
  98. // @match http*://*.google.com.ng/*
  99. // @match http*://*.google.com.ni/*
  100. // @match http*://*.google.com.np/*
  101. // @match http*://*.google.com.om/*
  102. // @match http*://*.google.com.pa/*
  103. // @match http*://*.google.com.pe/*
  104. // @match http*://*.google.com.pg/*
  105. // @match http*://*.google.com.ph/*
  106. // @match http*://*.google.com.pk/*
  107. // @match http*://*.google.com.pl/*
  108. // @match http*://*.google.com.pr/*
  109. // @match http*://*.google.com.py/*
  110. // @match http*://*.google.com.qa/*
  111. // @match http*://*.google.com.sa/*
  112. // @match http*://*.google.com.sb/*
  113. // @match http*://*.google.com.sg/*
  114. // @match http*://*.google.com.sl/*
  115. // @match http*://*.google.com.sv/*
  116. // @match http*://*.google.com.tj/*
  117. // @match http*://*.google.com.tr/*
  118. // @match http*://*.google.com.tw/*
  119. // @match http*://*.google.com.ua/*
  120. // @match http*://*.google.com.uy/*
  121. // @match http*://*.google.com.vc/*
  122. // @match http*://*.google.com.vn/*
  123. // @match http*://*.google.cv/*
  124. // @match http*://*.google.cz/*
  125. // @match http*://*.google.de/*
  126. // @match http*://*.google.dj/*
  127. // @match http*://*.google.dk/*
  128. // @match http*://*.google.dm/*
  129. // @match http*://*.google.dz/*
  130. // @match http*://*.google.ee/*
  131. // @match http*://*.google.es/*
  132. // @match http*://*.google.fi/*
  133. // @match http*://*.google.fm/*
  134. // @match http*://*.google.fr/*
  135. // @match http*://*.google.ga/*
  136. // @match http*://*.google.ge/*
  137. // @match http*://*.google.gg/*
  138. // @match http*://*.google.gl/*
  139. // @match http*://*.google.gm/*
  140. // @match http*://*.google.gp/*
  141. // @match http*://*.google.gr/*
  142. // @match http*://*.google.gy/*
  143. // @match http*://*.google.hn/*
  144. // @match http*://*.google.hr/*
  145. // @match http*://*.google.ht/*
  146. // @match http*://*.google.hu/*
  147. // @match http*://*.google.ie/*
  148. // @match http*://*.google.im/*
  149. // @match http*://*.google.info/*
  150. // @match http*://*.google.iq/*
  151. // @match http*://*.google.is/*
  152. // @match http*://*.google.it/*
  153. // @match http*://*.google.je/*
  154. // @match http*://*.google.jo/*
  155. // @match http*://*.google.kg/*
  156. // @match http*://*.google.ki/*
  157. // @match http*://*.google.kz/*
  158. // @match http*://*.google.la/*
  159. // @match http*://*.google.li/*
  160. // @match http*://*.google.lk/*
  161. // @match http*://*.google.lt/*
  162. // @match http*://*.google.lu/*
  163. // @match http*://*.google.lv/*
  164. // @match http*://*.google.md/*
  165. // @match http*://*.google.me/*
  166. // @match http*://*.google.mg/*
  167. // @match http*://*.google.mk/*
  168. // @match http*://*.google.ml/*
  169. // @match http*://*.google.mn/*
  170. // @match http*://*.google.ms/*
  171. // @match http*://*.google.mu/*
  172. // @match http*://*.google.mv/*
  173. // @match http*://*.google.mw/*
  174. // @match http*://*.google.ne/*
  175. // @match http*://*.google.net/*
  176. // @match http*://*.google.nl/*
  177. // @match http*://*.google.no/*
  178. // @match http*://*.google.nr/*
  179. // @match http*://*.google.nu/*
  180. // @match http*://*.google.org/*
  181. // @match http*://*.google.pl/*
  182. // @match http*://*.google.pn/*
  183. // @match http*://*.google.ps/*
  184. // @match http*://*.google.pt/*
  185. // @match http*://*.google.ro/*
  186. // @match http*://*.google.rs/*
  187. // @match http*://*.google.ru/*
  188. // @match http*://*.google.rw/*
  189. // @match http*://*.google.sc/*
  190. // @match http*://*.google.se/*
  191. // @match http*://*.google.sh/*
  192. // @match http*://*.google.si/*
  193. // @match http*://*.google.sk/*
  194. // @match http*://*.google.sm/*
  195. // @match http*://*.google.sn/*
  196. // @match http*://*.google.so/*
  197. // @match http*://*.google.sr/*
  198. // @match http*://*.google.st/*
  199. // @match http*://*.google.td/*
  200. // @match http*://*.google.tg/*
  201. // @match http*://*.google.tk/*
  202. // @match http*://*.google.tl/*
  203. // @match http*://*.google.tm/*
  204. // @match http*://*.google.tn/*
  205. // @match http*://*.google.to/*
  206. // @match http*://*.google.tt/*
  207. // @match http*://*.google.us/*
  208. // @match http*://*.google.vc/*
  209. // @match http*://*.google.vg/*
  210. // @match http*://*.google.vu/*
  211. // @match http*://*.google.ws/*
  212.  
  213. // @grant        none
  214. // @run-at document-idle
  215. // ==/UserScript==
  216.  
  217. (function() {
  218.     'use strict';
  219.     var element = document.querySelectorAll("._FKw td:nth-child(1)");
  220.     var elementtimer = setInterval(function(){
  221.         var element = document.querySelectorAll("._FKw td:nth-child(1)");
  222.         if (element.length) {
  223.             var newElement = document.createElement("td");
  224.             var link = document.createElement("a");
  225.             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)})}}();';
  226.             var span = document.createElement("span");
  227.             span.classList.add("_WKw");
  228.             span.appendChild(document.createTextNode("View Image"));
  229.             link.appendChild(span);
  230.             newElement.appendChild(link);
  231.             for (var i = 0; i < element.length;i++) {
  232.                 element[i].after(newElement.cloneNode(true));
  233.             }
  234.             clearInterval(elementtimer);
  235.         }
  236.     },100);
  237. })();
Add Comment
Please, Sign In to add comment