Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Convert and redirect t.me to telegram.me
- // @namespace https://greasyfork.org/en/users/85671-jcunews
- // @version 1.0.1
- // @license AGPL v3
- // @author jcunews
- // @description Context: https://www.reddit.com/r/userscripts/comments/xey0b1/request_userscript_which_redirects_tme_to/
- // @match *://*/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (() => {
- if ((location.hostname === "t.me") && !sessionStorage.tmeRedired) {
- sessionStorage.tmeRedired = 1;
- return location.hostname = "telegram.me"
- }
- function chkEle(e) {
- if ((e.tagName === "A") && (e.hostname === "t.me")) {
- e.hostname = "telegram.me"
- } else e.querySelectorAll && e.querySelectorAll('a').forEach(chkEle)
- }
- (new MutationObserver(recs => {
- recs.forEach(rec => rec.addedNodes.forEach(chkEle))
- })).observe(document, {childList: true, subtree: true})
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement