Last active
August 29, 2015 14:02
-
-
Save moimikey/d73293991d25a5786215 to your computer and use it in GitHub Desktop.
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
# Hide elements via selectors. | |
# | |
# Works wonderfully to block facebook ads which are | |
# pre-loaded ;o zomg | |
# | |
# Probably won't often update this gist, but selectors | |
# simply need to be added to @patterns | |
# | |
# You can avoid the transpile if you run this using | |
# the Injector, chrome extension. s'what I use. | |
# | |
# moimikey / 2014 | |
# | |
class FuckOffFacebook | |
constructor: -> | |
@pattern = [] | |
@patterns = | |
all: 'div[data-xt]' | |
egos: '.ego_column' | |
@query() | |
@voodoo() | |
setInterval => | |
@voodoo() | |
, 6e4 | |
query: -> | |
for k of @patterns | |
@pattern.push @patterns[k] if @patterns.hasOwnProperty(k) | |
voodoo: -> | |
els = document.querySelectorAll(@pattern.join(',')) | |
i = els.length | |
while i-- | |
els[i].style.display = "none" | |
window.fof = new FuckOffFacebook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment