您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
except for the link in the same directory(the link whose web address are same before the last '/' as the current url)
当前为
// ==UserScript== // @name open all links in the new tab // @description except for the link in the same directory(the link whose web address are same before the last '/' as the current url) // @include http://* // @include https://* // @author yechenyin // @version 0.2 // @namespace https://greasyfork.org/users/3586-yechenyin // @grant GM_openInTab // ==/UserScript== function getAncestorLink(element) { while (element && element.nodeName != "A") { element = element.parentNode; } if (element.nodeName === "A") return element; } document.addEventListener('click', function(e) { var link = getAncestorLink(e.target); if (link && e.isTrusted && link.href && link.href.substr(link.href.lastIndexOf('/')) !== location.href.substr(location.href.lastIndexOf('/'))) link.target = '_blank'; });