Skip to content

Instantly share code, notes, and snippets.

@jeremyredhead
Created December 18, 2020 01:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyredhead/625cbb3ba21921ecf8ecb30a6623cc2f to your computer and use it in GitHub Desktop.
Save jeremyredhead/625cbb3ba21921ecf8ecb30a6623cc2f to your computer and use it in GitHub Desktop.
Hide/Toggle ALL YouTube Player Controls & UI
// ==UserScript==
// @name Hide/Toggle YouTube Player Controls/UI
// @description Hide/Toggle YT Player Controls & UI with the "H" key
// @version 0.1
// @match https://www.youtube.com/watch?*
// ==/UserScript==
var css = "#movie_player > :not(.html5-video-container) { display: none !important }"
var style = document.createElement('style')
style.textContent = css
style.id = 'hide_controls'
document.head.appendChild(style)
// style must be disabled AFTER document insertion or else it will not be disabled
style.disabled = true // disabled by default?
window.addEventListener('keydown', function(e) {
if (e.key.toLowerCase() === 'h')
style.disabled = (! style.disabled)
})
@oiao
Copy link

oiao commented Feb 3, 2022

works like a charm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment