Youtube New UI Fix

Fixes the new UI to one that resembles old one

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

  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.2
  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()
  18. {
  19. if (!moviePlayer)
  20. {
  21. moviePlayer = document.getElementById("movie_player");
  22.  
  23. if (moviePlayer && addWatchLater)
  24. {
  25. var watchLater = document.getElementsByClassName("ytp-watch-later-button")[0];
  26. if (watchLater)
  27. {
  28. var qaulitybutton = document.getElementsByClassName("ytp-subtitles-button")[0] || document.getElementsByClassName("ytp-settings-button")[0];
  29. if (!!qaulitybutton)
  30. qaulitybutton.parentNode.insertBefore(watchLater, qaulitybutton.nextSibling);
  31. }
  32. }
  33. }
  34. else if (!moviePlayer.classList.contains("seeking-mode"))
  35. {
  36. moviePlayer.dispatchEvent(evObj);
  37. }
  38. }, 1000);
  39.  
  40. //the css:
  41. var css = document.createElement('style');
  42. css.type = "text/css";
  43. css.textContent = [
  44. /* fixing the colors */
  45. " .ytp-chrome-bottom { background-color: #1B1B1B!important; }",
  46. " .ytp-svg-fill { fill: #8E8E8E!important; }",
  47. " #movie_player { height: calc(100% + 35px)!important; }",
  48. " .html5-video-content { background-color: black!important; }",
  49. " .ytp-panelpopup { background: rgb(28, 28, 28) none repeat scroll 0% 0%!important; } ",
  50.  
  51. /* moving the content below down */
  52. " #watch7-content, div.watch-stage-mode #watch7-sidebar { transform: translateY(35px)!important; }",
  53.  
  54. /* controls always visible */
  55. " .ytp-chrome-bottom { opacity: 1!important; }",
  56.  
  57. /* move controls to the right place */
  58. " #movie_player { height: calc(100% + 35px)!important; }",
  59. " .ytp-gradient-bottom, .ytp-gradient-top, .ytp-chrome-top { display: none!important; }",
  60. " .ytp-chrome-controls { width: calc(100% + 24px)!important; transform: translateX(-12px)!important; }",
  61.  
  62. /* Fix the theater black bars */
  63. " .watch-stage-mode #theater-background::after { content: ''; height: 35px; bottom: -35px; left: 0px; position: absolute; background-color: black; width: 100%; }",
  64.  
  65. /* scale down the controls */
  66. " .ytp-chrome-bottom { transform: translateY(5px)!important; }",
  67. " .ytp-chrome-bottom::before {content: ''; bottom: 0px; top: -1px; left: -12px; right: -12px; position: absolute; background-color: #1B1B1B; z-index: -1000; }",
  68. " .ytp-chrome-controls { height: 31px!important; line-height: 31px!important; font-size: 11px!important; }",
  69. " .ytp-chrome-controls .ytp-button:not(.ytp-play-button):not(.ytp-watch-later-button) { width: 32px!important; }",
  70. " .ytp-play-button { width: 41px!important; }",
  71. " .ytp-progress-bar-container:not(.ytp-pulling) { height: 5px!important; }",
  72.  
  73. /* scale down the controls big mode */
  74. " .ytp-big-mode .ytp-chrome-bottom { transform: translateY(24px)!important; }",
  75. " .html5-video-container { height: 100%!important; }",
  76. " .html5-main-video { max-height: calc(100% - 35px)!important; }",
  77. " .ytp-big-mode .ytp-progress-bar-container { transform: translateY(-1px)!important; }",
  78.  
  79. /* Fix the quality badge (red HD rectangle) */
  80. " .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",
  81. " {",
  82. " content:''!important;",
  83. " position:absolute!important;",
  84. " top:6px!important;",
  85. " right:4px!important;",
  86. " height:9px!important;",
  87. " width:13px!important;",
  88. " background-color:#f12b24!important;",
  89. " border-radius:1px!important;",
  90. " line-height:normal!important;",
  91. " background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTMgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4NCiAgPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9IjAuNjQ3MSIgZmlsbD0iIzAwMDAwMCIgZD0iTTUsNyBMNiw3IEw2LDggTDUsOCBMNSw3IFogTTEwLDMgTDEwLDQgTDgsNCBMOCwzIEwxMCwzIFogTTMsNiBMMyw1IEw1LDUgTDUsNiBMMyw2IFogTTIsNyBMMyw3IEwzLDggTDIsOCBMMiw3IFogTTcsNyBMMTAsNyBMMTAsOCBMNyw4IEw3LDcgWiBNMTAsNiBMMTEsNiBMMTEsNyBMMTAsNyBMMTAsNiBaIj48L3BhdGg+DQogIDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTUsNyBMNSw2IEw1LDUgTDMsNSBMMyw2IEwzLDcgTDIsNyBMMiwyIEwzLDIgTDMsNCBMNSw0IEw1LDIgTDYsMiBMNiw3IEw1LDcgWiBNMTEsNiBMMTAsNiBMMTAsNyBMNyw3IEw3LDIgTDEwLDIgTDEwLDMgTDExLDMgTDExLDYgWiBNMTAsNCBMMTAsMyBMOCwzIEw4LDQgTDgsNiBMMTAsNiBMMTAsNCBaIj48L3BhdGg+DQo8L3N2Zz4NCg==')!important;",
  92. " padding: 0!important;",
  93. " }",
  94.  
  95. /* Makes sure the captions/subtitles are at the correct height and don't move up and down */
  96. " .ytp-player-content, .ytp-subtitles-player-content { bottom: 49px!important; } ",
  97. /* rules for the watch later button */
  98. " .ytp-watch-later-button { width: 24px!important; float: right!important; }",
  99. " .ytp-tooltip-image-enabled { bottom: 49px!important; top: auto!important; }"
  100. ].join("\n");
  101. document.head.appendChild(css);
  102. })();