Youtube New UI Fix

Fixes the new UI to one that resembles old one

当前为 2015-08-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube New UI Fix
  3. // @namespace YtNewUIFix
  4. // @description Fixes the new UI to one that resembles old one
  5. // @author Roy Scheerens
  6. // @include https://www.youtube.com/*
  7. // @version 1.4
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. var addWatchLater = true;
  13. //mouse over the controls to update them (this seems to also work with 2000ms instead of 1000ms)
  14. var evObj = document.createEvent('Events');
  15. evObj.initEvent("mousemove", true, false);
  16. var moviePlayer = document.getElementById("movie_player");
  17. setInterval(function() { moviePlayer = moviePlayer || document.getElementById("movie_player"); moviePlayer.dispatchEvent(evObj); }, 1000);
  18. if (addWatchLater)
  19. {
  20. var watchLater = document.getElementsByClassName("ytp-watch-later-button")[0];
  21. var qaulitybutton = document.getElementsByClassName("ytp-subtitles-button")[0] || document.getElementsByClassName("ytp-settings-button")[0];
  22. qaulitybutton.parentNode.insertBefore(watchLater, qaulitybutton.nextSibling);
  23. }
  24. //the css:
  25. var css = document.createElement('style');
  26. css.type = "text/css";
  27. css.textContent = [
  28. /* fixing the colors */
  29. " .ytp-chrome-bottom { background-color: #1B1B1B!important; }",
  30. " .ytp-svg-fill { fill: #8E8E8E!important; }",
  31. " #movie_player { height: calc(100% + 35px)!important; }",
  32. " .html5-video-content { background-color: black!important; }",
  33. " .ytp-panelpopup { background: rgb(28, 28, 28) none repeat scroll 0% 0%!important; } ",
  34.  
  35. /* moving the content below down */
  36. " #watch7-content, div.watch-stage-mode #watch7-sidebar { transform: translateY(35px)!important; }",
  37.  
  38. /* controls always visible */
  39. " .ytp-chrome-bottom { opacity: 1!important; }",
  40.  
  41. /* move controls to the right place */
  42. " #movie_player { height: calc(100% + 35px)!important; }",
  43. " .ytp-gradient-bottom, .ytp-gradient-top, .ytp-chrome-top { display: none!important; }",
  44. " .ytp-chrome-controls { width: calc(100% + 24px)!important; transform: translateX(-12px)!important; }",
  45.  
  46. /* Fix the theater black bars */
  47. " .watch-stage-mode #theater-background::after { content: ''; height: 35px; bottom: -35px; left: 0px; position: absolute; background-color: black; width: 100%; }",
  48.  
  49. /* scale down the controls */
  50. " .ytp-chrome-bottom { transform: translateY(5px)!important; }",
  51. " .ytp-chrome-bottom::before {content: ''; bottom: 0px; top: -1px; left: -12px; right: -12px; position: absolute; background-color: #1B1B1B; z-index: -1000; }",
  52. " .ytp-chrome-controls { height: 31px!important; line-height: 31px!important; font-size: 11px!important; }",
  53. " .ytp-chrome-controls .ytp-button:not(.ytp-play-button):not(.ytp-watch-later-button) { width: 32px!important; }",
  54. " .ytp-play-button { width: 41px!important; }",
  55. " .ytp-progress-bar-container { height: 5px!important; }",
  56.  
  57. /* scale down the controls big mode */
  58. " .ytp-big-mode .ytp-chrome-bottom { transform: translateY(24px)!important; }",
  59. " .html5-video-container { height: 100%!important; }",
  60. " .html5-main-video { max-height: calc(100% - 35px)!important; }",
  61. " .ytp-big-mode .ytp-progress-bar-container { transform: translateY(-1px)!important; }",
  62.  
  63. /* Fix the quality badge (red HD rectangle) */
  64. " .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",
  65. " {",
  66. " content:''!important;",
  67. " position:absolute!important;",
  68. " top:6px!important;",
  69. " right:4px!important;",
  70. " height:9px!important;",
  71. " width:13px!important;",
  72. " background-color:#f12b24!important;",
  73. " border-radius:1px!important;",
  74. " line-height:normal!important;",
  75. " background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTMgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4NCiAgPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9IjAuNjQ3MSIgZmlsbD0iIzAwMDAwMCIgZD0iTTUsNyBMNiw3IEw2LDggTDUsOCBMNSw3IFogTTEwLDMgTDEwLDQgTDgsNCBMOCwzIEwxMCwzIFogTTMsNiBMMyw1IEw1LDUgTDUsNiBMMyw2IFogTTIsNyBMMyw3IEwzLDggTDIsOCBMMiw3IFogTTcsNyBMMTAsNyBMMTAsOCBMNyw4IEw3LDcgWiBNMTAsNiBMMTEsNiBMMTEsNyBMMTAsNyBMMTAsNiBaIj48L3BhdGg+DQogIDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTUsNyBMNSw2IEw1LDUgTDMsNSBMMyw2IEwzLDcgTDIsNyBMMiwyIEwzLDIgTDMsNCBMNSw0IEw1LDIgTDYsMiBMNiw3IEw1LDcgWiBNMTEsNiBMMTAsNiBMMTAsNyBMNyw3IEw3LDIgTDEwLDIgTDEwLDMgTDExLDMgTDExLDYgWiBNMTAsNCBMMTAsMyBMOCwzIEw4LDQgTDgsNiBMMTAsNiBMMTAsNCBaIj48L3BhdGg+DQo8L3N2Zz4NCg==')!important;",
  76. " padding: 0!important;",
  77. " }",
  78.  
  79. /* Makes sure the captions/subtitles are at the correct height and don't move up and down */
  80. " .ytp-player-content, .ytp-subtitles-player-content { bottom: 49px!important; } ",
  81. /* rules for the watch later button */
  82. " .ytp-watch-later-button { width: 24px!important; float: right!important; }",
  83. " .ytp-tooltip-image-enabled { bottom: 49px!important; top: auto!important; }"
  84. ].join("\n");
  85. document.head.appendChild(css);
  86. })();