您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Opens specific links in a new tab on beehaw.org
// ==UserScript== // @name Beehaw.org Open Posts in New Tab // @namespace https://gf.qytechs.cn/en/users/1127287-harasho // @version 0.6 // @description Opens specific links in a new tab on beehaw.org // @author You // @match https://beehaw.org/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; // Function to add onclick attribute to specific links function addTargetBlankToLinks() { const addOnclickToLink = (link) => { link.setAttribute('onclick', "window.open(this.href,'_blank');return false;"); }; const primaryLinks = document.querySelectorAll('a.link-primary'); const darkLinksInH1 = document.querySelectorAll('h1 a.link-dark'); const specificLinks = document.querySelectorAll('.btn.btn-link.btn-sm.text-muted.ps-0'); const otherLinks = document.querySelectorAll('a.thumbnail.rounded.overflow-hidden.d-inline-block.position-relative.p-0.border-0'); primaryLinks.forEach(addOnclickToLink); darkLinksInH1.forEach(addOnclickToLink); specificLinks.forEach(addOnclickToLink); otherLinks.forEach(addOnclickToLink); } // Observe DOM changes and add onclick attribute to newly added links const observer = new MutationObserver(() => { addTargetBlankToLinks(); }); const targetNode = document.body; const observerConfig = { childList: true, subtree: true, }; observer.observe(targetNode, observerConfig); // Call the function to add onclick attribute to existing links addTargetBlankToLinks(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址