木子屋 Dnawo's BLOG

GreaseMonkey脚本:Google Real Link

👤 dnawo 📅 2012-05-07 👁 5531 👍 0 💬 0 🔄 userscripts.org
// ==UserScript==
// @name           Google Real Link
// @namespace      http://userscripts.org/scripts/show/125473
// @description    Disable the Google search rewrite, always showing and using the real, original, direct link URLs, to stop being tracked, also to prevent from using redirected pages that might be temporarily unavailable in some area. See: http://userscripts.org/scripts/show/125473
// @include        http://www.google.*/*
// @include        https://www.google.*/*
// @include        https://encrypted.google.*/*
// @updateURL      https://userscripts.org/scripts/source/125473.meta.js
// @downloadURL    https://userscripts.org/scripts/source/125473.user.js
// @version        1.1
// @author         tomchen1989
// @license        MIT/Expat license
// ==/UserScript==
function addEventCompatible(obj, evt, fn){
	if (obj.addEventListener) {//W3C
		obj.addEventListener(evt, fn, false);
	} else if (obj.attachEvent) {//IE
		obj.attachEvent("on" + evt, fn);
	}
}
function getWindow(windowObjName) {//works after window[windowObjName] loaded
	if (typeof(unsafeWindow) !== "undefined" && typeof(unsafeWindow[windowObjName]) !== "undefined") {//Greasemonkey
		return unsafeWindow;
	} else if (typeof(window[windowObjName]) !== "undefined") {//Opera, etc.
		return window;
	} else {
		try {//Google Chrome
			var div = document.createElement("div");
			div.setAttribute("onclick", "return window;");
			var windowCompatible = div.onclick();
			if (typeof(windowCompatible[windowObjName]) === "undefined") {
				return false;
			} else {
				return windowCompatible;
			}
		} catch (e) {
			return false;
		}
	}
}
addEventCompatible(window, "load", function() {
	if (getWindow("rwt")) {
		getWindow("rwt").rwt = function () {}
	}
})

兼容于Firefox等浏览器的Greasemonkey、Scriptish等扩展插件、原生的Google Chrome和Opera等浏览器、IE的IE7Pro或其他支持用户脚本的插件。

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 Chrome扩展程序不能下载到本地解决方法 下一篇 → 天使投资、风险投资(VC)和私募股权投资(PE)的概念及区别