您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
目前Ubuntu中文论坛在当前页面打开链接,这个脚本的作用是:在新标签页打开Ubuntu中文论坛的链接!
当前为
// ==UserScript== // @name 新标签页打开Ubuntu中文论坛链接 // @version 0.0.1 // @namespace lihuiyuan.summerhost.info // @description 目前Ubuntu中文论坛在当前页面打开链接,这个脚本的作用是:在新标签页打开Ubuntu中文论坛的链接! // @include https://forum.ubuntu.org.cn/* // @include http://forum.ubuntu.org.cn/* // @author RayJing // @grant none // ==/UserScript== "use strict"; function getAnchor(element) { while (element && element.nodeName != "A") { element = element.parentNode; } return element; } document.addEventListener("click", function(e){ var anchor = getAnchor(e.target); if (!anchor || anchor.target || anchor.protocol == "javascript:" || e.isTrusted === false || !anchor.offsetParent || (e.isTrusted == null && !e.detail)) { return; } if (anchor.hostname != location.hostname) { anchor.target = "_blank"; } });