// ==UserScript== // @name 取消跳转拦截 // @namespace https://bbs.tampermonkey.net.cn/ // @version 2.2 // @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== // 跳转实现 /** * @description: 实现网页自动跳转 * @param {string} url:访问网页的域名 */ const jumpUrl = url => { const regular = domain[url] || null if (regular) { const result = urlInfo.href.match(regular) if (result) window.location.href = decodeURIComponent(result[1]) } } // 配置项 const domain = { 'c.pc.qq.com': /pfurl=(.*)&pfuin/, 'link.zhihu.com': /target=(.*)/, 'link.juejin.cn': /target=(.*)/, } // 程序入口 const urlInfo = window.location jumpUrl(urlInfo.hostname)