Greasy Fork is available in English.

QQ 链接拦截自动跳转

QQ或者TIM自动拦截群内未知链接时,自动跳转到目标地址

// ==UserScript==
// @name         QQ 链接拦截自动跳转
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  QQ或者TIM自动拦截群内未知链接时,自动跳转到目标地址
// @author       You
// @run-at       document-start
// @match        *://c.pc.qq.com/*
// @grant        unsafeWindow
// ==/UserScript==

(function() {
    'use strict';

    function getQueryVariable(variable)
    {
        var query = unsafeWindow.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }

    var url = decodeURIComponent(getQueryVariable("pfurl"));
    var urllowercase = url.toLowerCase();
    if (urllowercase.startsWith("http://") || urllowercase.startsWith("https://") || urllowercase.startsWith("ftp://") || urllowercase.startsWith("ftps://")) {
        // no thing
    } else {
        url = "http://" + url;
    }

    unsafeWindow.location.replace(url);
})();