移除网页版知乎的"即将离开知乎"外链跳转提示
目前為
// ==UserScript==
// @name 禁用知乎外链跳转提示
// @namespace http://reeky.org/
// @version 0.2
// @description 移除网页版知乎的"即将离开知乎"外链跳转提示
// @author ReekyStive
// @match *://*.zhihu.com/*
// @icon https://static.zhihu.com/heifetz/favicon.ico
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
let replace = function () {
console.log('Replacing');
let links = document.querySelectorAll('.external, .LinkCard');
for (let item of links) {
let link = item.getAttribute('href');
let matcher = /.*?link\.zhihu\.com\/\?target=/i;
let originalLink = decodeURIComponent(link.replace(matcher, ''));
if (link !== originalLink) {
console.log(originalLink);
}
item.setAttribute('href', originalLink);
}
};
let intervalId = setInterval(() => { replace(); }, 3000);
setTimeout(() => { clearInterval(intervalId); }, 60000);
})();