Ads Blocker by FaB

Ads blocker for Facebook

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Ads Blocker by FaB
// @namespace   sponsor_fb
// @description Ads blocker for Facebook
// @include     https://www.facebook.com/
// @version     1.1
// @grant       none
// ==/UserScript==


var k = 0;
window.onload = function () {
  window.addEventListener('scroll', function () {
    k++;
    if (k > 12) {
      for (var i = 0; i < document.all.length; i++)
      {
        if (document.all[i].tagName == 'SPAN') {
          if (document.all[i].innerHTML == 'Post consigliato') {
            document.all[i].innerHTML = 'Spoiler';
          }
          if (document.all[i].className == 'uiStreamAdditionalLogging _5paw _4dcu')
          {
            
            //modifico alcune scritte
            for (var j = 3; j < 7; j++) {
              
              document.all[i - j].innerHTML = 'Ads Blocked by FaB';
              document.all[i + j + 1].innerHTML = '';
            } 
            //modifico immagine  

            for (var j = 10; j < 15; j++) {
              //alert(j + ' ' + document.all[i - j].href);
              document.all[i - j].src = 'https://image.freepik.com/free-icon/facebook-logo_318-49940.jpg' 
            }
            //modifico il link dell'immagine e la card associata 

            for (var j = 10; j < 20; j++) {
              document.all[i - j].href = '';
              if (document.all[i - j].attributes[0].name == 'data-hovercard') {
                document.all[i - j].attributes[0].value = 'FaB'
              }
            }
          }
        }
      }
      k = 1;
    }
  });
}