Always Open Telegram Link with tp Protocol

convert the URL from "http://t.me" to "tp://"

Versión del día 24/03/2019. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         Always Open Telegram Link with tp Protocol
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  convert the URL from "http://t.me" to "tp://"
// @author       Lee
// @match        https://*/*
// @grant        none
// ==/UserScript==

(function(){
for(var i=0;i<document.links.length;i++){
    var anchor=document.links[i];
    if(anchor.href.match(/^https:\/\/t.me\//)){
        var temp = anchor.href.replace(/^https:\/\/t.me\//, 'tg://resolve?domain=');
        document.links[i].href = temp;
        var method = "_self";
        document.links[i].target = method;
    }

    if(anchor.href.match(/^http:\/\/t.me\//)){
        var temp2 = anchor.href.replace(/^http:\/\/t.me\//, 'tg://resolve?domain=');
        document.links[i].href = temp;
        var method2 = "_self";
        document.links[i].target = method;
    }

    if(anchor.href.match(/^https:\/\/telegram.me\//)){
        var temp3 = anchor.href.replace(/^https:\/\/telegram.me\//, 'tg://resolve?domain=');
        document.links[i].href = temp2;
        var method3 = "_self";
        document.links[i].target = method;
    }

    if(anchor.href.match(/^http:\/\/telegram.me\//)){
        var temp4 = anchor.href.replace(/^http:\/\/telegram.me\//, 'tg://resolve?domain=');
        document.links[i].href = temp;
        var method4 = "_self";
        document.links[i].target = method;
    }
}
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。