Created
September 24, 2016 18:01
-
-
Save filipkis/e6b4966a1080e0d1390d27af4b90dbf4 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
var getAdContainer = function(element){ | |
if(!element || element.className.match(/\b_4ikz\b/)){ | |
return element | |
} | |
return getAdContainer(element.parentNode) | |
} | |
var hideAds = function() { | |
var ads = document.getElementsByClassName('uiStreamSponsoredLink'); | |
for(var i = 0; i < ads.length; i++){ | |
var adContainer = getAdContainer(ads[i]); | |
if(adContainer) { | |
adContainer.style.display = 'none'; | |
} | |
} | |
} | |
hideAds(); | |
window.onscroll = function(){ | |
hideAds(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment