YouTube Lite

Makes YouTube fancier

  1. // ==UserScript==
  2. // @name YouTube Lite
  3. // @icon http://s.ytimg.com/yts/img/favicon_144-vflWmzoXw.png
  4. // @namespace x4_ytlite
  5. // @version 0.5.15
  6. // @description Makes YouTube fancier
  7. // @author x4fab
  8. // @match http://www.youtube.com/*
  9. // @match https://www.youtube.com/*
  10. // @grant none
  11. // @run-at document-start
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. if (window.top != window.self){
  16. return;
  17. }
  18.  
  19. if (location.protocol === 'http:'){
  20. location.replace(location.href.replace(/^http:/, 'https:'));
  21. }
  22.  
  23. window.addEventListener('load', function (){
  24. var styleNode = document.createElement('style');
  25. styleNode.innerHTML = ''.slice.call(function(){/*
  26. #appbar-guide-menu{
  27. height:100vh;
  28. opacity:1;
  29. visibility:visible;
  30. left:-230px;
  31. margin-top:0;
  32. transition:opacity .25s cubic-bezier(0.4,0,0.2,1),left .25s cubic-bezier(0.4,0,0.2,1);
  33. transition-delay:.4s;border-right:1px solid #e3e3e3;
  34. }
  35. #appbar-guide-menu:hover, #appbar-guide-menu.e-active {
  36. left: 0;
  37. opacity: 1;
  38. transition-delay: 0s;
  39. }
  40. #appbar-guide-button-container {
  41. visibility: hidden;
  42. }
  43. #masthead-positioner {
  44. position: fixed;
  45. top: -52px;
  46. opacity: 1;
  47. transition: opacity .25s cubic-bezier(0.4,0,0.2,1), top .25s cubic-bezier(0.4,0,0.2,1);
  48. transition-delay: .4s;
  49. box-shadow: none;
  50. }
  51. #masthead-positioner:hover, #masthead-positioner.e-active {
  52. top: 0;
  53. opacity: 1;
  54. transition-delay: 0s;
  55. }
  56. #masthead-positioner-height-offset {
  57. display: none;
  58. }
  59. .yt-card, .guide-flyout {
  60. box-shadow: none;
  61. }
  62. #content {
  63. margin-top: calc(100vh + 10px);
  64. }
  65. #placeholder-player {
  66. display: none;
  67. }
  68. #watch7-main {
  69. position: static;
  70. }
  71. #watch7-content {
  72. z-index: 100;
  73. position: relative;
  74. }
  75. #watch7-sidebar {
  76. z-index: 5;
  77. }
  78. #footer-container {
  79. width: auto;
  80. min-width: 1003px;
  81. max-width: 1066px;
  82. margin: 0 auto;
  83. padding: 0 30px;
  84. z-index: 5;
  85. position: relative;
  86. box-sizing: border-box;
  87. }
  88. @media screen and (min-height: 630px) and (min-width: 1294px){ #footer-container {
  89. max-width: 1280px;
  90. } }
  91. @media screen and (min-height: 980px) and (min-width: 1720px){ #footer-container {
  92. max-width: 1706px;
  93. } }
  94. #footer {
  95. padding-bottom: 0;
  96. }
  97. #footer-logo {
  98. display: none;
  99. }
  100. .yt-uix-expander-collapsed #watch-description-text {
  101. max-height: none;
  102. }
  103. .yt-uix-expander-collapsed .yt-uix-expander-body {
  104. display: block !important;
  105. }
  106. .yt-card.yt-uix-expander .yt-uix-button-expander, .yt-card .yt-uix-expander .yt-uix-button-expander {
  107. display: none !important;
  108. }
  109. #player {
  110. top: 0;
  111. }
  112. #player-api {
  113. position: fixed !important;
  114. top: 0 !important;
  115. left: 0 !important;
  116. right: 0 !important;
  117. height: 100vh !important;
  118. margin: 0 auto;
  119. }
  120. .video-stream.html5-main-video {
  121. position: fixed !important;
  122. top: 0 !important;
  123. left: 0 !important;
  124. right: 0 !important;
  125. height: 100vh !important;
  126. width: 100vw !important;
  127. }
  128. .html5-video-player {
  129. overflow: visible;
  130. }
  131. .html5-video-content {
  132. __z-index: 799;
  133. }
  134. body, .watch-stage-mode #theater-background {
  135. background-color: #000;
  136. }
  137. .html5-video-controls {
  138. opacity: 0;
  139. transition-delay: .4s;
  140. }
  141. .html5-video-controls:hover, .html5-video-controls.e-active {
  142. opacity: 1 !important;
  143. transition-delay: 0s;
  144. }
  145. .ytp-player-content.ytp-iv-player-content {
  146. width: 0;
  147. right: 0;
  148. left: auto;
  149. position: fixed;
  150. bottom: 0 !important;
  151. }
  152. .videowall-endscreen.html5-endscreen {
  153. width: 100vw;
  154. position: fixed;
  155. height: 100vh;
  156. top: 0;
  157. left: 0;
  158. }
  159. .us_box {
  160. position: fixed;
  161. border-radius: 0;
  162. border: 1px solid #e3e3e3;
  163. padding: 15px;
  164. }
  165. .us_box h3, .us_submitbuttons {
  166. background-color: #fff;
  167. color: #333;
  168. border: none;
  169. padding-left: 0;
  170. padding-right: 0;
  171. }
  172.  
  173. #us_infobox {
  174. position: fixed;
  175. border-radius: 0;
  176. border: 1px solid #e3e3e3;
  177. padding: 15px;
  178. background: white;
  179. }
  180. .us_error {
  181. color: red;
  182. border: none;
  183. background: none;
  184. color: #333 !important;
  185. font-size: 12px;
  186. }
  187. .watch-stage-mode #player .player-api {
  188. margin: 0 auto !important;
  189. }
  190. .watch-wide #watch7-sidebar, .watch-wide #watch7-preview {
  191. z-index: 5;
  192. }
  193. #player-playlist {
  194. margin-top: calc(100vh + 12px);
  195. }
  196. #watch-appbar-playlist {
  197. z-index: 6 !important;
  198. top: 0 !important;
  199. transform: none !important;
  200. transition: none !important;
  201. }
  202. #content {
  203. top: 0 !important;
  204. }
  205.  
  206. #player-unavailable {
  207. position: fixed;
  208. top: 0;
  209. height: 100vh;
  210. left: 0;
  211. width: 100vw;
  212. z-index: 0;
  213. margin: 0;
  214. }
  215. .player-api {
  216. background: transparent;
  217. }
  218. */}, 14, -3);
  219. function onMouseMove(e){
  220. var m = null;
  221. if (e.clientY < 5){
  222. m = document.querySelector('#masthead-positioner');
  223. } else if (e.clientX < 5){
  224. m = document.querySelector('#appbar-guide-menu');
  225. } else if (e.target.tagName == 'DIV' && e.clientY > document.body.clientHeight - 5){
  226. m = document.querySelector('.html5-video-controls');
  227. }
  228. if (m && (m = m.classList)){
  229. m.add('e-active');
  230. clearTimeout(m.e_t);
  231. m.e_t = setTimeout(m.remove.bind(m,'e-active'), 1e3);
  232. }
  233. }
  234.  
  235. function onResize(){
  236. var v = document.querySelector('.video-stream.html5-main-video'),
  237. c = document.querySelector('.html5-video-content');
  238. if (v && c){
  239. var h = v.offsetHeight / c.offsetHeight,
  240. k = Math.min(h, v.offsetWidth / c.offsetWidth);
  241. c.style.transform = 'translate(0,' + Math.round(c.offsetHeight * Math.max(h - 1, 0) * .5) +
  242. 'px) scale(' + k + ',' + k + ')';
  243. }
  244. }
  245. document.onmousemove = document.onmouseout = onMouseMove;
  246. window.onresize = onResize;
  247.  
  248. setTimeout(function (){
  249. document.querySelector('#appbar-guide-button').click();
  250. var wide = document.querySelector('.ytp-size-button.ytp-button[title="Theater mode"]');
  251. if (wide) wide.click();
  252. }, 50);
  253.  
  254. var previousLocation = null;
  255. setInterval(function (){
  256. if (document.body.scrollTop == 52){
  257. document.body.scrollTop = 0;
  258. }
  259.  
  260. if (previousLocation != location.href){
  261. if (location.href.indexOf('/watch?') != -1){
  262. if (!styleNode.parentNode){
  263. document.body.appendChild(styleNode);
  264. }
  265. } else if (styleNode.parentNode){
  266. document.body.removeChild(styleNode);
  267. }
  268.  
  269. onResize();
  270. previousLocation = location.href;
  271. }
  272. }, 50);
  273. }, false);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址