消腾讯和飞书链接插入页

自动跳转腾讯链接和飞书链接插入页

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        消腾讯和飞书链接插入页
// @namespace   Violentmonkey Scripts
// @match       *://c.pc.qq.com/middlem.html*
// @match       *://c.pc.qq.com/middleb.html*
// @match       *://c.pc.qq.com/middlect.html*
// @match       *://c.pc.qq.com/ios.html*
// @match       *://security.feishu.cn/link/safety*
// @grant       none
// @version     1.4
// @author      Eric_Lian
// @description 自动跳转腾讯链接和飞书链接插入页
// @icon        https://3gimg.qq.com/tele_safe/static/tmp/ic_alert_blue.png
// @license     MIT
// @run-at      document-start
// ==/UserScript==
(function(){
    'use strict';

    function getParams(name){
        const urlParams = new URLSearchParams(window.location.search);
        return urlParams.get(name);
    }

    function getTarget() {
        const hostname = location.hostname;
        if (hostname == 'c.pc.qq.com') {
            return getParams('pfurl') ?? getParams('url');
        } else if (hostname == 'security.feishu.cn' ){
            return getParams('target');
        }
    }

    let target = getTarget();
    if (target) {
        if (target.indexOf(":/") < 0) {
          target = "http://" + target;
        }
        window.location.replace(target);
    }
})();