// ==UserScript== // @name Google Images direct link fix // @description Adds a direct button link for the image. // @version 1.6.4b // @grant none // @include https://www.google.tld/*tbm=isch* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js // @namespace https://greasyfork.org/users/11231 // @downloadURL none // ==/UserScript== var xurl, progressBar, xIMG, xPlaceholder, xCurrentClass, xPos; $(window).on("load", function() { setTimeout(function() { Checker(); }, 400); $(window).click(function(e) { if ( $(e.target).prop("tagName") == 'IMG' ) { //alert('IMG clicked'); setTimeout(function() { Checker(); }, 300); } }); $(document).unbind("keypress.key37"); $(document).unbind("keypress.key39"); document.onkeydown = function(e) { if ( $('body').attr('style').includes('overscroll-behavior-y: none;') ) { switch (e.keyCode) { case 37: //alert('left'); Checker(); break; case 39: //alert('right'); Checker(); break; } } } }); function Checker() { setTimeout(function() { $("#aTheIMG").remove(); //Image loaded Size display and position. $(".VSIspc").css('display', 'block' ); $(".VSIspc").css('top', '100%' ); $(".VSIspc").css('margin-bottom', '-15px' ); $( '.tvh9oe' ).each(function (index, obj) { if ( $( obj ).css('display') != 'none' ) { progressBar = $( obj ).find('div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2)'); if ( $(progressBar).css('display') != 'none' ) { Checker(); return true; } else { theWork(obj); } } }) }, 300); } function theWork(obj) { // div.tvh9oe:nth-child(2) > c-wiz:nth-child(1) > 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) xIMG = $(obj).find('img'); xurl = $(xIMG).attr("src"); xPlaceholder = $(obj).find('.fwCBrd'); xCurrentClass = 'dJcyOc'; xPos = '130px;'; if (!$("#aTheIMG").length) { $(xPlaceholder).append('View image'); } if ( $(xurl).attr("href").startsWith('data:image/') ) { $("#aTheIMG").attr("href") = $("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'); } } $( '