Twitter Ads Ade
I got annoyed by promoted tweets on Twitter and now there is my UserScript.
// ==UserScript==
// @name Twitter Ads
// @namespace https://twitter.com
// @version 0.1
// @description try to take over the world!
// @author You
// @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 hidePromotion() {
'use strict';
var articles = document.getElementsByTagName("article");
for (var i = 0; i < articles.length; i++) {
var article = articles[i];
var spans = article.getElementsByTagName("span");
for (var j = 0; j < spans.length; j++) {
if (spans[j].innerText == "Promoted") {
article.parentNode.remove();
console.debug('Deleted a promoted tweet ', article);
}
}
}
};
waitForKeyElements("article", hidePromotion);
KTHXBYE.