Skip to content

Instantly share code, notes, and snippets.

@shpedoikal
Last active April 3, 2020 18:54
Show Gist options
  • Save shpedoikal/acfb151a5f91ea8b50f62d8acb1fe5d0 to your computer and use it in GitHub Desktop.
Save shpedoikal/acfb151a5f91ea8b50f62d8acb1fe5d0 to your computer and use it in GitHub Desktop.
Delete promoted tweets greasemonkey script
// ==UserScript==
// @name Delete promoted tweets
// @namespace kyoder
// @include *mobile.twitter.com/*
// @include *m.twitter.com/*
// @include *.twitter.com/*
// @include http://twitter.com/*
// @include https://twitter.com/*
// @version 1
// @grant none
// ==/UserScript==
function killit()
{
var kills = document.getElementsByTagName("span");
for(var i = 0; i < kills.length; i++)
{
if (kills.item(i).innerHTML == "Promoted")
kills.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";
}
}
window.onscroll = killit;
@shpedoikal
Copy link
Author

Updated. Too many .parentNodes were deleting all posts on user pages.

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