Skip to content

Instantly share code, notes, and snippets.

@seanlinehan
Last active April 15, 2024 01:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanlinehan/b3a4d89dde518bc2a5c72a4aed0ee20f to your computer and use it in GitHub Desktop.
Save seanlinehan/b3a4d89dde518bc2a5c72a4aed0ee20f to your computer and use it in GitHub Desktop.
Mute these words on Twitter to eliminate some negativity from your life
appalled
ashamed
asshole
complicit
deplorable
deplore
disgraceful
disgusted
fuck
fucking
homophobe
horrified
idiot
moron
outrage
outraged
racist
repulsive
sexist
shameless
stupid
vile
@seanlinehan
Copy link
Author

seanlinehan commented Jan 19, 2021

Instructions to use:

  1. Go to https://twitter.com/settings/muted_keywords
  2. Open Developer Tools
  3. Paste the following code in:
const delayMs = 500; // change this if you feel like its running too fast

const keywords = `appalled
ashamed
asshole
complicit
deplorable
deplore
disgraceful
disgusted
fuck
fucking
homophobe
horrified
idiot
moron
outrage
outraged
racist
repulsive
sexist
shameless
stupid
vile`.split(/\W+/);

const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;

const addMutedKeyword = keyword => {
 const input = document.querySelector("[name='keyword']");
 nativeInputValueSetter.call(input, keyword);
 input.dispatchEvent(new Event('input', { bubbles: true }));
 document.querySelector("[data-testid='settingsDetailSave']").click();
}

const delay = () => {
 return new Promise(res => setTimeout(res, delayMs));
};

keywords.reduce(async (prev, keyword) => {
 await prev;
 document.querySelector("a[href='/settings/add_muted_keyword']").click();
 await delay();
 addMutedKeyword(keyword);
 return delay();
}, Promise.resolve());

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