Last active
January 1, 2018 19:06
-
-
Save xim/ca63b8f8053517fc460b0b67508ed125 to your computer and use it in GitHub Desktop.
Facebook sponsored content remover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Facebook remove all sponsored content | |
// @namespace https://gist.github.com/xim | |
// @description Removes all sponsored content. | |
// @include https://www.facebook.com/* | |
// @version 6 | |
// @downloadURL https://gist.githubusercontent.com/xim/ca63b8f8053517fc460b0b67508ed125/raw/facebook-sponsored-content-remover.user.js | |
// @grant none | |
// ==/UserScript== | |
function removeAds() { | |
var ads = document.getElementsByClassName('g_xpd3mprlw'); | |
var i = 0; | |
while (i < ads.length) { | |
var el = ads[i]; | |
console.log(i); | |
while (el && el != document && !el.id.startsWith('substream')) { | |
el = el.parentNode; | |
} | |
if (el && el != document) { | |
el.remove(); | |
} else { | |
i++; | |
} | |
} | |
setTimeout(removeAds, 3000); | |
} | |
removeAds(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment