Skip to content

Instantly share code, notes, and snippets.

@englehardt
Last active November 17, 2019 18:08
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 englehardt/9855bcea5ae6447f289092b6f7d6a41d to your computer and use it in GitHub Desktop.
Save englehardt/9855bcea5ae6447f289092b6f7d6a41d to your computer and use it in GitHub Desktop.
Greasemonkey userscript to remove tweets from timeline which only show up because they were liked by someone you follow.
// ==UserScript==
// @name Remove Likes on Twitter
// @namespace twitter
// @include https://twitter.com/
// @version 2
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle('div.promoted-tweet, div[data-component-context=suggest_activity_tweet] {display: none !important}');
@nomaed
Copy link

nomaed commented Sep 7, 2018

Just wrote a short script to remove those tweets for myself, and then saw your version because I wanted to see how other people approach it :)

setInterval(function removePromotions() {
    document.querySelectorAll(".promoted-tweet").forEach(function(promo) {
        promo.parentNode.remove();
    });
}, 250);

Also noticed that you started with an approach of removing the block, and then switched to hiding it. Much more efficient probably.

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