您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
enter something useful
当前为
// ==UserScript== // @name Hacker news open links in new tab // @version 0.1 // @namespace hackernewsnewtab // @description enter something useful // @author You // @include https://news.ycombinator.com/* // @grant none // @noframes // ==/UserScript== var re = /^https?:\/\/news\.ycombinator\.com\/news\?p=\d$/i; var cells = document.getElementsByTagName("td"); for (var i = 0; i < cells.length; i++) { td = cells[i]; if ('title' === td.className) { links = td.getElementsByTagName('a'); if (links.length > 0) { link = links[0]; if (!link.href.match(re)) { link.setAttribute("target", "_blank"); } } } }