您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Makes any magnet link in a <code> block clickable across the instance
// ==UserScript== // @name Clickable Magnets // @namespace Violentmonkey Scripts // @match *://lemmy.dbzer0.com/* // @grant none // @version 1.0.1 // @license MIT // @author sweepline's https://gf.qytechs.cn/en/scripts/468920-base64-link-decoder, slightly modified by ram // @description Makes any magnet link in a <code> block clickable across the instance // ==/UserScript== function decodeURLS() { while (true) { // We must do FIRST_ORDERED_NODE_TYPE runs many times as the iterator dies in NODE_ITERATOR_TYPE if the dom changes. let xpath = document.evaluate("//code[contains(text(),'magnet:?')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (xpath.singleNodeValue == null) { break; } const magnet = xpath.singleNodeValue.innerText xpath.singleNodeValue.innerHTML = `<a href="${magnet}">${decodeURIComponent(magnet)}</a>`; } } // First load replace window.addEventListener('load', decodeURLS, {once: true, capture: false}); // For listening on navigation const observeUrlChange = () => { let oldHref = document.location.href; const body = document.querySelector("body"); const observer = new MutationObserver(mutations => { if (oldHref !== document.location.href) { oldHref = document.location.href; setTimeout(decodeURLS, 300); } }); observer.observe(body, { childList: true, subtree: true }); }; window.onload = observeUrlChange;
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址