QQ屏蔽链接跳转目标链接

QQ屏蔽链接重定向为目标链接

// ==UserScript==
// @name QQ屏蔽链接跳转目标链接
// @description QQ屏蔽链接重定向为目标链接
// @author ChatGPT
// @version 1.0
// @match https://c.pc.qq.com/*url=*
// @run-at document-start
// @grant none
// @namespace https://greasyfork.org/users/452911
// ==/UserScript==
(function(){
    function getTargetUrl(url){
        let parsedUrl = new URL(url);
        let targetUrl = new URLSearchParams(parsedUrl.search).get('url');

        if(targetUrl){
            targetUrl = decodeURIComponent(targetUrl);
        }

        return targetUrl;
    };

    var url = window.location.href;
    var targetUrl = getTargetUrl(url);

    if(targetUrl !== null && targetUrl !== undefined && targetUrl !== ""){
        window.location.href = targetUrl; // 直接访问目标地址
    }
})();