Greasy Fork

Greasy Fork is available in English.

知乎/CSDN 自动加载重定向

try to take over the world! Hope to help you!

当前为 2021-04-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         知乎/CSDN 自动加载重定向
// @namespace    http://luyurui.cn/
// @version      1.0
// @description  try to take over the world! Hope to help you!
// @author       Yurui
// @match        *://link.csdn.net/?target=*
// @match        *://link.zhihu.com/?target=*
// @icon
// @grant        none
// ==/UserScript==
(function()
 {
document.getElementsByTagName("html")[0].innerHTML='';
})();
(function()
 {
    'use strict';
    var url = window.location.href;
    window.stop();
    if (url.indexOf('https://link.csdn.net/?target=') != -1)
    {
        url = url.replace("https://link.csdn.net/?target=", "");
    }
    if (url.indexOf('https://link.zhihu.com/?target=') != -1)
    {
        url = url.replace('https://link.zhihu.com/?target=', '')
    }
    function all_replace(a, b, c)
    {
        var reg = new RegExp(b, "g");
        a = a.replace(reg, c);
        return a;
    }
    url = all_replace(url, "%3A", ":")
    url = all_replace(url, "%2F", "/")
    window.location.replace(url);
})();