Facebook Remove Suggested and Sponsored Posts (Beta)

Remove Suggested for You and Sponsored posts (Beta)

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

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 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         Facebook Remove Suggested and Sponsored Posts (Beta)
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Remove Suggested for You and Sponsored posts (Beta)
// @author       Visualplastik
// @match        https://www.facebook.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @grant        none
// ==/UserScript==



function gtfo() {

    //Remove Suggested for You
    $( "span:contains('Suggested for you')" ).parent().parent().parent().parent().parent().hide().next().hide().next().hide().next().hide();

    document.querySelectorAll('svg').forEach((el) => {
        if(parseInt(el.style.width.replace('px','')) + parseInt(el.style.marginRight.replace('px','')) > 54) {
            console.log('ad found');
           el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.remove();
        }
    })
}

//Initial Run
setTimeout(function(){
    gtfo();
}, 3000);

//Repeat on Scroll
$( window ).scroll(function() {
  gtfo();
});