Skip to content

Instantly share code, notes, and snippets.

@moimikey
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moimikey/d73293991d25a5786215 to your computer and use it in GitHub Desktop.
Save moimikey/d73293991d25a5786215 to your computer and use it in GitHub Desktop.
# 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