Youtube UI Fix

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

当前为 2020-04-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube UI Fix
  3. // @namespace YtUIFix
  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
  7. // @include https://www.youtube.com*
  8. // @include https://youtube.googleapis.com/embed*
  9. // @include https://www.youtube-nocookie.com/embed*
  10. // @version 2.4.10
  11. // @grant none
  12. // ==/UserScript==
  13. var YtNewUIFix = /** @class */ (function () {
  14. function YtNewUIFix() {
  15. var _this = this;
  16. this.prefix = "ytfix::";
  17. this.isEmbedded = window.top !== window.self;
  18. this.isSettingsPage = window.location.href.toLowerCase().match("(\\.com\\/embed|\\.com)\\/ui_fix_options") !== null;
  19. this.mouseMoveEvent = document.createEvent("Events");
  20. this.mouseMoveEvent.initEvent("mousemove", false, false);
  21. document.body.classList.add("yt-ui-fix");
  22. this.readOptions();
  23. addEventListener("storage", function (e) {
  24. if (e.key && e.key.indexOf(_this.prefix) >= 0) {
  25. _this.readOptions();
  26. _this.showOptions();
  27. _this.addCSS();
  28. _this.handleWatchLater();
  29. }
  30. });
  31. }
  32. YtNewUIFix.prototype.readOptions = function () {
  33. this.setOption("addWatchLater", true);
  34. this.setOption("showControlsFullscreen", true);
  35. this.setOption("showControlsNonFullscreen", true);
  36. this.setOption("changeColorsFullscreen", true);
  37. this.setOption("changeColorsNonFullscreen", true);
  38. this.setOption("removeAnimations", false);
  39. this.setOption("optionsReversed", false);
  40. this.setOption("progressBigger", false);
  41. this.setOption("showTitleOnHover", false);
  42. this.setOption("alwaysVolume", false);
  43. };
  44. YtNewUIFix.prototype.applyFix = function () {
  45. var _this = this;
  46. if (document.body.innerHTML.length === 0) {
  47. // empty page can be ignored (in share tab before it's active)
  48. return;
  49. }
  50. if (!this.isSettingsPage) {
  51. this.addCSS();
  52. this.checkMoviePlayer();
  53. window.setInterval(function () {
  54. _this.checkMoviePlayer();
  55. _this.handleWatchLater();
  56. }, 1000);
  57. }
  58. this.addOptions();
  59. };
  60. YtNewUIFix.prototype.setOption = function (key, defaultVal) {
  61. if (!localStorage) {
  62. this[key] = defaultVal;
  63. }
  64. var result = this.getSetting(key);
  65. if (result) {
  66. this[key] = (result === "true");
  67. }
  68. else {
  69. this[key] = defaultVal;
  70. }
  71. };
  72. YtNewUIFix.prototype.getSetting = function (key) {
  73. return localStorage.getItem(this.prefix + key);
  74. };
  75. YtNewUIFix.prototype.setSetting = function (key, value) {
  76. localStorage.setItem(this.prefix + key, String(value));
  77. };
  78. YtNewUIFix.prototype.checkMoviePlayer = function () {
  79. if (!this.moviePlayer || !this.moviePlayer.parentNode) {
  80. this.moviePlayer = document.querySelector(".html5-video-player");
  81. }
  82. if (this.moviePlayer && this.moviePlayer.parentNode) {
  83. if (!this.moviePlayer.classList.contains("seeking-mode") &&
  84. !this.moviePlayer.classList.contains("dragging-mode") &&
  85. (this.showControlsNonFullscreen && !this.moviePlayer.classList.contains("ytp-fullscreen") || this.showControlsFullscreen && this.moviePlayer.classList.contains("ytp-fullscreen"))) {
  86. this.moviePlayer.dispatchEvent(this.mouseMoveEvent);
  87. }
  88. if (this.showTitleOnHover) {
  89. this.moviePlayer.classList.remove("ytp-hide-info-bar");
  90. }
  91. }
  92. };
  93. YtNewUIFix.prototype.handleWatchLater = function () {
  94. if (!this.watchLaterbutton || !this.settingsButton) {
  95. this.watchLaterbutton = document.querySelector(".ytp-chrome-top .ytp-watch-later-button");
  96. this.settingsButton = document.querySelector(".ytp-settings-button");
  97. if (this.watchLaterbutton && this.watchLaterbutton.parentElement) {
  98. this.oldWatchParent = this.watchLaterbutton.parentElement;
  99. }
  100. }
  101. if (this.watchLaterbutton && this.settingsButton) {
  102. if (this.addWatchLater && this.settingsButton.parentNode) {
  103. if (this.watchLaterbutton.parentNode !== this.settingsButton.parentNode) {
  104. this.settingsButton.parentNode.insertBefore(this.watchLaterbutton, this.settingsButton);
  105. }
  106. }
  107. else {
  108. this.oldWatchParent.appendChild(this.watchLaterbutton);
  109. }
  110. }
  111. };
  112. YtNewUIFix.prototype.addCSS = function () {
  113. var css = "";
  114. var StyleId = "YoutubeNewUIFix-Style";
  115. css = this.fixColors(css);
  116. css = this.fixControls(css);
  117. css = this.fixBigMode(css);
  118. css = this.addExtras(css);
  119. var style = document.getElementById(StyleId);
  120. if (style && style.parentNode) {
  121. style.parentNode.removeChild(style);
  122. delete style.textContent;
  123. }
  124. style = document.createElement("style");
  125. style.id = StyleId;
  126. style.textContent = css;
  127. document.head.appendChild(style);
  128. };
  129. YtNewUIFix.prototype.fixControls = function (css) {
  130. // options
  131. css += "h3.optionChanged::after { content: 'Refresh page to save changes'; color: red; position: relative; left: 15px; }\n\n";
  132. css += ".account-content-on-player { top: 0px; left: 0px; position: absolute; padding: 0; margin: 0; width: 100%; height: 100% }";
  133. css += ".account-content-on-player account-section { top: 50px; left: 50px; z-index: 100; background-color: white; padding: 10px 25px 30px; margin: 0; }";
  134. css += ".html5-video-player.ytp-fullscreen .html5-video-container { height: 100vh; }";
  135. css += ".html5-video-player:not(.ytp-fullscreen) .html5-video-container { height: 100%; }";
  136. css += ".ytp-chrome-bottom { left: 0 !important; }\n";
  137. css += ".ytp-chrome-controls { margin: 0 -12px; }\n";
  138. css += "body:not(.ytwp-window-player) #page:not(.watch-stage-mode) #watch7-sidebar { transform: translateY(-35px); }\n";
  139. css += "body:not(.ytwp-window-player) #page.watch-stage-mode #watch-appbar-playlist { margin-top: 35px; }\n";
  140. css += ".html5-main-video { top: 0!important; }\n";
  141. // move content below video down in the material layout
  142. css += "ytd-watch[theater] #main { padding-top: 35px!important; }";
  143. css += "ytd-watch:not([theater]) #content-separator { padding-bottom: 35px!important; }";
  144. // width correction of the controls in the material layout
  145. css += ".html5-main-video { max-width: 100%; }";
  146. css += ".ytp-chrome-bottom { max-width: calc(100% - 24px); width: calc(100% - 24px); }";
  147. // progressbar
  148. css += ".ytp-progress-bar-container:not(.ytp-pulling) { height: 5px!important; bottom: 30px!important; }\n";
  149. css += ".ytp-progress-list { transform-origin: center top; }\n\n";
  150. css += ".ytp-big-mode .ytp-progress-list { transform: scaleY(0.6); }\n\n";
  151. // scale down
  152. css += ".ytp-chrome-bottom { height: 35px!important; padding: 0!important; }\n";
  153. css += ".ytp-chrome-controls .ytp-button { width: 33px!important; }\n";
  154. css += ".ytp-chrome-controls .ytp-watch-later-icon { width: 24px; height: 24px; }\n";
  155. css += ".ytp-chrome-controls .ytp-watch-later-button { opacity: 1!important; display: inline-block!important; transform: translateY(-4px); }\n";
  156. css += ".ytp-left-controls { margin-left: 5px }\n";
  157. css += ".ytp-time-display { height: 31px; line-height: 32px!important; font-size: 12px!important; }\n";
  158. css += ".ytp-left-controls, .ytp-right-controls { height: 32px!important; margin-top: 3px; line-height: 36px; }\n\n";
  159. // badges
  160. 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";
  161. css += ".ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDYsNyBMNiw4IEw1LDggTDUsNyBaIE0xMCwzIEwxMCw0IEw4LDQgTDgsMyBMMTAsMyBaIE0zLDYgTDMsNSBMNSw1IEw1LDYgTDMsNiBaIE0yLDcgTDMsNyBMMyw4IEwyLDggTDIsNyBaIE03LDcgTDEwLDcgTDEwLDggTDcsOCBMNyw3IFogTTEwLDYgTDExLDYgTDExLDcgTDEwLDcgTDEwLDYgWiIgZmlsbD0iIz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LDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  165. 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; }";
  166. css += ".ytp-color-white .ytp-settings-button.ytp-hd-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik01LDcgTDUsNiBMNSw1IEwzLDUgTDMsNiBMMyw3IEwyLDcgTDIsMiBMMywyIEwzLDQgTDUsNCBMNSwyIEw2LDIgTDYsNyBMNSw3IFogTTExLDYgTDEwLDYgTDEwLDcgTDcsNyBMNywyIEwxMCwyIEwxMCwzIEwxMSwzIEwxMSw2IFogTTEwLDQgTDEwLDMgTDgsMyBMOCw0IEw4LDYgTDEwLDYgTDEwLDQgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  167. css += ".ytp-color-white .ytp-settings-button.ytp-4k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IFogTTEwLDUgTDgsNSBMOCw2IEw4LDcgTDcsNyBMNywyIEw4LDIgTDgsNCBMMTAsNCBMMTAsNSBaIE00LDQgTDMsNCBMMyw1IEw0LDUgTDQsNCBaIE00LDcgTDQsNiBMMiw2IEwyLDQgTDMsNCBMMywzIEw0LDMgTDQsMiBMNSwyIEw1LDUgTDYsNSBMNiw2IEw1LDYgTDUsNyBMNCw3IFogTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  168. css += ".ytp-color-white .ytp-settings-button.ytp-5k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTIsNiBMNSw2IEw1LDcgTDIsNyBNNSw1IEw2LDUgTDYsNiBMNSw2IE01LDQgTDMsNCBMMywzIEw2LDMgTDYsMiBMMiwyIEwyLDUgTDUsNSBMNSw0IFoiIGZpbGwtcnVsZT0iZXZlbm9kZCIgLz48L3N2Zz4=)!important; }";
  169. css += ".ytp-color-white .ytp-settings-button.ytp-8k-quality-badge:after { background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwJSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMgOSIgd2lkdGg9IjEwMCUiPjxwYXRoIGQ9Ik0xMSw1IEwxMSw3IEwxMCw3IEwxMCw2IEwxMCw1IEwxMSw1IE0xMCw1IEw4LDUgTDgsNiBMOCw3IEw3LDcgTDcsMiBMOCwyIEw4LDQgTDEwLDQgTDEwLDUgTTEwLDIgTDExLDIgTDExLDQgTDEwLDQgTDEwLDIgTTMsNiBMNSw2IEw1LDcgTDMsNyBNMywyIEw1LDIgTDUsMyBMMywzIEwzLDIgWiBNNSw1IEw2LDUgTDYsNiBMNSw2IEw1LDUgWiBNMyw0IEw1LDQgTDUsNSBMMyw1IEwzLDQgWiBNNSwzIEw2LDMgTDYsNCBMNSw0IEw1LDMgWiBNMiw1IEwzLDUgTDMsNiBMMiw2IEwyLDUgWiBNMiwzIEwzLDMgTDMsNCBMMiw0IEwyLDMgWiIgZmlsbC1ydWxlPSJldmVub2RkIiAvPjwvc3ZnPg==)!important; }";
  170. 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; }";
  171. // closed captions (line under the button, and position of captions)
  172. css += ".ytp-chrome-controls .ytp-button[aria-pressed='true']::after { width: 18px; left: 8px; }\n";
  173. css += ".caption-window.ytp-caption-window-bottom { margin-bottom:40px!important }\n";
  174. css += ".ytp-player-content { top: 48px !important; bottom: 49px !important; }\n";
  175. // fix for material layout where controls go over title.
  176. css += "ytd-watch-flexy[theater] #player-theater-container, ytd-watch-flexy #player { margin-bottom: 35px; }\n";
  177. // fix watch later messing up embedded
  178. css += ".ytp-chrome-bottom .ytp-watch-later-title { display: none; }\n";
  179. return css;
  180. };
  181. YtNewUIFix.prototype.fixBigMode = function (css) {
  182. /* big mode: smaller scrubber */
  183. css += ".ytp-big-mode .ytp-scrubber-button { height: 13px!important; width: 13px!important; border-radius: 6.5px!important; }\n";
  184. css += ".ytp-big-mode .ytp-scrubber-container { top: -4px; left: -6.5px; }\n\n";
  185. /* big mode: 24px edges instead of 12px */
  186. css += ".ytp-big-mode .ytp-left-controls { margin-left: -7px }\n";
  187. css += ".ytp-big-mode .ytp-fullscreen-button { margin-right: -7px }\n\n";
  188. /* big mode: smaller volume slider */
  189. css += ".ytp-big-mode .ytp-volume-slider-handle { width: 12px; height: 12px; border-radius: 6px; margin-top: -6px; }\n";
  190. css += ".ytp-big-mode .ytp-volume-slider-active .ytp-volume-panel { width: 72px; }\n\n";
  191. return css;
  192. };
  193. YtNewUIFix.prototype.fixColors = function (css) {
  194. if (this.changeColorsNonFullscreen) {
  195. 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";
  196. css += ".html5-video-player:not(.ytp-big-mode) .ytp-gradient-bottom { display: none!important; }\n";
  197. css += ".html5-video-player:not(.ytp-big-mode) .ytp-chrome-controls svg path { fill: #8E8E8E }\n";
  198. }
  199. else {
  200. css += ".html5-video-player:not(.ytp-big-mode) .ytp-chrome-bottom { border-left: 12px solid transparent; border-right: 12px solid transparent; }\n";
  201. if (this.showControlsNonFullscreen) {
  202. css += ".html5-video-player:not(.ytp-fullscreen) .ytp-gradient-bottom { display: none!important; }\n";
  203. }
  204. }
  205. if (this.changeColorsFullscreen) {
  206. css += ".ytp-big-mode .ytp-chrome-bottom { background-color: #1B1B1B; border-left: 24px solid #1B1B1B; border-right: 24px solid #1B1B1B; }\n";
  207. css += ".ytp-big-mode .ytp-gradient-bottom { display: none!important; }\n";
  208. css += ".ytp-big-mode .ytp-chrome-controls svg path { fill: #8E8E8E }\n";
  209. }
  210. else {
  211. css += ".ytp-big-mode .ytp-chrome-bottom { border-left: 24px solid transparent; border-right: 24px solid transparent; }\n";
  212. if (this.showControlsFullscreen) {
  213. css += ".html5-video-player.ytp-fullscreen .ytp-gradient-bottom { display: none!important; }\n";
  214. }
  215. }
  216. css += ".ytp-gradient-top { display: none!important; }\n";
  217. css += "\n";
  218. return css;
  219. };
  220. YtNewUIFix.prototype.addExtras = function (css) {
  221. if (this.showControlsFullscreen) {
  222. css += "html:not(.floater) .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";
  223. css += ".html5-video-player.ytp-fullscreen:not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important; display: block!important; }\n";
  224. }
  225. if (this.showControlsNonFullscreen) {
  226. css += "html:not(.floater) .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";
  227. css += ".html5-video-player:not(.ytp-fullscreen):not(.ytp-hide-controls) .ytp-chrome-bottom { opacity: 1!important; display: block!important; }\n";
  228. css += "html:not(.floater):not(.part_fullbrowser) #movie_player:not(.ytp-fullscreen):not(.ytp-hide-controls) { height: calc(100% + 35px)!important; }\n";
  229. css += "html.floater .html5-video-player { padding-bottom: 35px; }\n";
  230. css += "#theater-background { padding-bottom: 35px; }\n\n";
  231. css += "#placeholder-player { padding-bottom: 35px; }\n";
  232. }
  233. if (!this.showControlsFullscreen && !this.showControlsNonFullscreen) {
  234. css += ".html5-video-player .html5-main-video { height: 100%!important; }\n";
  235. }
  236. if (!this.showTitleOnHover) {
  237. // hide always
  238. css += ".ytp-chrome-top { display: none!important; }\n";
  239. }
  240. if (this.removeAnimations) {
  241. css += ".ytp-bezel { display: none!important; }\n";
  242. css += ".html5-endscreen *, .html5-video-player div { transition-property: none !important; animation: none !important; }\n";
  243. }
  244. if (this.optionsReversed) {
  245. css += ".ytp-panel { display: -webkit-flex; -webkit-flex-direction: column; display: flex; flex-direction: column; }\n";
  246. css += ".ytp-panel-header { order: 2; border-top: 1px solid #444; border-bottom: none; }\n";
  247. css += ".ytp-panel-content { order: 1; }\n";
  248. }
  249. if (this.alwaysVolume) {
  250. /* Have the volume slider always be visible */
  251. css += ".ytp-volume-panel { width: 52px; margin-right: 3px; } .ytp-big-mode .ytp-volume-panel { width: 78px; }";
  252. }
  253. if (this.progressBigger) {
  254. /* Make the progressbar fill up the entire space when not hovering over (thanks to Takato) */
  255. css += ".ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 24px); left: -12px; }";
  256. css += ".ytp-big-mode .ytp-progress-bar-container:not(:hover):not(.ytp-pulling) .ytp-progress-list { width: calc(100% + 48px); left: -24px; }";
  257. }
  258. return css;
  259. };
  260. YtNewUIFix.prototype.showOptions = function () {
  261. var options = document.querySelectorAll("#YoutubeNewUIFix-Options input");
  262. if (options.length > 0) {
  263. for (var i = 0; i < options.length; i++) {
  264. options[i].checked = (this.getSetting(options[i].name) === "true");
  265. }
  266. }
  267. };
  268. YtNewUIFix.prototype.addOptions = function () {
  269. var _this = this;
  270. if (localStorage) {
  271. var accSection_1 = document.createElement("div");
  272. accSection_1.id = "YoutubeNewUIFix-Options";
  273. accSection_1.classList.add("account-section");
  274. var header = document.createElement("h3");
  275. header.classList.add("account-section-header");
  276. header.textContent = "Youtube UI Fix Options";
  277. accSection_1.appendChild(header);
  278. {
  279. accSection_1.appendChild(this.createOption("addWatchLater", "Add the watch later button to the controls"));
  280. accSection_1.appendChild(this.createOption("changeColorsNonFullscreen", "Change the colors back to their original gray (in non-full-screen mode)"));
  281. accSection_1.appendChild(this.createOption("changeColorsFullscreen", "Change the colors back to their original gray in full-screen mode"));
  282. accSection_1.appendChild(this.createOption("showControlsNonFullscreen", "Always show the controls (in non-full-screen mode)"));
  283. accSection_1.appendChild(this.createOption("showControlsFullscreen", "Always show the controls in full-screen mode"));
  284. accSection_1.appendChild(this.createOption("removeAnimations", "Remove all animations"));
  285. accSection_1.appendChild(this.createOption("optionsReversed", "Move the 'go back' button in the settings menus to the bottom"));
  286. accSection_1.appendChild(this.createOption("progressBigger", "Make the progressbar take up the whole width (but not when hovering over)"));
  287. accSection_1.appendChild(this.createOption("showTitleOnHover", "Have the title show when hovering over the video"));
  288. accSection_1.appendChild(this.createOption("alwaysVolume", "Have the volume slider be always visible"));
  289. }
  290. var content = document.querySelector(".account-content");
  291. var footer = document.querySelector(".account-footer");
  292. var selectedItem = document.querySelector(".creator-sidebar-item.selected");
  293. if (!content) {
  294. content = document.querySelector("#contents");
  295. }
  296. if (!selectedItem) {
  297. selectedItem = document.querySelector(".ytd-settings-sidebar-renderer[active]");
  298. }
  299. if (this.isSettingsPage) {
  300. document.head.innerHTML = document.body.innerHTML = "";
  301. document.body.appendChild(accSection_1);
  302. }
  303. else if (content && selectedItem.innerHTML.indexOf("Playback") >= 0) {
  304. if (footer) {
  305. content.insertBefore(accSection_1, footer);
  306. }
  307. else {
  308. content.appendChild(accSection_1);
  309. }
  310. }
  311. var exportBtn_1 = document.createElement("button");
  312. exportBtn_1.classList.add("yt-uix-button", "yt-uix-button-size-default", "yt-uix-button-primary", "account-action-button");
  313. exportBtn_1.type = "button";
  314. exportBtn_1.textContent = "Export Settings";
  315. exportBtn_1.onclick = function () {
  316. var settingsScript = "// ==UserScript==\n";
  317. settingsScript += "// @name Youtube UI Fix Settings\n";
  318. settingsScript += "// @namespace YtUIFix\n";
  319. settingsScript += "// @description Sets the settings for Youtube UI Fix\n";
  320. settingsScript += "// @author Roy Scheerens\n";
  321. settingsScript += "// @homepageURL https://greasyfork.org/en/scripts/11485\n";
  322. settingsScript += "// @include https://www.youtube.com*\n";
  323. settingsScript += "// @include https://youtube.googleapis.com/embed*\n";
  324. settingsScript += "// @include https://www.youtube-nocookie.com/embed*\n";
  325. settingsScript += "// @version 0.0.1\n";
  326. settingsScript += "// @grant none\n";
  327. settingsScript += "// ==/UserScript==\n";
  328. settingsScript += "\n";
  329. settingsScript += "localStorage.setItem('ytfix::addWatchLater', String(" + String(_this["addWatchLater"]) + "));\n";
  330. settingsScript += "localStorage.setItem('ytfix::showControlsFullscreen', String(" + String(_this["showControlsFullscreen"]) + "));\n";
  331. settingsScript += "localStorage.setItem('ytfix::showControlsNonFullscreen', String(" + String(_this["showControlsNonFullscreen"]) + "));\n";
  332. settingsScript += "localStorage.setItem('ytfix::changeColorsFullscreen', String(" + String(_this["changeColorsFullscreen"]) + "));\n";
  333. settingsScript += "localStorage.setItem('ytfix::changeColorsNonFullscreen', String(" + String(_this["changeColorsNonFullscreen"]) + "));\n";
  334. settingsScript += "localStorage.setItem('ytfix::removeAnimations', String(" + String(_this["removeAnimations"]) + "));\n";
  335. settingsScript += "localStorage.setItem('ytfix::optionsReversed', String(" + String(_this["optionsReversed"]) + "));\n";
  336. settingsScript += "localStorage.setItem('ytfix::progressBigger', String(" + String(_this["progressBigger"]) + "));\n";
  337. settingsScript += "localStorage.setItem('ytfix::showTitleOnHover', String(" + String(_this["showTitleOnHover"]) + "));\n";
  338. settingsScript += "localStorage.setItem('ytfix::alwaysVolume', String(" + String(_this["alwaysVolume"]) + "));\n";
  339. var hiddenText = accSection_1.getElementsByTagName("textarea")[0] || document.createElement("textarea");
  340. hiddenText.textContent = settingsScript;
  341. accSection_1.appendChild(hiddenText);
  342. hiddenText.select();
  343. document.execCommand("cut");
  344. accSection_1.removeChild(hiddenText);
  345. exportBtn_1.innerHTML = "Settings Userscipt Copied";
  346. };
  347. if (footer) {
  348. footer.appendChild(exportBtn_1);
  349. }
  350. else {
  351. content.appendChild(exportBtn_1);
  352. }
  353. }
  354. };
  355. YtNewUIFix.prototype.createOption = function (name, description) {
  356. var _this = this;
  357. var accDiv = document.createElement("div");
  358. accDiv.classList.add("account-section-setting");
  359. accDiv.innerHTML = "\n\t\t <label style=\"font-size: 13px\">\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>";
  360. var accInput = accDiv.querySelector("input[name='" + name + "']");
  361. accInput.onclick = function () {
  362. _this.setSetting(name, accInput.checked);
  363. _this[name] = accInput.checked;
  364. };
  365. return accDiv;
  366. };
  367. return YtNewUIFix;
  368. }());
  369. new YtNewUIFix().applyFix();
  370. //# sourceMappingURL=Youtube_UI_Fix.user.js.map