Skip to content

Instantly share code, notes, and snippets.

@scarpent
Last active September 13, 2021 14:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scarpent/4e91ef602626a1e88435120bde357356 to your computer and use it in GitHub Desktop.
Save scarpent/4e91ef602626a1e88435120bde357356 to your computer and use it in GitHub Desktop.
Better Twitter: Greasemonkey/Tampermonkey script to hide stuff you don't want to see
// ==UserScript==
// @name Better Twitter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove unwanted stuff (promoted, other people's likes, ...)
// @author Scott Carpenter
// @match https://twitter.com/
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.githubusercontent.com/scarpent/ba8e369f1187fa990b98d1f58b2c013d/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
// @grant none
// ==/UserScript==
function hideNode(jNode) {
//jNode.css("background", "yellow");
jNode.hide();
console.log('hide (dismissible)');
}
waitForKeyElements (".DismissibleModule", hideNode);
waitForKeyElements (".import-prompt", hideNode); // find people you know
waitForKeyElements (".wtf-module", hideNode); // who to follow
waitForKeyElements (".trends", hideNode);
function hideParent(jNode) {
//jNode.parent().css("background", "yellow");
jNode.parent().hide();
console.log('hide parent (promoted)');
}
waitForKeyElements (".promoted-tweet", hideParent);
function hideParentThree(jNode) {
//jNode.parent().parent().parent().css("background", "yellow");
jNode.parent().parent().parent().hide();
console.log('hide parent three (liked, follower)');
}
waitForKeyElements (".Icon--heartBadge", hideParentThree);
waitForKeyElements (".Icon--follower", hideParentThree);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment