Google Images direct link fix

adds a direct link for the image.

目前為 2019-11-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name     Google Images direct link fix
// @description	adds a direct link for the image.
// @version  1
// @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
// ==/UserScript==


const srcX = 'https://www.shareicon.net/data/32x32/2016/02/13/718320_camera_512x512.png';
const styleX = 'left: -167px;position: relative;filter: invert(100%);z-index: 1;top: 3px;';
var tar, x;

$( window ).on( "load", function () {
	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');
	$('.fwCBrd').append('<a id="aTheIMG" href="'+x+'" title="Open image in new tab"> <img src="'+srcX+'" href="'+x+'" target="_blank" style="'+styleX+'" ></img></a>');   
  
    $('.rg_i.Q4LuWd.tx8vtf').each( function ( i, obj ) 
    { 
	    $(obj).click( function () {
	    theWork();
	});
  
    });
});


function theWork() {
jQuery.ajaxSetup( { async: false } );
$('#aTheIMG').remove();
	setTimeout( function ()
{     
	if (!$('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)').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');
		$('.fwCBrd').append('<a id="aTheIMG" href="'+x+'" title="Open image in new tab"> <img src="'+srcX+'" href="'+x+'" target="_blank" style="'+styleX+'" ></img></a>');
	}
	else{ }
	x = '';
}, 2000 );
}