Toggle youtube player ui

Press q to toggle youtube player ui for all your video screenshotting needs

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Toggle youtube player ui
// @version      2024-08-17
// @description  Press q to toggle youtube player ui for all your video screenshotting needs
// @author       PersonWhoExists
// @match        https://www.youtube.com/*
// @icon         https://www.youtube.com/s/desktop/c22661fa/img/favicon_144x144.png
// @grant        none
// @namespace https://greasyfork.org/users/1308162
// ==/UserScript==

(function() {
	let state = false
	document.addEventListener("keydown", function(event) {
		if (event.key === "q") {
            const roundedCorners = document.querySelector("#ytd-player")
			const button = document.querySelector(".ytp-chrome-bottom")
			const grad = document.querySelector(".ytp-gradient-bottom")
            const titleBar = document.querySelector(".ytp-title-text")
            const fullScreenControls = document.querySelector(".ytp-chrome-top-buttons")

            roundedCorners.style.transitionProperty = 'border-radius';
            roundedCorners.style.transitionDuration = '0.5s';
            roundedCorners.style.transitionTimingFunction = 'ease';

			if (state == false) {
                roundedCorners.style.borderRadius = "0px"
				button.style.display = "none"
				grad.style.display = "none"
                titleBar.style.display = "none"
                fullScreenControls.style.display = "none"
                state = true
			}
			else if (state == true) {
                roundedCorners.style.borderRadius = "12px"
				button.style.display = ""
				grad.style.display = ""
                titleBar.style.display = ""
                fullScreenControls.style.display = ""
                state = false
			}
		}
	})
})();