Created
October 1, 2020 00:17
-
-
Save aweis/7eb1ef5615deb36b9664677a15533a14 to your computer and use it in GitHub Desktop.
JS to run on twitter.com to remove ?s= params from URLs
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
document.addEventListener('copy', function(e) { | |
const text = e.target.textContent; | |
try { | |
const url = new URL(text); | |
url.searchParams.delete("s"); | |
e.clipboardData.setData('text/plain', url.href); | |
e.preventDefault(); | |
} catch(_) {} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the updated code
document.addEventListener('copy', function(e) {
const text = e.target.textContent;
try {
const url = new URL(text);
url.searchParams.delete("s");
url.searchParams.delete("t");
e.clipboardData.setData('text/plain', url.href);
e.preventDefault();
} catch(_) {}
});