Skip to content

Instantly share code, notes, and snippets.

@filipkis
Created September 24, 2016 18:01
Show Gist options
  • Save filipkis/e6b4966a1080e0d1390d27af4b90dbf4 to your computer and use it in GitHub Desktop.
Save filipkis/e6b4966a1080e0d1390d27af4b90dbf4 to your computer and use it in GitHub Desktop.
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