FB Suggested Post Killer

Prevent adds in my post!

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         FB Suggested Post Killer
// @namespace    https://www.facebook.com/
// @version      1.2
// @description  Prevent adds in my post!
// @author       Eric Mintz
// @match        https://www.facebook.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // I predict FB will change this classname from time to time.
    // ... so I have it in an easy-to-access variable here at the top.

    // -----------------------------
    // -- change me as needed
    // -----------------------------
    var divClass="_5jmm";
    // -----------------------------

    // Your code here...
    var addListener = function(element,eventName,listener){
        if(element.addEventListener){
            element.addEventListener(eventName, listener);
        }else{
            element.attachEvent('on'+eventName, listener);
        }
    };
    var killads = function(){
        var divs = document.getElementsByClassName(divClass);
        for (var i = 0; i < divs.length; i++){
            var spans = divs[i].getElementsByTagName('span');
            if (spans.length > 0 && (spans[0].innerHTML == "Suggested Post" || spans[0].innerHTML == "Voorgesteld bericht")){
                divs[i].remove();
            }
        }
    };
    addListener(document,'load',killads);
    addListener(document,'DOMNodeInserted',killads);
})();