您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Open links in new tab (Ctrl-click or Middle-click loads it in background), works on dynamically added content too.
当前为
- // ==UserScript==
- // @name Open links in new tab
- // @description Open links in new tab (Ctrl-click or Middle-click loads it in background), works on dynamically added content too.
- // @namespace wOxxOm.scripts
- // @author wOxxOm
- // @version 1.0.1
- // @license MIT License
- // @grant GM_openInTab
- // @run-at document-start
- // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
- // ==/UserScript==
- attachHandler([].slice.call(document.getElementsByTagName('a')));
- setMutationHandler(document, 'a', function(nodes) {
- attachHandler(nodes);
- return true;
- });
- function attachHandler(nodes) {
- nodes.forEach(function(node) {
- if (node.target != '_blank') {
- node.onclick = clickHandler;
- node.addEventListener('click', clickHandler);
- }
- });
- }
- function clickHandler(e) {
- if (e.button > 1)
- return;
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- GM_openInTab(this.href, e.button || e.ctrlKey);
- }