Greasy Fork

Greasy Fork is available in English.

自动跳转以下各类外链跳转页到目的地址

自动跳转以下各类外链跳转页到目的地址,包括 QQ、微信所谓“非官方页面”等

当前为 2022-06-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         自动跳转以下各类外链跳转页到目的地址
// @description  自动跳转以下各类外链跳转页到目的地址,包括 QQ、微信所谓“非官方页面”等
// @author       AnnAngela
// @version      1.0.1
// @namespace    http://greasyfork.icu/users/129402
// @mainpage     http://greasyfork.icu/zh-CN/scripts/446839
// @supportURL   http://greasyfork.icu/zh-CN/scripts/446839/feedback
// @match        http://c.pc.qq.com/*
// @match        https://c.pc.qq.com/*
// @match        http://docs.qq.com/scenario/link.html*
// @match        https://docs.qq.com/scenario/link.html*
// @match        http://afdian.net/link*
// @match        https://afdian.net/link*
// @match        http://*.afdian.net/link*
// @match        https://*.afdian.net/link*
// @match        http://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi*
// @match        https://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi*
// @match        http://t.cn/*
// @match        https://t.cn/*
// @run-at       document-end
// @license      GNU General Public License v3.0 or later
// ==/UserScript==
"use strict";
const url = new URL(location.href);
if (location.href.includes("c.pc.qq.com/middle.html") || location.href.includes("c.pc.qq.com/middlem.html") || location.href.includes("c.pc.qq.com/index.html")) {
    location.replace(url.searchParams.get("pfurl"));
}
if (location.href.includes("docs.qq.com/scenario/link.html")) {
    location.replace(url.searchParams.get("url"));
}
if (location.href.includes("afdian.net/link")) {
    location.replace(url.searchParams.get("target"));
}
if (location.href.includes("weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi")) {
    let flag = false;
    setInterval(() => {
        if (!flag && "url" in (unsafeWindow.cgiData || {})) {
            flag = true;
            location.replace(new DOMParser().parseFromString(unsafeWindow.cgiData.url, "text/html").documentElement.textContent);
        }
    }, 100);
}
if (location.href.includes("t.cn/")) {
    let flag = false;
    setInterval(() => {
        const url_view_code = unsafeWindow.document.querySelector(".url_view_code");
        if (!flag && url_view_code) {
            try {
                const url = new URL(url_view_code.innerText);
                flag = true;
                location.replace(url);
            } catch (e) {
                //a
            }
        }
    }, 100);
}