Remove Promoted Tweets

Remove promoted tweets on twitter.com

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Remove Promoted Tweets
// @namespace    https://github.com/jogerj
// @source       https://gist.github.com/jogerj/333221ea0b5e8e09a051c38a09150127
// @version      0.1
// @description  Remove promoted tweets on twitter.com
// @author       JogerJ
// @author       cb372
// @icon         https://abs.twimg.com/favicons/favicon.ico
// @grant        none
// @match        *://twitter.com/*
// @license      MIT
// ==/UserScript==
var elems = document.getElementsByClassName('tweet')
for (var i=0; i < elems.length; i++) {
  var e = elems[i];
  if (e.nodeName.toLowerCase() == 'div' &&
    e.attributes['data-promoted'] &&
    e.attributes['data-promoted'].value == "true") {
    // Just hiding the elem doesn't work, as this is
    // not actually the elem that gets rendered to screen.
    // Twitter's script will later convert it into
    // another, visible, element.
    //e.style.display = 'none';
    e.parentNode.removeChild(e);
    console.debug('Deleted a promoted tweet', e);
  }
}