Youtube New UI Fix

Moves the controls under the video and makes the UI look like it was before august 2015

目前為 2016-09-06 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Youtube New UI Fix
// @namespace   YtNewUIFix
// @description Moves the controls under the video and makes the UI look like it was before august 2015
// @author      Roy Scheerens
// @homepageURL https://greasyfork.org/en/scripts/11485-youtube-new-ui-fix
// @include     https://www.youtube.com/*
// @include     https://youtube.googleapis.com/embed/*
// @include     https://www.youtube-nocookie.com/embed/*
// @version     2.0.4
// @grant       none
// ==/UserScript==
/* Original typescript code: https://mega.nz/#!gVIDxJgZ!-xXTYG6lNc7aGtW4ITPq0yNe62emBNGdfKg9cB58whs */
var YtNewUIFix = (function () {
    function YtNewUIFix() {
        this.isEmbedded = window.top != window.self;
        this.addWatchLater = this.getStorage("addWatchLater", true);
        this.hideControlsFullscreen = this.getStorage("hideControlsFullscreen", false);
        this.removeAnimations = this.getStorage("removeAnimations", false);
        this.optionsReversed = this.getStorage("optionsReversed", false);
        this.progressBigger = this.getStorage("progressBigger", false);
        this.showTitleOnHover = this.getStorage("showTitleOnHover", false);
        this.alwaysVolume = this.getStorage("alwaysVolume", false);
    }
    YtNewUIFix.prototype.applyFix = function () {
        var _this = this;
        if (document.body.innerHTML.length === 0) {
            //empty page can be ignored (in share tab before it's active)
            return;
        }
        this.addCSS();
        if (localStorage) {
            this.addOptions();
        }
        this.checkMoviePlayer();
        window.setInterval(function () {
            _this.checkMoviePlayer();
        }, 1000);
    };
    YtNewUIFix.prototype.getStorage = function (key, defaultVal) {
        if (!localStorage) {
            return defaultVal;
        }
        var result = localStorage.getItem(key);
        if (result) {
            return result == "true";
        }
        else {
            return defaultVal;
        }
    };
    YtNewUIFix.timeFormat = function (t) {
        t = 0 > t ? 0 : Math.round(t);
        return 3600 <= t ? "" + Math.floor(t / 3600) + ":" + ("0" + Math.floor(t / 60) % 60).slice(-2) + ":" + ("0" + t % 60).slice(-2) : "" + Math.floor(t / 60) % 60 + ":" + ("0" + t % 60).slice(-2);
    };
    YtNewUIFix.prototype.checkMoviePlayer = function () {
        if (!this.moviePlayer || !this.moviePlayer.parentNode) {
            this.moviePlayer = document.querySelector("div.html5-video-player");
            if (this.moviePlayer && this.moviePlayer.parentNode) {
                var video = document.querySelector(".html5-main-video");
                var playProgress = document.querySelector(".ytp-play-progress");
                var loadProgress = document.querySelector(".ytp-load-progress");
                var currentTime = document.querySelector(".ytp-time-current");
                if (video) {
                    if (playProgress && currentTime) {
                        video.addEventListener("timeupdate", function () {
                            playProgress.style.transform = "scaleX(" + (video.currentTime / video.duration) + ")";
                            currentTime.innerText = YtNewUIFix.timeFormat(video.currentTime);
                        });
                    }
                    if (loadProgress) {
                        video.addEventListener("progress", function () {
                            loadProgress.style.transform = "scaleX(" + (video.buffered.end(video.buffered.length - 1) / video.duration) + ")";
                        });
                    }
                }
            }
        }
        if (this.moviePlayer) {
            if (this.addWatchLater) {
                var watchLater = document.querySelector(".ytp-chrome-top .ytp-watch-later-button");
                var settingsButton = document.querySelector(".ytp-settings-button");
                if (watchLater) {
                    settingsButton.parentNode.insertBefore(watchLater, settingsButton);
                }
            }
            if (this.showTitleOnHover) {
                this.moviePlayer.classList.remove("ytp-hide-info-bar");
            }
        }
    };
    YtNewUIFix.prototype.addCSS = function () {
        var css = "";
        css = this.fixColors(css);
        css = this.fixControls(css);
        css = this.fixBigMode(css);
        css = this.addExtras(css);
        var style = document.createElement("style");
        style.id = "YoutubeNewUIFix-Style";
        style.textContent = css;
        document.head.appendChild(style);
    };
    YtNewUIFix.prototype.fixControls = function (css) {
        //options
        css += "h3.optionChanged::after { content: 'Refresh page to save changes'; color: red; position: relative; left: 15px; }\n\n";
        ///* moved to options */css += "html:not(.floater) .html5-video-player { height: calc(100% + 35px)!important; }\n";
        css += ".html5-video-player.ytp-fullscreen .html5-video-container { height: 100vh; }";
        css += ".html5-video-player:not(.ytp-fullscreen) .html5-video-container { height: 100%; }";
        css += ".ytp-chrome-bottom { left: 0 !important; }\n";
        css += ".ytp-chrome-controls { margin: 0 -12px; }\n";
        css += "#placeholder-player { padding-bottom: 35px; }\n";
        css += "body:not(.ytwp-window-player) #page:not(.watch-stage-mode) #watch7-sidebar { transform: translateY(-35px); }\n";
        css += ".html5-main-video { top: 0!important; }\n";
        css += "#theater-background { padding-bottom: 35px; }\n\n";
        // progressbar
        css += ".ytp-progress-bar-container:not(.ytp-pulling) { height: 5px!important; bottom: 30.5px!important;  }\n";
        css += ".ytp-progress-list { transform-origin: center top; }\n\n";
        css += ".ytp-big-mode .ytp-progress-list { -moz-transform: scaleY(0.6); -ms-transform: scaleY(0.6); -webkit-transform: scaleY(0.6); transform: scaleY(0.6); }\n\n";
        // scale down 
        css += ".ytp-chrome-bottom { height: 35px!important; padding: 0!important; }\n";
        css += ".ytp-chrome-controls .ytp-button:not(.ytp-watch-later-button) { width: 33px!important; }\n";
        css += ".ytp-chrome-controls .ytp-watch-later-button { width: 24px!important; }\n";
        css += ".ytp-left-controls { margin-left: 5px }\n";
        css += ".ytp-time-display { height: 31px; line-height: 32px!important; font-size: 12px!important; }\n";
        css += ".ytp-left-controls, .ytp-right-controls { height: 32px!important; margin-top: 3px; line-height: 36px; }\n\n";
        // badges 
        css += ".ytp-settings-button.ytp-hd-quality-badge::after,.ytp-settings-button.ytp-4k-quality-badge::after,.ytp-settings-button.ytp-5k-quality-badge::after,.ytp-settings-button.ytp-8k-quality-badge::after { content:''!important; top:6px!important; right:4px!important; height:9px!important; width:13px!important; padding: 0!important; }\n";
        css += ".ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDYsNyBMNiw4IEw1LDggTDUsNyBaIE0xMCwzIEwxMCw0IEw4LDQgTDgsMyBMMTAsMyBaIE0zLDYgTDMsNSBMNSw1IEw1LDYgTDMsNiBaIE0yLDcgTDMsNyBMMyw4IEwyLDggTDIsNyBaIE03LDcgTDEwLDcgTDEwLDggTDcsOCBMNyw3IFogTTEwLDYgTDExLDYgTDExLDcgTDEwLDcgTDEwLDYgWiIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIwLjY0NzEiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48cGF0aCBkPSJNNSw3IEw1LDYgTDUsNSBMMyw1IEwzLDYgTDMsNyBMMiw3IEwyLDIgTDMsMiBMMyw0IEw1LDQgTDUsMiBMNiwyIEw2LDcgTDUsNyBaIE0xMSw2IEwxMCw2IEwxMCw3IEw3LDcgTDcsMiBMMTAsMiBMMTAsMyBMMTEsMyBMMTEsNiBaIE0xMCw0IEwxMCwzIEw4LDMgTDgsNCBMOCw2IEwxMCw2IEwxMCw0IFoiIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48L3N2Zz4=)!important; }";
        css += ".ytp-settings-button.ytp-4k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMCw0IEwxMSw0IEwxMSw1IEwxMCw1IEwxMCw0IFogTTEwLDcgTDExLDcgTDExLDggTDEwLDggTDEwLDcgWiBNOCw1IEwxMCw1IEwxMCw2IEw4LDYgTDgsNSBaIE03LDcgTDgsNyBMOCw4IEw3LDggTDcsNyBaIE01LDYgTDYsNiBMNiw3IEw1LDcgTDUsNiBaIE00LDcgTDUsNyBMNSw4IEw0LDggTDQsNyBaIE0yLDYgTDQsNiBMNCw3IEwyLDcgTDIsNiBaIE0zLDQgTDQsNCBMNCw1IEwzLDUgTDMsNCBaIiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9IjAuNjQ3MSIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IFogTTEwLDUgTDgsNSBMOCw2IEw4LDcgTDcsNyBMNywyIEw4LDIgTDgsNCBMMTAsNCBMMTAsNSBaIE00LDQgTDMsNCBMMyw1IEw0LDUgTDQsNCBaIE00LDcgTDQsNiBMMiw2IEwyLDQgTDMsNCBMMywzIEw0LDMgTDQsMiBMNSwyIEw1LDUgTDYsNSBMNiw2IEw1LDYgTDUsNyBMNCw3IFogTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgWiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-settings-button.ytp-5k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMCw0IEwxMSw0IEwxMSw1IEwxMCw1IEwxMCw0IFogTTEwLDcgTDExLDcgTDExLDggTDEwLDggTDEwLDcgWiBNOCw1IEwxMCw1IEwxMCw2IEw4LDYgTDgsNSBaIE03LDcgTDgsNyBMOCw4IEw3LDggTDcsNyBaIE01LDYgTDYsNiBMNiw3IEw1LDcgTDUsNiBaIE0yLDcgTDUsNyBMNSw4IEwyLDggTDIsNyBaIE0yLDUgTDUsNSBMNSw2IEwyLDYgTDIsNSBaIiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9IjAuNjQ3MSIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTIsNiBMNSw2IEw1LDcgTDIsNyBNNSw1IEw2LDUgTDYsNiBMNSw2IE01LDQgTDMsNCBMMywzIEw2LDMgTDYsMiBMMiwyIEwyLDUgTDUsNSBMNSw0IFoiIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48L3N2Zz4=)!important; }";
        css += ".ytp-settings-button.ytp-8k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMCw0IEwxMSw0IEwxMSw1IEwxMCw1IEwxMCw0IFogTTEwLDcgTDExLDcgTDExLDggTDEwLDggTDEwLDcgWiBNOCw1IEwxMCw1IEwxMCw2IEw4LDYgTDgsNSBaIE03LDcgTDgsNyBMOCw4IEw3LDggTDcsNyBaIE01LDYgTDYsNiBMNiw3IEw1LDcgTDUsNiBaIE0zLDUgTDUsNSBMNSw2IEwzLDYgTDMsNSBaIE0zLDMgTDUsMyBMNSw0IEwzLDQgTDMsMyBaIE01LDQgTDYsNCBMNiw1IEw1LDUgTDUsNCBaIE0yLDQgTDMsNCBMMyw1IEwyLDUgTDIsNCBaIE0yLDYgTDMsNiBMMyw3IEwyLDcgTDIsNiBaIE0zLDcgTDUsNyBMNSw4IEwzLDggTDMsNyBaIiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9IjAuNjQ3MSIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTMsNiBMNSw2IEw1LDcgTDMsNyBNMywyIEw1LDIgTDUsMyBMMywzIEwzLDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-settings-button.ytp-3d-badge-grey:after,.ytp-settings-button.ytp-3d-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0yIDJoNHY1aC00di0xaDN2LTFoLTN2LTFoM3YtMWgtM3pNNyAyaDN2MWgtMnYzaDJ2MWgtM3pNMTAgM2gxdjNoLTF6IiBmaWxsPSIjZmZmIiAvPjxwYXRoIGQ9Ik0yIDNoM3YxaC0zek04IDNoMnYxaC0yek0yIDVoM3YxaC0zek0xMCA2aDF2MWgtMXpNMiA3aDR2MWgtNHpNNyA3aDN2MWgtM3oiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iMC42NDcxIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-color-white .ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDUsNiBMNSw1IEwzLDUgTDMsNiBMMyw3IEwyLDcgTDIsMiBMMywyIEwzLDQgTDUsNCBMNSwyIEw2LDIgTDYsNyBMNSw3IFogTTExLDYgTDEwLDYgTDEwLDcgTDcsNyBMNywyIEwxMCwyIEwxMCwzIEwxMSwzIEwxMSw2IFogTTEwLDQgTDEwLDMgTDgsMyBMOCw0IEw4LDYgTDEwLDYgTDEwLDQgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-color-white .ytp-settings-button.ytp-4k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IFogTTEwLDUgTDgsNSBMOCw2IEw4LDcgTDcsNyBMNywyIEw4LDIgTDgsNCBMMTAsNCBMMTAsNSBaIE00LDQgTDMsNCBMMyw1IEw0LDUgTDQsNCBaIE00LDcgTDQsNiBMMiw2IEwyLDQgTDMsNCBMMywzIEw0LDMgTDQsMiBMNSwyIEw1LDUgTDYsNSBMNiw2IEw1LDYgTDUsNyBMNCw3IFogTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-color-white .ytp-settings-button.ytp-5k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTIsNiBMNSw2IEw1LDcgTDIsNyBNNSw1IEw2LDUgTDYsNiBMNSw2IE01LDQgTDMsNCBMMywzIEw2LDMgTDYsMiBMMiwyIEwyLDUgTDUsNSBMNSw0IFoiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48L3N2Zz4=)!important; }";
        css += ".ytp-color-white .ytp-settings-button.ytp-8k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTMsNiBMNSw2IEw1LDcgTDMsNyBNMywyIEw1LDIgTDUsMyBMMywzIEwzLDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
        css += ".ytp-color-white .ytp-settings-button.ytp-3d-badge-grey:after,.ytp-color-white .ytp-settings-button.ytp-3d-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0yIDJoNHY1aC00di0xaDN2LTFoLTN2LTFoM3YtMWgtM3pNNyAyaDN2MWgtMnYzaDJ2MWgtM3pNMTAgM2gxdjNoLTF6IiBmaWxsPSIjMDAwIiAvPjwvc3ZnPg==)!important; }";
        // closed captions (line under the button, and position of captions) 
        css += ".ytp-chrome-controls .ytp-button[aria-pressed='true']::after { width: 18px; left: 8px; }\n";
        css += ".caption-window.ytp-caption-window-bottom {	margin-bottom:40px!important }\n";
        return css;
    };
    YtNewUIFix.prototype.fixBigMode = function (css) {
        /* big mode: smaller scrubber */
        css += ".ytp-big-mode .ytp-scrubber-button { height: 13px!important; width: 13px!important; border-radius: 6.5px!important; }\n";
        css += ".ytp-big-mode .ytp-scrubber-container { top: -4px; left: -6.5px; }\n\n";
        /* big mode: 24px edges instead of 12px */
        css += ".ytp-big-mode .ytp-left-controls { margin-left: -7px }\n";
        css += ".ytp-big-mode .ytp-fullscreen-button { margin-right: -7px }\n";
        css += ".ytp-big-mode .ytp-chrome-bottom { border-left: 24px solid #1B1B1B; border-right: 24px solid #1B1B1B; }\n\n";
        /* big mode: smaller volume slider */
        css += ".ytp-big-mode .ytp-volume-slider-handle { width: 12px; height: 12px; border-radius: 6px; margin-top: -6px; }\n";
        css += ".ytp-big-mode .ytp-volume-slider-active .ytp-volume-panel { width: 72px; }\n\n";
        return css;
    };
    YtNewUIFix.prototype.fixColors = function (css) {
        css += ".ytp-gradient-bottom, .ytp-gradient-top { display: none!important; }\n";
        css += ".ytp-chrome-bottom { background-color: #1B1B1B; border-left: 12px solid #1B1B1B; border-right: 12px solid #1B1B1B; }\n";
        css += ".ytp-chrome-controls svg path { fill: #8E8E8E }\n";
        css += "\n";
        return css;
    };
    YtNewUIFix.prototype.addExtras = function (css) {
        if (!this.isEmbedded) {
            if (this.hideControlsFullscreen) {
                // only force in non fullscreen
                // make sure the video doesn't go under the controls (unless they autohide)
                css += "                   .html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .html5-main-video  { height: calc(100% - 35px)!important; }\n";
                css += "html:not(.floater) .html5-video-player:not(.ytp-fullscreen)                                            { height: calc(100% + 35px)!important; }\n";
                css += "                   .html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important;                }\n";
            }
            else {
                // force always
                css += "                   .html5-video-player:not(.ytp-hide-controls) .html5-main-video  { height: calc(100% - 35px)!important; }\n";
                css += "html:not(.floater) .html5-video-player                                            { height: calc(100% + 35px)!important; }\n";
                css += "                   .html5-video-player:not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important;                }\n";
            }
        }
        if (!this.showTitleOnHover) {
            // hide always
            css += ".ytp-chrome-top { display: none!important; }\n";
        }
        if (this.removeAnimations) {
            css += ".ytp-bezel { display: none!important; }\n";
            css += ".html5-endscreen *, .html5-video-player div { transition-property: none !important; animation: none !important; }\n";
        }
        if (this.optionsReversed) {
            css += ".ytp-panel { display: -webkit-flex; -webkit-flex-direction: column; display: flex; flex-direction: column; }\n";
            css += ".ytp-panel-header { order: 2; border-top: 1px solid #444; border-bottom: none; }\n";
            css += ".ytp-panel-content { order: 1; }\n";
        }
        if (this.alwaysVolume) {
            /* Have the volume slider always be visible */
            css += ".ytp-volume-panel { width: 52px; margin-right: 3px; } .ytp-big-mode .ytp-volume-panel { width: 78px; }";
        }
        if (this.progressBigger) {
            /* Make the progressbar fill up the entire space when not hovering over (thanks to Takato) */
            css += ".ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 24px); left: -12px; }";
            css += ".ytp-big-mode .ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 48px); left: -24px; }";
        }
        return css;
    };
    YtNewUIFix.prototype.addOptions = function () {
        if (window.location.href.indexOf("account_playback") < 0) {
            return;
        }
        var content = document.querySelector("div.account-content");
        var footer = document.querySelector("div.account-footer");
        if (content && footer) {
            var accSection = document.createElement("div");
            accSection.classList.add("account-section");
            var header = document.createElement("h3");
            header.classList.add("account-section-header");
            header.textContent = "Youtube New UI Fix Options";
            accSection.appendChild(header);
            {
                accSection.appendChild(this.createOption(header, this.addWatchLater, "addWatchLater", "Add the watch later button to the controls"));
                accSection.appendChild(this.createOption(header, this.hideControlsFullscreen, "hideControlsFullscreen", "Have the controls automatically hide in full-screen mode"));
                accSection.appendChild(this.createOption(header, this.removeAnimations, "removeAnimations", "Remove all animations"));
                accSection.appendChild(this.createOption(header, this.optionsReversed, "optionsReversed", "Move the 'go back' button in the settings menus to the bottom"));
                accSection.appendChild(this.createOption(header, this.progressBigger, "progressBigger", "Make the progressbar take up the whole width (but not when hovering over)"));
                accSection.appendChild(this.createOption(header, this.showTitleOnHover, "showTitleOnHover", "Have the title show when hovering over the video"));
                accSection.appendChild(this.createOption(header, this.alwaysVolume, "alwaysVolume", "Have the volume slider be always visible"));
            }
            content.insertBefore(accSection, footer);
        }
    };
    YtNewUIFix.prototype.createOption = function (container, optionValue, name, description) {
        var accDiv = document.createElement("div");
        accDiv.classList.add("account-section-setting");
        accDiv.innerHTML = "\n\t\t    <label>\n\t\t\t    <span class='yt-uix-form-input-checkbox-container " + (optionValue ? "checked" : "") + "'>\n                    <input class='yt-uix-form-input-checkbox' name='" + name + "' " + (optionValue ? "checked='checked'" : "") + " type='checkbox'>\n                    <span class='yt-uix-form-input-checkbox-element'></span>\n                </span>\n\t\t\t    " + description + "\n\t\t    </label>";
        var accInput = accDiv.querySelector("input[name='" + name + "']");
        accInput.onclick = function () {
            localStorage.setItem(name, String(accInput.checked));
            container.classList.add("optionChanged");
        };
        return accDiv;
    };
    return YtNewUIFix;
}());
new YtNewUIFix().applyFix();
//# sourceMappingURL=Youtube_New_UI_Fix.user.js.map