Skip to content

Instantly share code, notes, and snippets.

@ipepe
Last active December 3, 2019 19:35
Show Gist options
  • Save ipepe/0a1aaa388cbadd778529a838282ad076 to your computer and use it in GitHub Desktop.
Save ipepe/0a1aaa388cbadd778529a838282ad076 to your computer and use it in GitHub Desktop.
var h = function(selector){
document.querySelectorAll(selector).forEach(function(el){ el.style.display = 'none' })
}
var s = function(selector){
document.querySelectorAll(selector).forEach(function(el){ el.style.display = 'block' })
}
var pathContains = function(text){
return window.location.pathname.indexOf(text) !== -1
}
setInterval(function(){
if (pathContains('/feed/subscriptions') || pathContains('/results') || pathContains('/channel') || pathContains('/playlist')){
s('#related')
s('#comments')
s('#primary')
s('.videowall-endscreen')
}else if (window.location.pathname === '/'){
h('#related')
h('#comments')
h('#primary')
h('.videowall-endscreen')
}else{
s('#primary')
h('#related')
h('#comments')
h('.videowall-endscreen')
}
}, 300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment