Created
December 18, 2020 01:35
-
-
Save jeremyredhead/625cbb3ba21921ecf8ecb30a6623cc2f to your computer and use it in GitHub Desktop.
Hide/Toggle ALL YouTube Player Controls & UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works like a charm, thanks!