// ==UserScript== // @name 取消跳转拦截 // @namespace https://bbs.tampermonkey.net.cn/ // @version 2.1 // @description 取消跳转拦截 // @author 冰冻大西瓜 // @match https://link.juejin.cn/?target=* // @match https://c.pc.qq.com/middlem.html* // @match https://link.zhihu.com/?target=* // @run-at document-start // @license // ==/UserScript== // 跳转实现 const jumpUrl = regular => { const result = window.location.href.match(regular) window.location.href = decodeURIComponent(result[1]) } // 配置项 const domain = { 'c.pc.qq.com': /pfurl=(.*)&pfuin/, 'link.zhihu.com': /target=(.*)/, } // 匹配URL console.log('window.location.hostname=>', window.location.hostname) switch (window.location.hostname) { case 'c.pc.qq.com': jumpUrl(domain['c.pc.qq.com']) break case 'link.zhihu.com': case 'link.juejin.cn': jumpUrl(domain['link.zhihu.com']) break default: break }