Skip to content

Instantly share code, notes, and snippets.

@bulton-fr
Last active August 29, 2017 10:52
Show Gist options
  • Save bulton-fr/19d76a754c5d67b1eec248a9d0519353 to your computer and use it in GitHub Desktop.
Save bulton-fr/19d76a754c5d67b1eec248a9d0519353 to your computer and use it in GitHub Desktop.
Twitter Clean Timeline
//Remove liked suggest tweet
const allTweetSuggest = document.querySelectorAll('div[data-component-context="suggest_activity_tweet"]');
const nbSuggest = allTweetSuggest.length;
let suggestTweet;
for (let suggestLoopIndex = 0; suggestLoopIndex < nbSuggest; suggestLoopIndex++) {
suggestTweet = allTweetSuggest[suggestLoopIndex];
suggestTweet.parentNode.remove();
}
//Remove promoted suggest tweet
const allTweetPromoted = document.querySelectorAll('div[data-promoted="true"]');
const nbPromoted = allTweetPromoted.length;
let promotedTweet;
for (let promotedLoopIndex = 0; promotedLoopIndex < nbPromoted; promotedLoopIndex++) {
promotedTweet = allTweetPromoted[promotedLoopIndex];
promotedTweet.parentNode.remove();
}
//Remove recap block
const allBlockRecap = document.querySelectorAll('li[data-component-context="suggest_recap"]');
const nbRecap = allBlockRecap.length;
let recapBlock;
for (let recapLoopIndex = 0; recapLoopIndex < nbRecap; recapLoopIndex++) {
recapBlock = allBlockRecap[recapLoopIndex];
recapBlock.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment