Skip to content

Instantly share code, notes, and snippets.

@LennyPenny
Last active December 8, 2021 19:54
Show Gist options
  • Save LennyPenny/f94a5e212a4aff26af39ce8496259536 to your computer and use it in GitHub Desktop.
Save LennyPenny/f94a5e212a4aff26af39ce8496259536 to your computer and use it in GitHub Desktop.
bye t.co
// ==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