YouTube - Always Theater Mode

Set the default viewing mode to Theater Mode.

目前為 2015-06-27 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        YouTube - Always Theater Mode
// @namespace   r-a-y/youtube/theater
// @description Set the default viewing mode to Theater Mode.
// @include     http://www.youtube.com/watch*
// @include     https://www.youtube.com/watch*
// @version     1.2
// @grant       none
// ==/UserScript==

document.getElementById('page').className = "watch watch-stage-mode";
document.getElementById('player').className = "content-alignment watch-medium";
document.getElementById('watch7-container').className = "watch-wide";

var playlist = document.getElementById('watch-appbar-playlist');
if (playlist) {
  playlist.setAttribute('style', 'top:520px');
}

// html5
var video = document.getElementsByTagName("VIDEO")[0];
if (video) {
  video.setAttribute('style', 'width:100%; height:100%;');
  document.getElementsByClassName('html5-video-content')[0].setAttribute('style', 'width:100% !important; height:100% !important;');
  document.getElementsByClassName('html5-video-container')[0].setAttribute('style', 'position:static');

  // props Kooilnc from Stackoverflow
  // http://stackoverflow.com/a/2706236
  function eventFire(el, etype){
    if (el.fireEvent) {
      (el.fireEvent('on' + etype));
    } else {
      var evObj = document.createEvent('Events');
      evObj.initEvent(etype, true, false);
      el.dispatchEvent(evObj);
    }
  }

  // emulate clicking on the "Theater Mode" button for HTML5 progressbar to expand
  eventFire( document.querySelector('.ytp-size-toggle-large'), 'click' );
}