FB Suggested Post Killer

Prevent adds in my post!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
})();