Hide Youtube player controls.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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       noushadbug
// @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);
})();