重定向QQ的链接拦截

提前重定向 QQ 的链接跳转,避免被sb QQ拦截

// ==UserScript==
// @name         重定向QQ的链接拦截
// @namespace    http://tampermonkey.net/
// @version      2025-07-08
// @author       zmal
// @description  提前重定向 QQ 的链接跳转,避免被sb QQ拦截
// @match        https://c.pc.qq.com/ios.html*
// @grant        none
// @license MIT
// @run-at       document-start
// ==/UserScript==

(function() {
    const href = location.href;

    const urlParamIndex = href.indexOf('url=');
    if (urlParamIndex === -1) return;

    const start = urlParamIndex + 4;
    let end = href.indexOf('&', start);
    end = end === -1 ? href.length : end;

    const encodedUrl = href.substring(start, end);

    try {
        const decodedUrl = decodeURIComponent(encodedUrl);

        const cleanUrl = decodedUrl.endsWith('.html/')
        ? decodedUrl.slice(0, -1)
        : decodedUrl;


        location.replace(cleanUrl);
    } catch(e) {
        console.debug('URL解码失败:', e.message);
    }
})();