// ==UserScript==
// @name Google Images direct link fix
// @description Adds a direct button link for the image.
// @version 1.2b
// @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;
$(window).on("load", function() {
theWork();
$(window).click(function(e) { if ($(e.target).attr('class') == 'rg_i Q4LuWd tx8vtf'){ $("#aTheIMG").remove(); Checker() } });
});
async function Checker() { setTimeout(function() {
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)').css('display') != 'none' ) {
Checker();
} else {
theWork();
if ( !$('#aTheIMG').length() ) { theWork(); }
}
}, 500); }
function theWork() {
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) > a:nth-child(1) > img:nth-child(1)").attr("src").match("^https://encrypted-tbn")) {
tar = $("div.tvh9oe: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)");
x = $(tar).attr("src");
if (!$("#aTheIMG").length) $(".fwCBrd").append('View image'); else ;
} else ;
x = "";
}
$( '