t.co repl

master
Your Name 2023-06-01 19:23:52 +02:00
commit d75a9672cd
1 changed files with 11 additions and 0 deletions

11
twitter.user.js 100644
View File

@ -0,0 +1,11 @@
// ==UserScript==
// @match *://*.twitter.com/*
// @run-at document-start
// ==/UserScript==
function mkurl(txt){if(!/^http/.test(txt)){txt = "https://"+txt}return txt;}
function repllnks(lnks){for(let lnk of lnks){lnk.href = mkurl(lnk.textContent);lnk.classList.add("unshortreplaced");}}
function getlnks(){return document.querySelectorAll("a[href^='https://t.co']:not(.unshortreplaced)");}
function replrun(){repllnks(getlnks());}
replrun();
let obs = new MutationObserver(replrun);obs.observe(document, {childList:true, subtree:true});