Created
February 5, 2021 09:33
-
-
Save jdb8/7381adda0c40307981d524be7b616fc9 to your computer and use it in GitHub Desktop.
simple userscript to auto-remove t.co links for anchor tags. doesn't (yet) work for link embeds
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 Remove t.co on hover | |
// @include https://*.twitter.com/* | |
// @include https://twitter.com/* | |
// @include http://*.twitter.com/* | |
// @include http://twitter.com/* | |
// ==/UserScript== | |
(function() { | |
document.addEventListener('mouseover', (e) => { | |
const t = e.target; | |
if (t.tagName !== 'A' || !t.href.startsWith('https://t.co')) { | |
return; | |
} | |
const realUrl = t.innerText.replace('…', '').replace('http://', 'https://'); | |
t.href = realUrl; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment