YouTube - Always Theater Mode

Set the default viewing mode to Theater Mode.

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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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        YouTube - Always Theater Mode
// @namespace   r-a-y/youtube/theater
// @description Set the default viewing mode to Theater Mode.
// @include     https://www.youtube.com/*
// @version     1.4.4
// @grant       none
// @run-at      document-start
// @license     GPL v3
// ==/UserScript==

// Toggle Theater Mode after YouTube finishes loading a video.
window.addEventListener("yt-navigate-finish", function(event) {
  var newPlayer = document.querySelector('button.ytp-size-button')

  setTimeout(()=> {
    if ( newPlayer && null === document.getElementsByTagName('ytd-watch-flexy')[0].getAttribute('full-bleed-player') ) {
      newPlayer.click()
    }
  }, 600)
})