t.me 挂掉了,来个油猴脚本自动替换网页中的 t.me 为 telegram.me

Tokin 2026-07-14 17:03 1

RT,t.me 今天挂掉了,导致很多老哥的 tg 联系链接、群组链接 都无法直接打开了,安装这个脚本,可以把页面中所有 t.me 链接替换为 telegram.me 以解决链接无法打开的问题,省心省力 ^-^


// ==UserScript==
// @name Telegram 域名替换器 (t.me -> telegram.me)
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 自动将网页中的 t.me 链接替换为 telegram.me
// @author YourName
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
'use strict';

// 核心替换逻辑
function replaceLinks() {
// 查找所有以 https://t.me/ 或 http://t.me/ 开头的链接
const links = document.querySelectorAll('a[href*="t.me"]');
links.forEach(link => {
if (link.href.includes('://t.me/')) {
link.href = link.href.replace('://t.me/', '://telegram.me/');

// 如果标签文本本身也是网址,同步修改文本显示
if (link.textContent.includes('t.me/')) {
link.textContent = link.textContent.replace('t.me/', 'telegram.me/');
}
}
});
}

// 1. 页面加载时立即执行一次
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', replaceLinks);
} else {
replaceLinks();
}

// 2. 使用 MutationObserver 监听动态加载的网页内容(比如推特、论坛的滚动加载)
const observer = new MutationObserver((mutations) => {
replaceLinks();
});

observer.observe(document.body || document.documentElement, {
childList: true,
subtree: true
});
})();
最新回复 (11)
  • cclolipops 07-14 17:05
    1

    可以的

  • linuschen 07-14 17:09
    2

    不错

  • dmax 07-14 17:15
    3

    不好用,也可能是我设置不对。。。。

  • gonode 07-14 17:17
    4

    为什么挂掉了,应该很快会恢复吧

  • 杜会主乂 07-14 17:21
    5

    我他喵就说google的t.me链接每一个点的开的,我还以为是我小鸡出了问题

  • 風憩 07-14 17:22
    6

  • Tokin 楼主 07-14 17:22
    7

    @dmax #3 很简单就生效了呀。

  • Tokin 楼主 07-14 17:24
    8

    @gonode #4 不知道为啥管局给hold了,快1天了还没好呢

  • AaronNS 07-14 17:24
    9

    应该等等就好了吧

  • Hann 07-14 18:35
    10

    牛逼啊 大佬

  • tplink 07-14 19:44
    11

    好用👍

* 帖子来源NodeSeek
返回