remove redirects in zhihu.com
当前为
// ==UserScript==
// @name remove_redirect
// @namespace https://github.com/mikelxk/remove_redirect
// @version 0.0.0
// @author mikelxk
// @description remove redirects in zhihu.com
// @license MIT
// @icon https://vitejs.dev/logo.svg
// @match *://*.zhihu.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
setInterval(() => {
let links = document.querySelectorAll("a");
links.forEach((link) => {
if (link.href.includes("https://link.zhihu.com/?target=")) {
const urlParams = new URLSearchParams(link.href.split("?")[1]);
const newLink = urlParams.get("target");
if (newLink) {
link.href = decodeURIComponent(newLink);
}
}
});
}, 1e3);
})();