// ==UserScript== // @name Google Images direct link fix // @description Adds a direct button link for the image. // @version 1.4b // @grant none // @include https://www.google.com/search?q=* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js // @namespace https://greasyfork.org/users/11231 // @downloadURL none // ==/UserScript== var tar, x, progressBar; $(window).on("load", function() { Checker(); $(window).click(function(e) { if ( $(e.target).prop("tagName") == 'IMG' ) { $("#aTheIMG").remove(); Checker(); } }); }); async function Checker() { setTimeout(function() { if (!progressBar){ if ( $('div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2)').length ) { progressBar = $('div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2)'); } else if ( $('div.irc_c:nth-child(3) > div:nth-child(1) > div:nth-child(3)').length ) { progressBar = $('div.irc_c:nth-child(3) > div:nth-child(1) > div:nth-child(3)'); } } if ( $(progressBar).css('display') != 'none' ) { Checker(); } else { theWork(); } }, 500); } function theWork() { var xIMG, xPlaceholder, xCurrentClass, xPos; if ( $('body').attr('data-has-header') == 'true' ) { xIMG = $("div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > a:nth-child(1) > img:nth-child(1)"); xPlaceholder = $(".fwCBrd"); xCurrentClass = 'dJcyOc'; xPos = '-139px'; } else { //Private Mode xIMG = $("div.irc_c:nth-child(3) > div:nth-child(1) > div:nth-child(4) > div:nth-child(1) > a:nth-child(1) > div:nth-child(1) > img:nth-child(1)"); xPlaceholder = $(".hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2)"); xCurrentClass = 'NDcgDe'; xPos = '-85px'; } if ( !$(xIMG).attr("src").match("^https://encrypted-tbn") ) { tar = $(xIMG); x = $(tar).attr("src"); if (x.startsWith("data:imag")) {theWork(); return true;} if (!$("#aTheIMG").length) $(xPlaceholder).append('View image'); else ; } else {}; x = ""; $('div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1)').remove(); //Left-Right Arrows if ( !$('#aTheIMG').length() ) { theWork(); } } $( '