Youtube UI Fix Settings\n";

Sets the settings for Youtube UI Fix\n";

目前為 2022-11-01 提交的版本,檢視 最新版本

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