Youtube New UI Fix

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

当前为 2016-10-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube New UI Fix
  3. // @namespace YtNewUIFix
  4. // @description Moves the controls under the video and makes the UI look like it was before august 2015
  5. // @author Roy Scheerens
  6. // @homepageURL https://greasyfork.org/en/scripts/11485-youtube-new-ui-fix
  7. // @include https://www.youtube.com/*
  8. // @include https://youtube.googleapis.com/embed/*
  9. // @include https://www.youtube-nocookie.com/embed/*
  10. // @version 2.2.5
  11. // @grant none
  12. // ==/UserScript==
  13. /* Original typescript code: https://mega.nz/#!cJwCQDoI!elZQnuvqqQXKh8P6pzrV8oo5uAxU56RRGkFSGkzoqFM */
  14. var YtNewUIFix = (function () {
  15. function YtNewUIFix() {
  16. this.isEmbedded = window.top !== window.self;
  17. this.mouseMoveEvent = document.createEvent("Events");
  18. this.mouseMoveEvent.initEvent("mousemove", true, false);
  19. this.readOptions();
  20. }
  21. YtNewUIFix.prototype.readOptions = function () {
  22. this.addWatchLater = this.getStorage("addWatchLater", true);
  23. this.showControlsFullscreen = this.getStorage("showControlsFullscreen", true);
  24. this.showControlsNonFullscreen = this.getStorage("showControlsNonFullscreen", true);
  25. this.changeColorsFullscreen = this.getStorage("changeColorsFullscreen", true);
  26. this.changeColorsNonFullscreen = this.getStorage("changeColorsNonFullscreen", true);
  27. this.removeAnimations = this.getStorage("removeAnimations", false);
  28. this.optionsReversed = this.getStorage("optionsReversed", false);
  29. this.progressBigger = this.getStorage("progressBigger", false);
  30. this.showTitleOnHover = this.getStorage("showTitleOnHover", false);
  31. this.alwaysVolume = this.getStorage("alwaysVolume", false);
  32. };
  33. YtNewUIFix.prototype.applyFix = function () {
  34. var _this = this;
  35. if (document.body.innerHTML.length === 0) {
  36. // empty page can be ignored (in share tab before it's active)
  37. return;
  38. }
  39. this.addCSS();
  40. if (localStorage) {
  41. this.addOptions();
  42. }
  43. this.checkMoviePlayer();
  44. window.setInterval(function () {
  45. _this.checkMoviePlayer();
  46. }, 1000);
  47. };
  48. YtNewUIFix.prototype.getStorage = function (key, defaultVal) {
  49. if (!localStorage) {
  50. return defaultVal;
  51. }
  52. var result = localStorage.getItem(key);
  53. if (result) {
  54. return result === "true";
  55. }
  56. else {
  57. return defaultVal;
  58. }
  59. };
  60. YtNewUIFix.prototype.checkMoviePlayer = function () {
  61. if (!this.moviePlayer || !this.moviePlayer.parentNode) {
  62. this.moviePlayer = document.querySelector("div.html5-video-player");
  63. }
  64. else if (!this.moviePlayer.classList.contains("seeking-mode") &&
  65. !this.moviePlayer.classList.contains("dragging-mode") &&
  66. (this.showControlsNonFullscreen && !this.moviePlayer.classList.contains("ytp-fullscreen") || this.showControlsFullscreen && this.moviePlayer.classList.contains("ytp-fullscreen"))) {
  67. this.moviePlayer.dispatchEvent(this.mouseMoveEvent);
  68. }
  69. if (this.moviePlayer) {
  70. /*var settings: HTMLDivElement = <HTMLDivElement>document.querySelector(".ytp-settings-menu .ytp-panel-menu");
  71. if (settings && !settings.querySelector(".yt-fix-settings"))
  72. {
  73. var settingsDiv: HTMLDivElement = <HTMLDivElement>document.createElement("div"); //<div tabindex="0" role="menuitem" aria-haspopup="true" class="ytp-menuitem yt-fix-settings">
  74. settingsDiv["role"] = "menuitem";
  75. settingsDiv["aria-haspopup"] = "true";
  76. settingsDiv.classList.add("ytp-menuitem");
  77. settingsDiv.classList.add("yt-fix-settings");
  78. settingsDiv.innerHTML = "<div class='ytp-menuitem-label'>Youtube New UI Fix Settings</div> <div class='ytp-menuitem-content'></div>";
  79. settingsDiv.onclick = () =>
  80. {
  81. alert("settings");
  82. };
  83. settings.appendChild(settingsDiv);
  84. }*/
  85. if (this.addWatchLater) {
  86. var watchLater = document.querySelector(".ytp-chrome-top .ytp-watch-later-button");
  87. var settingsButton = document.querySelector(".ytp-settings-button");
  88. if (watchLater && settingsButton) {
  89. settingsButton.parentNode.insertBefore(watchLater, settingsButton);
  90. }
  91. }
  92. if (this.showTitleOnHover) {
  93. this.moviePlayer.classList.remove("ytp-hide-info-bar");
  94. }
  95. }
  96. if (localStorage) {
  97. if (this.checkOptions("removeAnimations", "optionsReversed", "alwaysVolume", "progressBigger", "showTitleOnHover", "showControlsFullscreen", "showControlsNonFullscreen", "changeColorsFullscreen", "changeColorsNonFullscreen")) {
  98. this.readOptions();
  99. this.showOptions();
  100. this.addCSS();
  101. }
  102. }
  103. };
  104. YtNewUIFix.prototype.checkOptions = function () {
  105. var names = [];
  106. for (var _i = 0; _i < arguments.length; _i++) {
  107. names[_i - 0] = arguments[_i];
  108. }
  109. for (var i = 0; i < names.length; i++) {
  110. if (this[names[i]] !== (localStorage.getItem(names[i]) === "true")) {
  111. return true;
  112. }
  113. }
  114. return false;
  115. };
  116. YtNewUIFix.prototype.addCSS = function () {
  117. var css = "";
  118. css = this.fixColors(css);
  119. css = this.fixControls(css);
  120. css = this.fixBigMode(css);
  121. css = this.addExtras(css);
  122. var style = document.getElementById("YoutubeNewUIFix-Style");
  123. if (style) {
  124. style.parentNode.removeChild(style);
  125. }
  126. style = document.createElement("style");
  127. style.id = "YoutubeNewUIFix-Style";
  128. delete style.textContent;
  129. style.textContent = css;
  130. document.head.appendChild(style);
  131. };
  132. YtNewUIFix.prototype.fixControls = function (css) {
  133. // options
  134. css += "h3.optionChanged::after { content: 'Refresh page to save changes'; color: red; position: relative; left: 15px; }\n\n";
  135. css += ".html5-video-player.ytp-fullscreen .html5-video-container { height: 100vh; }";
  136. css += ".html5-video-player:not(.ytp-fullscreen) .html5-video-container { height: 100%; }";
  137. css += ".ytp-chrome-bottom { left: 0 !important; }\n";
  138. css += ".ytp-chrome-controls { margin: 0 -12px; }\n";
  139. css += "body:not(.ytwp-window-player) #page:not(.watch-stage-mode) #watch7-sidebar { transform: translateY(-35px); }\n";
  140. css += "body.ytwp-window-player #page.watch-stage-mode #watch7-sidebar { transform: translateY(35px); }\n";
  141. css += "body:not(.ytwp-window-player) #page.watch-stage-mode #watch-appbar-playlist { margin-top: 35px; }\n";
  142. css += ".html5-main-video { top: 0!important; }\n";
  143. // progressbar
  144. css += ".ytp-progress-bar-container:not(.ytp-pulling) { height: 5px!important; bottom: 30.5px!important; }\n";
  145. css += ".ytp-progress-list { transform-origin: center top; }\n\n";
  146. css += ".ytp-big-mode .ytp-progress-list { transform: scaleY(0.6); }\n\n";
  147. // scale down
  148. css += ".ytp-chrome-bottom { height: 35px!important; padding: 0!important; }\n";
  149. css += ".ytp-chrome-controls .ytp-button:not(.ytp-watch-later-button) { width: 33px!important; }\n";
  150. css += ".ytp-chrome-controls .ytp-watch-later-button { width: 24px!important; }\n";
  151. css += ".ytp-left-controls { margin-left: 5px }\n";
  152. css += ".ytp-time-display { height: 31px; line-height: 32px!important; font-size: 12px!important; }\n";
  153. css += ".ytp-left-controls, .ytp-right-controls { height: 32px!important; margin-top: 3px; line-height: 36px; }\n\n";
  154. // badges
  155. 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";
  156. css += ".ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDYsNyBMNiw4IEw1LDggTDUsNyBaIE0xMCwzIEwxMCw0IEw4LDQgTDgsMyBMMTAsMyBaIE0zLDYgTDMsNSBMNSw1IEw1LDYgTDMsNiBaIE0yLDcgTDMsNyBMMyw4IEwyLDggTDIsNyBaIE03LDcgTDEwLDcgTDEwLDggTDcsOCBMNyw3IFogTTEwLDYgTDExLDYgTDExLDcgTDEwLDcgTDEwLDYgWiIgZmlsbD0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EwzLDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  160. 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; }";
  161. css += ".ytp-color-white .ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDUsNiBMNSw1IEwzLDUgTDMsNiBMMyw3IEwyLDcgTDIsMiBMMywyIEwzLDQgTDUsNCBMNSwyIEw2LDIgTDYsNyBMNSw3IFogTTExLDYgTDEwLDYgTDEwLDcgTDcsNyBMNywyIEwxMCwyIEwxMCwzIEwxMSwzIEwxMSw2IFogTTEwLDQgTDEwLDMgTDgsMyBMOCw0IEw4LDYgTDEwLDYgTDEwLDQgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  162. css += ".ytp-color-white .ytp-settings-button.ytp-4k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IFogTTEwLDUgTDgsNSBMOCw2IEw4LDcgTDcsNyBMNywyIEw4LDIgTDgsNCBMMTAsNCBMMTAsNSBaIE00LDQgTDMsNCBMMyw1IEw0LDUgTDQsNCBaIE00LDcgTDQsNiBMMiw2IEwyLDQgTDMsNCBMMywzIEw0LDMgTDQsMiBMNSwyIEw1LDUgTDYsNSBMNiw2IEw1LDYgTDUsNyBMNCw3IFogTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  163. css += ".ytp-color-white .ytp-settings-button.ytp-5k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTIsNiBMNSw2IEw1LDcgTDIsNyBNNSw1IEw2LDUgTDYsNiBMNSw2IE01LDQgTDMsNCBMMywzIEw2LDMgTDYsMiBMMiwyIEwyLDUgTDUsNSBMNSw0IFoiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48L3N2Zz4=)!important; }";
  164. css += ".ytp-color-white .ytp-settings-button.ytp-8k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTMsNiBMNSw2IEw1LDcgTDMsNyBNMywyIEw1LDIgTDUsMyBMMywzIEwzLDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  165. 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; }";
  166. // closed captions (line under the button, and position of captions)
  167. css += ".ytp-chrome-controls .ytp-button[aria-pressed='true']::after { width: 18px; left: 8px; }\n";
  168. css += ".caption-window.ytp-caption-window-bottom { margin-bottom:40px!important }\n";
  169. return css;
  170. };
  171. YtNewUIFix.prototype.fixBigMode = function (css) {
  172. /* big mode: smaller scrubber */
  173. css += ".ytp-big-mode .ytp-scrubber-button { height: 13px!important; width: 13px!important; border-radius: 6.5px!important; }\n";
  174. css += ".ytp-big-mode .ytp-scrubber-container { top: -4px; left: -6.5px; }\n\n";
  175. /* big mode: 24px edges instead of 12px */
  176. css += ".ytp-big-mode .ytp-left-controls { margin-left: -7px }\n";
  177. css += ".ytp-big-mode .ytp-fullscreen-button { margin-right: -7px }\n\n";
  178. /* big mode: smaller volume slider */
  179. css += ".ytp-big-mode .ytp-volume-slider-handle { width: 12px; height: 12px; border-radius: 6px; margin-top: -6px; }\n";
  180. css += ".ytp-big-mode .ytp-volume-slider-active .ytp-volume-panel { width: 72px; }\n\n";
  181. return css;
  182. };
  183. YtNewUIFix.prototype.fixColors = function (css) {
  184. if (this.changeColorsNonFullscreen) {
  185. css += ".html5-video-player:not(.ytp-big-mode) .ytp-chrome-bottom { background-color: #1B1B1B; border-left: 12px solid #1B1B1B; border-right: 12px solid #1B1B1B; }\n";
  186. css += ".html5-video-player:not(.ytp-big-mode) .ytp-gradient-bottom { display: none!important; }\n";
  187. css += ".html5-video-player:not(.ytp-big-mode) .ytp-chrome-controls svg path { fill: #8E8E8E }\n";
  188. }
  189. else {
  190. css += ".html5-video-player:not(.ytp-big-mode) .ytp-chrome-bottom { border-left: 12px solid transparent; border-right: 12px solid transparent; }\n";
  191. if (this.showControlsNonFullscreen) {
  192. css += ".html5-video-player:not(.ytp-fullscreen) .ytp-gradient-bottom { display: none!important; }\n";
  193. }
  194. }
  195. if (this.changeColorsFullscreen) {
  196. css += ".ytp-big-mode .ytp-chrome-bottom { background-color: #1B1B1B; border-left: 24px solid #1B1B1B; border-right: 24px solid #1B1B1B; }\n";
  197. css += ".ytp-big-mode .ytp-gradient-bottom { display: none!important; }\n";
  198. css += ".ytp-big-mode .ytp-chrome-controls svg path { fill: #8E8E8E }\n";
  199. }
  200. else {
  201. css += ".ytp-big-mode .ytp-chrome-bottom { border-left: 24px solid transparent; border-right: 24px solid transparent; }\n";
  202. if (this.showControlsFullscreen) {
  203. css += ".html5-video-player.ytp-fullscreen .ytp-gradient-bottom { display: none!important; }\n";
  204. }
  205. }
  206. css += ".ytp-gradient-top { display: none!important; }\n";
  207. css += "\n";
  208. return css;
  209. };
  210. YtNewUIFix.prototype.addExtras = function (css) {
  211. if (this.showControlsFullscreen) {
  212. css += ".html5-video-player.ytp-fullscreen:not(.ytp-hide-controls) .html5-main-video { height: calc(100% - 35px)!important; min-height: calc(100% - 35px) !important; max-height: calc(100% - 35px) !important; }\n";
  213. css += ".html5-video-player.ytp-fullscreen:not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important; }\n";
  214. }
  215. if (this.showControlsNonFullscreen) {
  216. css += ".html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .html5-main-video { height: calc(100% - 35px)!important; min-height: calc(100% - 35px) !important; max-height: calc(100% - 35px) !important; }\n";
  217. css += ".html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important; }\n";
  218. css += "html:not(.floater):not(.part_fullbrowser) #movie_player:not(.ytp-fullscreen):not(.ytp-hide-controls) { height: calc(100% + 35px)!important; }\n";
  219. css += "#theater-background { padding-bottom: 35px; }\n\n";
  220. css += "#placeholder-player { padding-bottom: 35px; }\n";
  221. }
  222. if (!this.showControlsFullscreen && !this.showControlsNonFullscreen) {
  223. css += ".html5-video-player .html5-main-video { height: 100%!important; }\n";
  224. }
  225. if (!this.showTitleOnHover) {
  226. // hide always
  227. css += ".ytp-chrome-top { display: none!important; }\n";
  228. }
  229. if (this.removeAnimations) {
  230. css += ".ytp-bezel { display: none!important; }\n";
  231. css += ".html5-endscreen *, .html5-video-player div { transition-property: none !important; animation: none !important; }\n";
  232. }
  233. if (this.optionsReversed) {
  234. css += ".ytp-panel { display: -webkit-flex; -webkit-flex-direction: column; display: flex; flex-direction: column; }\n";
  235. css += ".ytp-panel-header { order: 2; border-top: 1px solid #444; border-bottom: none; }\n";
  236. css += ".ytp-panel-content { order: 1; }\n";
  237. }
  238. if (this.alwaysVolume) {
  239. /* Have the volume slider always be visible */
  240. css += ".ytp-volume-panel { width: 52px; margin-right: 3px; } .ytp-big-mode .ytp-volume-panel { width: 78px; }";
  241. }
  242. if (this.progressBigger) {
  243. /* Make the progressbar fill up the entire space when not hovering over (thanks to Takato) */
  244. css += ".ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 24px); left: -12px; }";
  245. css += ".ytp-big-mode .ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 48px); left: -24px; }";
  246. }
  247. return css;
  248. };
  249. YtNewUIFix.prototype.showOptions = function () {
  250. var options = document.querySelectorAll("#YoutubeNewUIFix-Options input");
  251. if (options.length > 0) {
  252. for (var i = 0; i < options.length; i++) {
  253. options[i].checked = (localStorage.getItem(options[i].name) === "true");
  254. }
  255. }
  256. };
  257. YtNewUIFix.prototype.addOptions = function () {
  258. if (window.location.href.indexOf("account_playback") < 0) {
  259. return;
  260. }
  261. var content = document.querySelector("div.account-content");
  262. var footer = document.querySelector("div.account-footer");
  263. if (content && footer) {
  264. var accSection = document.createElement("div");
  265. accSection.id = "YoutubeNewUIFix-Options";
  266. accSection.classList.add("account-section");
  267. var header = document.createElement("h3");
  268. header.classList.add("account-section-header");
  269. header.textContent = "Youtube New UI Fix Options";
  270. accSection.appendChild(header);
  271. {
  272. accSection.appendChild(this.createOption("addWatchLater", "Add the watch later button to the controls"));
  273. accSection.appendChild(this.createOption("changeColorsNonFullscreen", "Change the colors back to their original gray (in non-full-screen mode)"));
  274. accSection.appendChild(this.createOption("changeColorsFullscreen", "Change the colors back to their original gray in full-screen mode"));
  275. accSection.appendChild(this.createOption("showControlsNonFullscreen", "Always show the controls (in non-full-screen mode)"));
  276. accSection.appendChild(this.createOption("showControlsFullscreen", "Always show the controls in full-screen mode"));
  277. accSection.appendChild(this.createOption("removeAnimations", "Remove all animations"));
  278. accSection.appendChild(this.createOption("optionsReversed", "Move the 'go back' button in the settings menus to the bottom"));
  279. accSection.appendChild(this.createOption("progressBigger", "Make the progressbar take up the whole width (but not when hovering over)"));
  280. accSection.appendChild(this.createOption("showTitleOnHover", "Have the title show when hovering over the video"));
  281. accSection.appendChild(this.createOption("alwaysVolume", "Have the volume slider be always visible"));
  282. }
  283. content.insertBefore(accSection, footer);
  284. }
  285. };
  286. YtNewUIFix.prototype.createOption = function (name, description) {
  287. var accDiv = document.createElement("div");
  288. accDiv.classList.add("account-section-setting");
  289. accDiv.innerHTML = "\n\t\t <label>\n\t\t\t <span class='yt-uix-form-input-checkbox-container " + (this[name] ? "checked" : "") + "'>\n <input class='yt-uix-form-input-checkbox' name='" + name + "' " + (this[name] ? "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>";
  290. var accInput = accDiv.querySelector("input[name='" + name + "']");
  291. accInput.onclick = function () {
  292. localStorage.setItem(name, String(accInput.checked));
  293. };
  294. return accDiv;
  295. };
  296. return YtNewUIFix;
  297. }());
  298. new YtNewUIFix().applyFix();
  299. //# sourceMappingURL=Youtube_New_UI_Fix.user.js.map