Skip to content

Instantly share code, notes, and snippets.

@nalply
Last active August 20, 2017 19:15
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 nalply/6bcb91154df56b58974a65ebb3f0b492 to your computer and use it in GitHub Desktop.
Save nalply/6bcb91154df56b58974a65ebb3f0b492 to your computer and use it in GitHub Desktop.
Youtube user script to hide recommendations and to redirect to a blank page after a video has ended. No guarantee given that it works.
// Remove sidebar repeatedly
setInterval(function() {
const sidebar = document.querySelector('#watch7-sidebar')
if (sidebar && sidebar.remove) sidebar.remove()
const sidebarModules = document.querySelector('#watch7-sidebar-modules')
if (sidebarModules && sidebarModules.remove) sidebarModules.remove()
console.log('test')
}, 500)
// Remove player after it has been stopped
const id = setInterval(function() {
const hasStopped = !!document.querySelector('.ytp-play-button').title
if (hasStopped) {
clearInterval(id)
location.replace('about:blank')
}
}, 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment