Greasy Fork

Greasy Fork is available in English.

Google Images direct link fix

Adds a direct button link for the image.

当前为 2019-12-14 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name     Google Images direct link fix
// @description	Adds a direct button link for the image.
// @version  1.5b
// @grant    none
// @include  https://www.google.com/search?*
// @require  https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @namespace http://greasyfork.icu/users/11231
// ==/UserScript==

var xurl, progressBar, xIMG, xPlaceholder, xCurrentClass, xPos;

$(window).on("load", function() {
  $("#aTheIMG").remove();
	Checker();
  
	$(window).click(function(e) { 
		if ( $(e.target).prop("tagName") == 'IMG' ) {
    $("#aTheIMG").remove();
    Checker(); 
  	}
	});
});


function Checker() { setTimeout(function() { 
progressBar = $('html>body#gsr.srp.tbo.vasq>div#main>div#cnt>div#rcnt>div.col>div#center_col>div#res.med>div#search>div>div#rso>div#isr_mc.irc-vo>div>div#irc_bg.irc-unt>div#irc_cc>div#irc-ss.jKbJyf>div.irc_c.i8187.immersive-container>div.irc_t.i30052>div.irc_pgb.jfk-progressBar-blocking');   
	if ( $(progressBar).css('display') != 'none' ) {
  	Checker();
    return true;
	} else {
  	theWork(); 
	}
}, 500); }
                 
function theWork() {
  
    $('.irc_c.i8187.immersive-container').each(function (index, value) {
     if( $(value).css('display') != 'none' ) {
       xIMG = $(value).find('img');
     }
		});
     
  xurl = $(xIMG).attr("src"); 
  xPlaceholder = $('.hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2)');
  xCurrentClass = $('.hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > a:nth-child(2)').attr('class');
  xPos = '130px;';
  
	if (!$("#aTheIMG").length) {
  	$(xPlaceholder).append('<a class="'+xCurrentClass+'" id="aTheIMG" style="right:'+xPos+'" href="'+xurl+'" title="Open image in new tab" target="_blank" ><span>View image</span></a>');
	}

}

$( '<style>' ).text(' \
#aTheIMG { \
position: relative; \
z-index: 1; \
top: 1px; \
margin-left: -84px; \
text-decoration: none !important; \
} \
#aTheIMG > span {padding-left: 3px;} \
#aTheIMG:hover { \
filter: brightness(1.3); \
} \
div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > a:nth-child(3), .hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > a:nth-child(1) { \
margin-right: -0px; \
} \
.hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > a:nth-child(1) {pointer-events: none !important;} \
.hZC4Sd > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > a:nth-child(1) > div:nth-child(1) {pointer-events: all !important;} \
' ).appendTo( document.head );