NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Facebook AdBlock 2020 - Block ads from Facebook timeline // @name:es-ES Facebook AdBlock 2020 - Bloquea los anuncios del timeline de Facebook // @namespace http://tampermonkey.net/ // @version 1.1.1 // @description Remove Facebook Ads - Only English and Spanish // @description:es-ES Elimina los anuncios del timeline de Facebook - Sólo en inglés y español // @author Anarchy // @license MIT // @match https://www.facebook.com/* // @grant none // ==/UserScript== const removeAds = () => { var langs = new Array(new Array('S', 'p', 'o', 'n', 's', 'o', 'r', 'e', 'd'),new Array('P', 'u', 'b', 'l', 'i', 'c', 'i', 'd', 'a')); var character = null; var letChecked = null; var feeds = document.getElementById('contentArea').querySelectorAll('[id*=hyperfeed_story_id]'); for (var i = 0; i < feeds.length; i++) { var checkAds = feeds[i].querySelector('h5'); if (checkAds !== null) { checkAds = checkAds.nextSibling; } if (checkAds !== undefined && checkAds !== '' && checkAds !== null) { for (var h = 0; h < langs.length; h++) { letChecked = new Array(false, false, false, false, false, false, false, false, false); for (var j = 0; j < langs[h].length; j++) { character = checkAds.querySelectorAll('[data-content="' + langs[h][j] + '"]'); for (var k = 0; k < character.length; k++) { if (character[k].offsetWidth > 0) { letChecked[j] = true; } } } if (letChecked.indexOf(false) === -1) { feeds[i].parentNode.removeChild(feeds[i]); console.log('Ad Removed'); } } } } } (function() { window.addEventListener('load', () => { setTimeout(removeAds, 1000); }); window.addEventListener('scroll', () => { setTimeout(removeAds, 1000); }); })();