Created
April 19, 2018 04:10
-
-
Save srsgores/6bdc904aba143770cdd396277ecabb9a to your computer and use it in GitHub Desktop.
Remove facebook sponsored ads
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
"use strict"; | |
MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
const observer = new MutationObserver(function(mutations, observer) { | |
const sponsoredRegex = /[S][sponred]*/; | |
mutations.filter((mutation) => mutation.target.textContent.split(sponsoredRegex).filter((match) => match === "").length >= 4).map((ad) => ad.target.remove()); | |
}); | |
observer.observe(document.getElementById("stream_pagelet"), { | |
childList:true, | |
subtree: true, | |
attributes: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment