Greasy Fork is available in English.

移除Google的搜索结果重定向,包括其图片搜索

移除Google搜索结果及其图片搜索的重定向

Tính đến 15-05-2016. Xem phiên bản mới nhất.

// ==UserScript==
// @name         移除Google的搜索结果重定向,包括其图片搜索
// @namespace    google.com.xinggsf
// @description  移除Google搜索结果及其图片搜索的重定向
// @description:en Remove all link redirection on Google Search Results,and Google image Search!
// updateURL    https://raw.githubusercontent.com/xinggsf/gm/master/%E7%A7%BB%E9%99%A4Google%E7%9A%84%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C%E9%87%8D%E5%AE%9A%E5%90%91%EF%BC%8C%E5%8C%85%E6%8B%AC%E5%85%B6%E5%9B%BE%E7%89%87%E6%90%9C%E7%B4%A2.user.js
// @include      /^https?:\/\/www\.google(?:\.\w+)+\/(?:search|webhp|#)/
// @grant        none
// @version      2016.5.15
// ==/UserScript==

// if (rwt) unsafeWindow.rwt = null;
"use strict";
if (window.chrome)
	NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
//是否为图片搜索
let soutu = location.search.includes('site=imghp'),
css = soutu ? 'a[jsaction^="mousedown:irc."]' :
	'a[onmousedown*="return rwt"]',
fn = rs => {
	let rl = document.querySelectorAll(css);
	for (let a of rl)
		a.removeAttribute('onmousedown');
},
fnSoutu = rs => {
	let s, a = document.querySelector(css);
	a.removeAttribute('jsaction');
	// a.removeAttribute('class');
	// s = 'data-ved';
	// if (!a.hasAttribute(s)) s = 'ved';
	// a.removeAttribute(s);
	// a.firstChild.removeAttribute('class');
	a.outerHTML = a.outerHTML;
};
new MutationObserver(soutu ? fnSoutu : fn).observe(document.body, {
	childList: true, subtree: true
});