Last active
July 28, 2023 14:09
-
-
Save ImMALWARE/645b8aca16c1d7994f5b2e3db070526b to your computer and use it in GitHub Desktop.
Расширение, которое будет заменять ссылки t.me:// на tg://resolve?domain= в контактах пользователей
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name LZT Telegram Links | |
// @version 1.0 | |
// @description Замена ссылок t.me на tg://resolve | |
// @author Бот Super Mag с нейросетью ChatGPT | |
// @match https://zelenka.guru/* | |
// @icon https://img.icons8.com/fluency/48/null/telegram-app.png | |
// ==/UserScript== | |
let links = document.querySelectorAll("a[href^='//t.me/']"); | |
links.forEach(function(link) { | |
link.href = link.href.replace("https://t.me/", "tg://resolve?domain="); | |
}); | |
const observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
mutation.addedNodes.forEach(function(node) { | |
if (node.nodeType === Node.ELEMENT_NODE) { | |
let links = node.querySelectorAll("a[href^='//t.me/']"); | |
links.forEach(function(link) { | |
link.href = link.href.replace("https://t.me/", "tg://resolve?domain="); | |
}); | |
} | |
}); | |
}); | |
}); | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment