qq-docs Redirect Fix

Avoid link redirect for docs.qq.com

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                qq-docs Redirect Fix
// @name:zh-CN          腾讯文档地址重定向
// @description         Avoid link redirect for docs.qq.com
// @description:zh-CN   自动跳过网站安全性未知提示页面

// @author              GallenHu
// @namespace           https://hgl2.com
// @license             MIT
// @icon                https://pub.idqqimg.com/pc/misc/files/20200904/2eb030216d9362bbc6c0df045857b718.png

// @grant               none
// @run-at              document-end
// @include             https://docs.qq.com/scenario/link.html?url=*

// @date                03/15/2021
// @modified            03/15/2021
// @version             0.1.0
// ==/UserScript==


(function () {
    'use strict';

    let timer = null;

    function checkLink() {
        const $linkWrapper = document.querySelector('.url-click');
        if ($linkWrapper) {
            const targetUrl = $linkWrapper.innerText;
            if (targetUrl) {
                clearInterval(timer);
                location.href = targetUrl.trim();
            }
        }
    }

    timer = setInterval(checkLink, 100);
})();