Skip to content

Instantly share code, notes, and snippets.

@neighthan
Created June 12, 2018 15:12
Show Gist options
  • Save neighthan/cd92abbaf27d0570830eed181d95a979 to your computer and use it in GitHub Desktop.
Save neighthan/cd92abbaf27d0570830eed181d95a979 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Focused YouTube
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Remove distracting things (comments, other video suggestions) from YouTube video pages
// @author Nathan Hunt
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict'
let waitAndHide = function(id) {
setTimeout(function () {
let element = document.getElementById(id)
console.log(`Trying to hide ${id} (${element}).`)
if (element) {
element.style.display = 'none'
} else {
waitAndHide(id)
}
}, 1000)
}
waitAndHide('comments')
// the videos on the side, including Up Next
waitAndHide('items')
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment