Hide Youtube player controls.

Hide Youtube player controls. Press key 'h' to hide or show player contols.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Hide Youtube player controls.
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Hide Youtube player controls. Press key 'h' to hide or show player contols.
// @author       You
// @match        *://*.youtube.com/watch?*
// @grant        none
 // @license MIT
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Your code here...
    var key = 72; // h
    var hide = 0;
 
    function logKey(e){
        switch(e.keyCode){
                case key:
                    if(hide == 0){
                        // hide the elements that are on the YouTube video player using CSS
                        document.getElementsByClassName('ytp-chrome-top')[0].style.visibility = 'hidden';
                        document.getElementsByClassName('ytp-chrome-controls')[0].style.visibility = 'hidden';
                        document.getElementsByClassName('ytp-gradient-top')[0].style.visibility = 'hidden';
                        document.getElementsByClassName('ytp-gradient-bottom')[0].style.visibility = 'hidden';
                        document.getElementsByClassName('ytp-progress-bar')[0].style.visibility = 'hidden';
                        document.getElementsByClassName('ytp-progress-bar-container')[0].style.visibility = 'hidden';
                        hide = 1;
                    }else{
                        // show the elements that are on the YouTube video player using CSS
                        document.getElementsByClassName('ytp-chrome-top')[0].style.visibility = 'visible';
                        document.getElementsByClassName('ytp-chrome-controls')[0].style.visibility = 'visible';
                        document.getElementsByClassName('ytp-gradient-top')[0].style.visibility = 'visible';
                        document.getElementsByClassName('ytp-gradient-bottom')[0].style.visibility = 'visible';
                        document.getElementsByClassName('ytp-progress-bar')[0].style.visibility = 'visible';
                        document.getElementsByClassName('ytp-progress-bar-container')[0].style.visibility = 'visible';
                        hide = 0;
                    }
                    break;
       }
    }
    document.addEventListener("keydown", logKey);
})();