Getting rid of “promoted tweets”

While I now use Twitter solely as a ROM — read-only — I still use it quite a bit. One thing that annoys me — I mean, apart from the mangled English that passes for a bona fide language — is the new “promoted tweets” feature (I am using this word very loosely). 唔鐘意. Do. Not. Like. On my Mac I use mostly hootsuite. So I had a look at the source, and identified how the “special” tweets were identified. I then added a GreaseMonkey script to my collection:

// ==UserScript==
// @name           no promoted tweets
// @namespace      http://syngnyemun.org/
// @include        https://hootsuite.com/*
// @include        http://www.hootsuite.com/*
// ==/UserScript==

function getElementsByClassName(oElm, strTagName, strClassName){
var arrElements = (strTagName == “*” && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
//    strClassName = strClassName.replace(/\-/g, “\\-“);
//    var oRegExp = new RegExp(“(^|\\s)” + strClassName + “(\\s|$)”);
var oElement;
var tableau;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
if(oElement.className==strClassName){
arrReturnElements.push(oElement);
tableau+=oElement.className+”\n”;
}
}
return (arrReturnElements)
}

var e;

e = getElementsByClassName(document, “div”, “message _message _promoted message-promoted”);
var i,j,n, txt, pos, pos1;
j=e.length;

for(i=0;i<j;i++) {
n=e[i];
n.style.display=’none’;
}

It works also on Safari, if you install GreaseKit. Bye bye, disguised ads.

Advertisements

One response to “Getting rid of “promoted tweets”

  1. Will Leshner

    Aha. So this is why I’m not seeing your tweets lately. I’ve been using Twitter in ROM mode a lot lately myself, though I’m beginning to do a bit more tweeting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s