您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
15/3/2021, 12:47:07 pm
当前为
// ==UserScript== // @name Convert to old reddit links // @namespace Violentmonkey Scripts // @match https://gwasi.com/ // @grant none // @version 1.1 // @author - // @description 15/3/2021, 12:47:07 pm // ==/UserScript== console.log('Starting the script') function changeLink(links){ links.forEach(node => { const linkText = node.getAttribute('href') const oldLinkText = linkText.replace('//www.', '//old.') node.setAttribute('href', oldLinkText) node.setAttribute('target', '_blank') }) } function changeLinks() { const cid = setInterval(() => { const links = document.querySelectorAll('a') if (links.length) { changeLink(links) clearInterval(cid) } }, 500) } // Debounce let id = null; const debounce = (fn, delay) => (...args) => { if (id) { clearInterval(id) } id = setTimeout(() => fn.apply(args), delay) } const inputs = document.querySelectorAll('input') const debounced = debounce(changeLinks, 500) inputs.forEach(input => { input.addEventListener('change', debounced) input.addEventListener('keypress', debounced) }) changeLinks() console.log('Done with running the script')
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址