Greasy Fork is available in English.

知乎/CSDN/微信/QQ邮箱 自动加载重定向

努力让世界变得更美好!希望对你有帮助!Try to make the world better! Hope to help you!

Устаревшая версия на 01.09.2021. Перейти к последней версии.

// ==UserScript==
// @name         知乎/CSDN/微信/QQ邮箱 自动加载重定向
// @namespace    http://luyurui.cn/
// @version      4.2
// @description  努力让世界变得更美好!希望对你有帮助!Try to make the world better! Hope to help you!
// @author       Yurui
// @match        *://link.csdn.net/?target=*
// @match        *://link.zhihu.com/?target=*
// @match        *://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi?main_type=5&bancode=*
// @match        *://mail.qq.com/cgi-bin/readtemplate?t=safety&check=false&gourl=*
// @icon         https://images.cnblogs.com/cnblogs_com/luyurui/2022175/o_210829112302%E5%8A%A0%E8%BD%BD.png
// @license      MIT许可协议
// @grant        none
// ==/UserScript==
(function ()
{
    'use strict';
    var url = window.location.href;
    var interlinkage_lable;
    var interlinkage;
    function all_replace(a, b, c)
    {
        var reg = new RegExp(b, "g");
        a = a.replace(reg, c);
        return a;
    }
    function changeUrl()
    {
        url = all_replace(url, "%3A", ":");
        url = all_replace(url, "%2F", "/");
        url = all_replace(url, "%3F", "?");
        url = all_replace(url, "%3D", "=");
        url = all_replace(url, "%26", "&");
        url = all_replace(url, "%24", "$");
        //url = all_replace(url, "%5F", "_"); 浏览器可以正常识别
        url = all_replace(url, "%23", "#");
        url = all_replace(url, "%25", "%"); 
        window.location.replace(url);
    }
    if ((url.indexOf('https://link.csdn.net/?target=') && url.indexOf('http://link.csdn.net/?target=')) != -1)
    {
        window.stop();
        document.getElementsByTagName('html')[0].innerHTML='';
        if(url.indexOf('http://link.csdn.net/?target=') != -1)
        {
            url = url.replace("http://link.csdn.net/?target=", "");
        }
        else{
            url = url.replace("https://link.csdn.net/?target=", "");
        }
        changeUrl();
    }
    if ((url.indexOf('https://link.zhihu.com/?target=') && url.indexOf('http://link.zhihu.com/?target=')) != -1)
    {
        window.stop();
        document.getElementsByTagName('html')[0].innerHTML='';
        if(url.indexOf('http://link.zhihu.com/?target=') != -1)
        {
            url = url.replace('http://link.zhihu.com/?target=', '');
        }
        else{
            url = url.replace('https://link.zhihu.com/?target=', '');
        }
        changeUrl();
    }
    if ((url.indexOf('https://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi?main_type=5&bancode=') && url.indexOf('http://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi?main_type=5&bancode=')) != -1)
    {
        interlinkage_lable = document.getElementsByClassName('weui-msg__desc');
        interlinkage=interlinkage_lable[0].innerHTML;
        url=interlinkage;
        changeUrl();
    }
    if ((url.indexOf('https://mail.qq.com/cgi-bin/readtemplate?t=safety&check=false&gourl=') && url.indexOf('http://mail.qq.com/cgi-bin/readtemplate?t=safety&check=false&gourl=')) != -1)
    {
        interlinkage_lable = document.getElementsByClassName('safety-url');
        interlinkage=interlinkage_lable[0].innerHTML;
        url=interlinkage;
        changeUrl();
    }



})();