Last active
December 8, 2021 19:54
-
-
Save LennyPenny/f94a5e212a4aff26af39ce8496259536 to your computer and use it in GitHub Desktop.
bye t.co
This file contains 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 bye t.co | |
// @namespace https://lenny.ninja | |
// @version 0.1 | |
// @description hope u never return | |
// @author @ohitsLenny | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?domain=twitter.com | |
// ==/UserScript== | |
async function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
(async function() { | |
'use strict'; | |
while (true) { | |
const links = document.querySelectorAll("[href^='https://t.co']"); | |
for (let link of links) { | |
if (link.innerHTML.search(/https?:\/\/<\/span>/g) == -1) { | |
continue | |
} | |
link.setAttribute("href", link.textContent.slice(0, -1)); | |
} | |
await sleep(1000); // TODO: maybe somehow only run this on timeline updates? | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment