Skip to content

Instantly share code, notes, and snippets.

@aweis
Created October 1, 2020 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aweis/7eb1ef5615deb36b9664677a15533a14 to your computer and use it in GitHub Desktop.
Save aweis/7eb1ef5615deb36b9664677a15533a14 to your computer and use it in GitHub Desktop.
JS to run on twitter.com to remove ?s= params from URLs
@aweis
Copy link
Author

aweis commented Oct 1, 2020

You can run this with https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija and now twitter links wont have that annoying s query param on tweets

@aweis
Copy link
Author

aweis commented Jun 4, 2021

@aweis
Copy link
Author

aweis commented Apr 26, 2022

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(_) {}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment