Greasy Fork is available in English.

Facebook Block Sponsored figuccio

rimuove Sponsoredon right Facebook

// ==UserScript==
// @name            Facebook Block Sponsored figuccio
// @namespace       https://greasyfork.org/users/237458
// @version         0.2
// @author          figuccio
// @description     rimuove Sponsoredon right Facebook
// @match           https://*.facebook.com/*
// @run-at          document-start
// @grant           GM_addStyle
// @icon            https://facebook.com/favicon.ico
// @license         MIT
// ==/UserScript==
(function () {
  let xpath = function (xpathToExecute) {
    let result = [];
    let nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (let i = 0; i < nodesSnapshot.snapshotLength; i++) {
      result.push(nodesSnapshot.snapshotItem(i));
    }
    return result;
  };
                          //9settembre 2022
  let thePath = "//div[1]/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div/div[3]/div/div/div[1]/div/div[1]/span/div/div";
  let runCount;
  let intv = 500; // Esegui ogni 0,5 secondi
  let intvEnd = 5000; // Cancella dopo 5 secondi
  let go = setInterval(pollDOM, intv);

  function pollDOM() {
    runCount += intv; // Aggiungi il valore intv a runCount ogni volta per contare la quantità di ms eseguiti
    if (runCount >= intvEnd) {
      //Cancella intervallo dopo intvEnd
      clearInterval(go);
    }

    try {
      if (xpath(thePath)[0].children[0].children.length) {
        xpath(thePath)[0].children[0].remove();
      }
    }
    catch {}
  }
})();
/////////////////////////////
//remove solo scritta sponsor
//GM_addStyle('span > div > .x1n2onr6 > .x1cnzs8.xjkvuk6.x193iq5w.x2lah0s.xdt5ytf.x78zum5.x9f619.x1ja2u2z.x1n2onr6 {display:none!important}');
    //remove sponsor
//GM_addStyle('span > div > .x1n2onr6 > .x1y1aw1k.xwib8y2{display:none !important}');//sponsor
    ////////////////////////////////////////////////////////////////////////////////
//remove sponsorizzato toglie tutte e 2
GM_addStyle('div[role="complementary"] > div[class] > div[class] > div[class] span > div > div:not([aria-label]):not([data-visualcompletion]):has(> div[class] > div[class] div[class] > a[href^="https://l."][href*="facebook.com/l.php?u="][target="_blank"]) {display:none!important}');