// ==UserScript== // @name 知乎/简书去除安全中心,直接跳转链接地址。 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 屏蔽知乎/简书安全中心,直接跳转链接地址。 // @author CeeYang // @match https://*.zhihu.com/* // @match https://*.jianshu.com/* // @grant none // @license GPLv3 // @downloadURL none // ==/UserScript== (function() { 'use strict'; getRightHref(); window.onscroll = function() { setTimeout(function() { getRightHref(); }, 500); } /// 知乎 function getRightHrefForZhiHu() { /// 获取所有 a 标签 var documents = document.getElementsByTagName("a"); for (var i = 0; i < documents.length; i++) {if (documents[i].href.indexOf("link.zhihu.com") != -1) { documents[i].setAttribute("href",decodeURIComponent(documents[i].href.split("target=")[1])) } } } /// 简书 function getRightHrefForJianShu() { /// 获取所有 a 标签 var documents = document.getElementsByTagName("a"); for (var i = 0; i < documents.length; i++) {if (documents[i].href.indexOf("links.jianshu.com") != -1) { documents[i].setAttribute("href",decodeURIComponent(documents[i].href.split("go?to=")[1])) } } } /// 获取正确的地址用于跳转 function getRightHref() { getRightHrefForZhiHu(); getRightHrefForJianShu(); } })();