Youtube New UI Fix

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

Verzia zo dňa 25.09.2016. Pozri najnovšiu verziu.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==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://greatest.deepsurf.us/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.2.0
// @grant       none
// ==/UserScript==
/* Original typescript code: https://mega.nz/#!gVIDxJgZ!-xXTYG6lNc7aGtW4ITPq0yNe62emBNGdfKg9cB58whs */
var YtNewUIFix = (function () {
    function YtNewUIFix() {
        this.isEmbedded = window.top !== window.self;
        this.mouseMoveEvent = document.createEvent('Events');
        this.mouseMoveEvent.initEvent("mousemove", true, false);
        this.addWatchLater = this.getStorage("addWatchLater", true);
        this.showControlsFullscreen = this.getStorage("showControlsFullscreen", true);
        this.showControlsNonFullscreen = this.getStorage("showControlsNonFullscreen", true);
        this.changeColors = this.getStorage("changeColors", true);
        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) : "" + 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");
        }
        else if (!this.moviePlayer.classList.contains("seeking-mode") &&
            !this.moviePlayer.classList.contains("dragging-mode") &&
            (this.showControlsNonFullscreen && !this.moviePlayer.classList.contains("ytp-fullscreen") || this.showControlsFullscreen && this.moviePlayer.classList.contains("ytp-fullscreen"))) {
            this.moviePlayer.dispatchEvent(this.mouseMoveEvent);
        }
        if (this.moviePlayer) {
            /*var settings: HTMLDivElement = <HTMLDivElement>document.querySelector(".ytp-settings-menu .ytp-panel-menu");
            if (settings && !settings.querySelector(".yt-fix-settings"))
            {
                var settingsDiv: HTMLDivElement = <HTMLDivElement>document.createElement("div"); //<div tabindex="0" role="menuitem" aria-haspopup="true" class="ytp-menuitem yt-fix-settings">
                settingsDiv["role"] = "menuitem";
                settingsDiv["aria-haspopup"] = "true";
                settingsDiv.classList.add("ytp-menuitem");
                settingsDiv.classList.add("yt-fix-settings");
                settingsDiv.innerHTML = "<div class='ytp-menuitem-label'>Youtube New UI Fix Settings</div> <div class='ytp-menuitem-content'></div>";
                settingsDiv.onclick = () =>
                {
                    alert("settings");
                };
                settings.appendChild(settingsDiv);
            }*/
            if (this.addWatchLater) {
                var watchLater = document.querySelector(".ytp-chrome-top .ytp-watch-later-button");
                var settingsButton = document.querySelector(".ytp-settings-button");
                if (watchLater && settingsButton) {
                    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";
        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 += "body:not(.ytwp-window-player) #page:not(.watch-stage-mode) #watch7-sidebar { transform: translateY(-35px); }\n";
        css += ".html5-main-video { top: 0!important; }\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 { 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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDYsNyBMNiw4IEw1LDggTDUsNyBaIE0xMCwzIEwxMCw0IEw4LDQgTDgsMyBMMTAsMyBaIE0zLDYgTDMsNSBMNSw1IEw1LDYgTDMsNiBaIE0yLDcgTDMsNyBMMyw4IEwyLDggTDIsNyBaIE03LDcgTDEwLDcgTDEwLDggTDcsOCBMNyw3IFogTTEwLDYgTDExLDYgTDExLDcgTDEwLDcgTDEwLDYgWiIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIwLjY0NzEiIGZp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Myw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!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\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) {
        if (this.changeColors) {
            css += ".ytp-chrome-bottom { background-color: #1B1B1B; border-left: 12px solid #1B1B1B; border-right: 12px solid #1B1B1B; }\n";
            css += ".ytp-big-mode .ytp-chrome-bottom { border-left: 24px solid #1B1B1B; border-right: 24px solid #1B1B1B; }\n";
            css += ".ytp-gradient-bottom { display: none!important; }\n";
            css += ".ytp-chrome-controls svg path { fill: #8E8E8E }\n";
        }
        else {
            css += ".ytp-chrome-bottom { border-left: 12px solid transparent; border-right: 12px solid transparent; }\n";
            css += ".ytp-big-mode .ytp-chrome-bottom { border-left: 24px solid transparent; border-right: 24px solid transparent; }\n";
            if (this.showControlsFullscreen) {
                css += ".html5-video-player.ytp-fullscreen .ytp-gradient-bottom { display: none!important; }\n";
            }
            if (this.showControlsNonFullscreen) {
                css += ".html5-video-player:not(.ytp-fullscreen) .ytp-gradient-bottom { display: none!important; }\n";
            }
        }
        css += ".ytp-gradient-top { display: none!important; }\n";
        css += "\n";
        return css;
    };
    YtNewUIFix.prototype.addExtras = function (css) {
        if (this.showControlsFullscreen) {
            css += ".html5-video-player.ytp-fullscreen:not(.ytp-hide-controls) .html5-main-video  { height: calc(100% - 35px)!important; }\n";
            css += ".html5-video-player.ytp-fullscreen:not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important;                }\n";
        }
        if (this.showControlsNonFullscreen) {
            css += ".html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .html5-main-video  { height: calc(100% - 35px)!important; }\n";
            css += ".html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important;                }\n";
            css += "html:not(.floater) #movie_player:not(.ytp-fullscreen):not(.ytp-hide-controls)       { height: calc(100% + 35px)!important; }\n";
            css += "#theater-background { padding-bottom: 35px; }\n\n";
            css += "#placeholder-player { padding-bottom: 35px; }\n";
        }
        if (!this.showControlsFullscreen && !this.showControlsNonFullscreen) {
            css += ".html5-video-player .html5-main-video  { height: 100%!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.showControlsNonFullscreen, "showControlsNonFullscreen", "Always show the controls (not in full-screen mode)"));
                accSection.appendChild(this.createOption(header, this.showControlsFullscreen, "showControlsFullscreen", "Always show the controls in full-screen mode"));
                accSection.appendChild(this.createOption(header, this.changeColors, "changeColors", "Change the colors back to their original gray"));
                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