YouTube Live Borderless

Make YouTube Live Borderless

当前为 2025-05-19 提交的版本,查看 最新版本

  1. /* ==UserStyle==
  2. @name YouTube Live Borderless
  3. @version 0.5.35
  4. @namespace github.com/cyfung1031
  5. @license MIT
  6. @description Make YouTube Live Borderless
  7. @author CY Fung
  8. @supportURL https://github.com/cyfung1031/YouTube-Live-Borderless/
  9. @compatible edge Edge [Blink] >= 105; Stylus (Beta)
  10. @compatible chrome Chrome >= 105; Stylus (Beta); Chrome 101-104 requires "enable-experimental-web-platform-features"
  11. @compatible firefox FireFox >= 103; Stylus; layout.css.has-selector.enabled = true; note: some features might not be very stable!!
  12. @compatible opera Opera >= 91; Stylus (Beta)
  13. @compatible safari Safari >= 15.4; Stylus
  14. @preprocessor stylus
  15. @var checkbox youtube-wpr "YouTube WPR" 0
  16. @var select mode-for-two-col "Mode ##TwoColumns" {
  17. "Expanded Panel Only #Recommended": "expanded-panel",
  18. "Expanded Live Chat Only": "expanded-live",
  19. "Expandable Live Chat Only": "expandable-live",
  20. "Always": "always"
  21. }
  22. @var select mode-for-single-col "Mode ##SingleColumn" {
  23. "YT Mobile #Recommended": "mobile",
  24. "Normal": "normal",
  25. "Disabled": "disabled"
  26. }
  27. @var checkbox no-masthead "Top.MastheadBar ::Hide" 0
  28. @var range masthead-hoverable-height "Top.MastheadBar ::Hoverable" [12, 0, 36, 2, 'px']
  29. @var range masthead-hoverable-delay-in "Top.MastheadBar ::Hoverable.DelayIn" [300, 0, 800, 100, 'ms']
  30. @var checkbox disable-cinematics "CinematicsEffect ::Disable" 0
  31. @var range video-enlarging "Video.Enlarging >>>Video.Border.Fine.Tune" [0, 0, 8, 2]
  32. @var range video-padding-left-right "Video.Padding.LeftRight (Experimental)" [0, 0, 18, 2, 'px']
  33. @var range video-padding-top-bottom "Video.Padding.TopBottom (Experimental)" [0, 0, 18, 2, 'px']
  34. @var range primary-content-margin "PrimaryContent ::Margin" [24, 6, 48, 6, "px"]
  35. @var range video-title-size "VideoTitle ::Size" [2.0, 1.0, 3.0, 0.2, "rem"]
  36. @var checkbox no-bottom-row "Bottom.PrimaryMetaInfoRow ::Hide" 0
  37. @var range min-below-area "BelowArea ::Minimum" [120, 0, 240, 10, 'px']
  38. @var range min-below-area-for-theater "WideTheater.BelowArea ::Minimum" [120, 0, 240, 10, 'px']
  39. @var number side-panel-width "SidePanel ::Width" [440, 320, 640, 20, "px"]
  40. @var checkbox no-round-border "RoundBorder ::Disable" 1
  41. @var number chat-zoom-for-right-col "RightCol.Chat ::Zoom" [1.0, 0.4, 1.2, 0.05]
  42. @var range chat-btn-height "RightCol.Chat ::SpaceAbove@Zoom" [36, 0, 60, 4, 'px']
  43. @var number chat-zoom-for-mobile "YTMobile.Chat ::Zoom" [1.0, 0.4, 1.2, 0.05]
  44. @var range chat-min-height "YTMobile.Chat ::Min.Height" [400, 20, 900, 10, 'px']
  45. @var checkbox unlimit-player-max-width "Unlimit Player Max Width" 1
  46. @var checkbox fix-player-height-overflow-a "Fix Player Height Overflow" 0
  47. @var checkbox video-no-round-angle "Video No Round Angle" 0
  48. @var checkbox compatible-ytlstm "Compatible with ytlstm-theater-mode" 0
  49. @var checkbox fix-for-ytlc "Fix for YouTubeLiveClock" 0
  50. @var checkbox show-comments-region "Show Comments (without Tabview Youtube)" 0
  51. ==/UserStyle== */
  52. /*
  53.  
  54. @var range chrome-bottom-bar-margin "Chrome Bottom Bar Margin" [12, 6, 48, 6, "px"]
  55.  
  56. Chrome Bottom Bar Margin is 12px only due to
  57.  
  58. MU = function(a) {
  59. var b = a.u.ag()
  60. , c = a.G.getVideoData().D
  61. , d = 0;
  62. a.u.ag() && a.u.Me() && (d = (a.G.fb().getPlayerSize().width - a.G.getVideoContentRect().width) / 2);
  63. return 12 * (c ? 0 : b ? 2 : 1) + d
  64. }
  65.  
  66. */
  67. // d
  68. @-moz-document url-prefix("https://www.youtube.com/watch?v="),
  69. url-prefix("https://www.youtube.com/live/") {
  70.  
  71. dummy() {
  72. // dummy
  73. border: 0;
  74. }
  75.  
  76. buildL4(type, args...) {
  77. st1 = join('', ':', type, '(', join('\, ', args), ')')
  78. selector(st1)
  79. }
  80.  
  81. /*
  82. if min-below-area <= 10px {
  83. min-below-area = 0px
  84. }
  85. if min-below-area-for-theater <= 10px {
  86. min-below-area-for-theater = 0px
  87. }
  88. */
  89. chat-btn-height = chat-btn-height + 1px
  90. if chat-btn-height == 0px + 1px {
  91. chat-btn-height = 0px
  92. }
  93.  
  94. // masthead-hoverable-height = (masthead-hoverable-h - 1) * 2px
  95.  
  96. no-masthead-w = no-masthead //
  97. chrome-bottom-bar-margin = 12px // this cannot be changed
  98.  
  99. single-col-mobile = (mode-for-single-col == "mobile" ? 1 : 0) //
  100. if single-col-mobile == 1 and no-masthead-w == 0 {
  101. no-masthead-w = 2 //
  102. }
  103.  
  104. chat-zoom-for-mobile-enable = ((chat-zoom-for-mobile < 1) or (chat-zoom-for-mobile > 1))
  105.  
  106. contentBase() {
  107. html {
  108. --ylb-min-below-area: min-below-area;
  109. }
  110. #microformat.ytd-watch-flexy {
  111. position: fixed;
  112. top:-200vh;
  113. left:-200vw;
  114. }
  115.  
  116. if fix-player-height-overflow-a { // 縦配信
  117. html:not([tabview-loaded]) {
  118. --yt-fix-player-contain: layout;
  119. }
  120. .efyt-mini-player {
  121. --yt-fix-player-contain: initial;
  122. }
  123. #player > #player-container-outer.style-scope.ytd-watch-flexy {
  124. contain: var(--yt-fix-player-contain);
  125. }
  126. }
  127.  
  128. if fix-for-ytlc {
  129.  
  130. @supports (color: var(--compatibile-with-chrome-plugin-youtube-live-clock-20221107)) {
  131.  
  132. /* 2022/11/07 - specific fix for YouTubeLiveClock - chrome only */
  133. html:has(style#ytlctn-style-for-native-control) #columns.ytd-watch-flexy #player::after {
  134. content: "";
  135. background-color: transparent;
  136. border-color: transparent;
  137. color: transparent;
  138. box-sizing: border-box;
  139. border-style: dotted;
  140. display: flex;
  141. height: 0px;
  142. margin: 0;
  143. border: 0;
  144. margin-top: 51px;
  145. width: calc(100% - 4px);
  146. position: relative;
  147. pointer-events: none;
  148. }
  149.  
  150. html:has(style#ytlctn-style-for-native-control) #columns.ytd-watch-flexy #below {
  151. transform: initial;
  152. }
  153.  
  154. html:has(style#ytlctn-style-for-native-control) ytd-watch-flexy[flexy][is-two-columns_][theater] #columns.ytd-watch-flexy {
  155. margin-top: 51px;
  156. }
  157. html:has(style#ytlctn-style-for-native-control) #columns {
  158. overflow: revert;
  159. }
  160. }
  161.  
  162. @supports (color: var(--compatibile-with-chrome-plugin-youtube-live-clock-20240123)) {
  163.  
  164. /* 2024/01/23 - specific fix for YouTubeLiveClock - chrome only */
  165. html:has(style#ytlc-style-for-native-control) #columns.ytd-watch-flexy #player::after {
  166. content: "";
  167. background-color: transparent;
  168. border-color: transparent;
  169. color: transparent;
  170. box-sizing: border-box;
  171. border-style: dotted;
  172. display: flex;
  173. height: 0px;
  174. margin: 0;
  175. border: 0;
  176. margin-top: 51px;
  177. width: calc(100% - 4px);
  178. position: relative;
  179. pointer-events: none;
  180. }
  181.  
  182. html:has(style#ytlc-style-for-native-control) #columns.ytd-watch-flexy #below {
  183. transform: initial;
  184. }
  185.  
  186. html:has(style#ytlc-style-for-native-control) ytd-watch-flexy[flexy][is-two-columns_][theater] #columns.ytd-watch-flexy {
  187. margin-top: 51px;
  188. }
  189. html:has(style#ytlc-style-for-native-control) #columns {
  190. overflow: revert;
  191. }
  192. }
  193.  
  194.  
  195.  
  196. }
  197.  
  198. ytd-watch-flexy[flexy] #player-container-outer.ytd-watch-flexy,
  199. ytd-watch-flexy[flexy] #player-container-inner.ytd-watch-flexy {
  200. pointer-events: none;
  201. }
  202.  
  203. ytd-watch-flexy[flexy] #player-container.ytd-watch-flexy,
  204. ytd-watch-flexy[flexy] #ytd-player.ytd-watch-flexy {
  205. pointer-events: initial;
  206. }
  207.  
  208. // general fix
  209. ytd-watch-flexy[theater] .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} {
  210. min-height: unset;
  211. }
  212. #movie_player .ytp-cued-thumbnail-overlay-image {
  213. /* background-size: contain !important; */
  214. background-size: auto 100% !important;
  215. }
  216. ytd-watch-flexy:not([is-two-columns_]) ytd-watch-metadata {
  217. padding-top: var(--ytd-margin-3x);
  218. }
  219. ytd-watch-flexy:not([is-two-columns_]):not([fullscreen]) #primary.ytd-watch-flexy {
  220. padding-top: 0;
  221. margin-top: 0;
  222. }
  223.  
  224. m = youtube-wpr ? ':not([tabview-loaded])[youtube-wpr*="h2"]' : ':not([tabview-loaded]):has(ytd-live-chat-frame#chat:not([collapsed])):has(iframe#chatframe)'
  225.  
  226. selector-comments-1 = show-comments-region ? '#primary-inner.ytd-watch-flexy ytd-commentsx#commentsx.ytd-watch-flexy' : '#primary-inner.ytd-watch-flexy ytd-comments#comments.ytd-watch-flexy'
  227.  
  228. html{selector(m)} {buildL4('is',
  229. selector-comments-1,
  230. '#secondary-inner.ytd-watch-flexy > #related.ytd-watch-flexy')} {
  231. display: none !important;
  232. }
  233.  
  234.  
  235. html:not([tabview-loaded]) #cinematics {
  236. // contain: layout;
  237. contain: layout size style;
  238. user-select: none;
  239. touch-action: none;
  240. pointer-events: none;
  241. }
  242.  
  243. if video-no-round-angle {
  244. ytd-watch-flexy[rounded-player-large][default-layout] #ytd-player.ytd-watch-flexy.ytd-watch-flexy,
  245. ytd-watch-flexy[rounded-player][default-layout] #ytd-player.ytd-watch-flexy.ytd-watch-flexy {
  246. border-radius: 0;
  247. }
  248. }
  249.  
  250. }
  251.  
  252. //
  253. contentNoMasthead() {
  254.  
  255. // root = html
  256. & {
  257. /* 0px not 0 */
  258. --ytd-masthead-height: 0px;
  259. --ytd-toolbar-height: 0px;
  260. --ytd-watch-flexy-masthead-height: 0px;
  261. }
  262. ytd-app[style] { /* YouTube set the masthead-height in style */
  263. --ytd-masthead-height: 0px !important;
  264. --ytd-toolbar-height: 0px !important;
  265. --ytd-watch-flexy-masthead-height: 0px !important;
  266. }
  267. & .style-scope{buildL4('is', '#page-manager', 'ytd-watch-flexy', 'ytd-page-manager')} {
  268. --ytd-masthead-height: 0px;
  269. --ytd-toolbar-height: 0px;
  270. --ytd-watch-flexy-masthead-height: 0px;
  271. }
  272.  
  273. #masthead-container {
  274. height: 0;
  275. --masthead-opacity: 0;
  276. opacity: var(--masthead-opacity) !important;
  277. transition: opacity 300ms;
  278. min-height: masthead-hoverable-height;
  279. contain: layout size style;
  280. }
  281.  
  282. #masthead-container > ytd-masthead {
  283. transform: translateY(-100%);
  284. transition: transform 300ms;
  285. }
  286.  
  287.  
  288. if masthead-hoverable-height > 0 {
  289.  
  290. ytd-app {
  291. --ut-masthead-background: rgba(15,15,15,0.8);
  292. }
  293. ytd-app[darker-dark-theme] {
  294. --ut-masthead-background: rgba(240,240,240,0.8);
  295. }
  296. ytd-masthead#masthead:hover {
  297. background-color: color(--ut-masthead-background);
  298. z-index: 9999 !important;
  299. }
  300.  
  301. ytd-masthead#masthead {
  302. background-color: rgba(15,15,15,0.8);
  303. z-index: 9999 !important;
  304. }
  305.  
  306. #masthead-container:hover {
  307. --masthead-opacity: 1;
  308. }
  309.  
  310. #masthead-container:hover > ytd-masthead {
  311. transform: translateY(0%);
  312. transition-delay: masthead-hoverable-delay-in;
  313. }
  314.  
  315. #masthead-container::after {
  316. content: '';
  317. display: flex;
  318. width: 100%;
  319. height: masthead-hoverable-height;
  320. top: 0;
  321. z-index: 77;
  322. cursor: default;
  323. user-select: none !important;
  324. touch-action: none !important;
  325. box-sizing: border-box;
  326. padding: 0;
  327. margin: 0;
  328. }
  329. }
  330.  
  331. ytd-watch-flexy.style-scope[is-two-columns_]:not([fullscreen]):not([theater]) {
  332.  
  333. #columns.style-scope.ytd-watch-flexy,
  334. #primary.style-scope.ytd-watch-flexy,
  335. #primary-inner.style-scope.ytd-watch-flexy,
  336. #secondary.style-scope.ytd-watch-flexy,
  337. #secondary-inner.style-scope.ytd-watch-flexy {
  338. height: 100vh;
  339. max-height: 100%;
  340. }
  341. }
  342.  
  343. ytd-watch-flexy.style-scope[is-two-columns_][theater]:not([fullscreen]) {
  344.  
  345. height: 100vh;
  346. .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} {
  347. flex: 77;
  348. max-height: unset;
  349. }
  350.  
  351.  
  352. }
  353.  
  354.  
  355.  
  356. &:not([tabview-loaded]) ytd-watch-flexy.style-scope[is-two-columns_][theater]:not([fullscreen]) {
  357.  
  358. .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} ~ #columns.style-scope.ytd-watch-flexy {
  359. overflow: visible;
  360. }
  361. }
  362.  
  363.  
  364. } //
  365. contentSingleColMobile() {
  366.  
  367. // html:has(ytd-watch-flexy:not([is-two-columns_]):not([fullscreen]))
  368.  
  369. if no-masthead-w>=1 {
  370.  
  371.  
  372. if youtube-wpr {
  373.  
  374.  
  375. &[youtube-wpr*="h2"] ytd-watch-flexy:not([theater]):not([fullscreen]):not([no-top-margin]):not([reduced-top-margin]) .ytd-watch-flexy{buildL4('is', '#primary', '#secondary')} {
  376. padding-top: 0px;
  377. }
  378. &[youtube-wpr*="h2"] ytd-watch-flexy[tyt-tab^="#tab-"]:not([is-two-columns_]) #primary-inner.ytd-watch-flexy {
  379. padding-bottom: 0px;
  380. }
  381.  
  382.  
  383. } else {
  384.  
  385.  
  386. &:has(#chat:not([collapsed])) ytd-watch-flexy:not([theater]):not([fullscreen]):not([no-top-margin]):not([reduced-top-margin]) .ytd-watch-flexy{buildL4('is', '#primary', '#secondary')} {
  387. padding-top: 0px;
  388. }
  389. &:has(#chat:not([collapsed])) ytd-watch-flexy[tyt-tab^="#tab-"]:not([is-two-columns_]) #primary-inner.ytd-watch-flexy {
  390. padding-bottom: 0px;
  391. }
  392.  
  393. }
  394.  
  395. }
  396.  
  397. #chat:not([collapsed]) {
  398. --ytd-margin-2x: 0;
  399. --ytd-margin-3x: 0;
  400. --ytd-margin-4x: 0;
  401. --ytd-margin-6x: 0;
  402. --ytd-margin-8x: 0;
  403.  
  404. height: 100% !important;
  405. min-height: unset !important;
  406. max-height: 100vh !important;
  407.  
  408. // position:relative;
  409. // top:auto;
  410. // bottom:0;
  411.  
  412. iframe#chatframe{
  413.  
  414. min-height: 0px;
  415.  
  416. }
  417.  
  418.  
  419.  
  420. if chat-zoom-for-mobile-enable {
  421.  
  422.  
  423. iframe-transform = 'scale(%s)' % chat-zoom-for-mobile
  424. iframe-ratio = 100% / chat-zoom-for-mobile
  425.  
  426. iframe#chatframe {
  427. position:absolute;
  428.  
  429. transform: iframe-transform;
  430. height: s('calc((100% - %s) / %s) !important', chat-btn-height, chat-zoom-for-mobile);
  431. max-height: unset !important;
  432. min-height: unset !important;
  433. transform-origin: 0 0;
  434. width: iframe-ratio !important;
  435. margin-top: chat-btn-height;
  436.  
  437.  
  438. }
  439.  
  440.  
  441. }
  442.  
  443.  
  444. }
  445.  
  446.  
  447. m = youtube-wpr ? '[youtube-wpr*="h2"]': ":has(#chat:not([collapsed]))"
  448. selector-comments-2 = show-comments-region ? '#primary-inner.ytd-watch-flexy ytd-commentsx#commentsx.ytd-watch-flexy' : '#primary-inner.ytd-watch-flexy ytd-comments#comments.ytd-watch-flexy'
  449.  
  450. &{selector(m)} {
  451. // html:has(ytd-watch-flexy:not([is-two-columns_]):not([fullscreen])):has(#chat:not([collapsed]))
  452.  
  453. --ylb-min-below-area: chat-min-height;
  454.  
  455. #contentContainer.tp-yt-app-drawer[swipe-open].tp-yt-app-drawer::after {
  456.  
  457. content: unset;
  458.  
  459. }
  460.  
  461. {selector-comments-2},
  462. #below.ytd-watch-flexy > .ytd-watch-flexy{buildL4('is', '#related', 'ytd-watch-metadata')} {
  463. /* display:none !important; */
  464. position: fixed !important;
  465. transform: scale(0.01) !important;
  466. transform-origin: 0 0 !important;
  467. left: -100vw !important;
  468. top: -100vh !important;
  469. visibility: collaspe !important;
  470. pointer-events: none !important;
  471. user-select: none !important;
  472. touch-action: none !important;
  473. }
  474.  
  475. #secondary.ytd-watch-flexy {
  476. display:none !important;
  477. }
  478.  
  479.  
  480. .efyt-control-bar {
  481. position: relative;
  482. display: inline-flex;
  483. top: auto;
  484. left: auto;
  485. z-index: 99999;
  486. opacity: 0.8;
  487. transform: translate(calc(-100% + 32px), 0) !important;
  488. }
  489.  
  490. .efyt-control-bar:hover {
  491. opacity: 1.0;
  492. background: var(--yt-spec-general-background-a);
  493. transform: translate(0px, 0) !important;
  494. }
  495.  
  496. #player {
  497. margin-bottom: 0;
  498. }
  499.  
  500. {buildL4('is', '#columns', '#primary')} {
  501. padding: 0;
  502. }
  503.  
  504. {buildL4('is', '#player', '#player-theater-container', '#player-container-outer', '#player-container-inner', '#player-container', '#movie_player', '#movie_player video')} {
  505. object-fit: contain;
  506. max-height: calc(100vh - var(--ytd-toolbar-height) - var(--ylb-min-below-area, 0px)) !important;
  507.  
  508. }
  509.  
  510. #primary-inner.ytd-watch-flexy > :not(.style-scope) {
  511. display: none !important;
  512. }
  513.  
  514. #below {
  515. display: flex;
  516. flex-direction: column;
  517. flex: 1;
  518. }
  519. #below > *:not([id|="chat"]) {
  520. position: fixed !important;
  521. transform: scale(0.01) !important;
  522. transform-origin: 0 0 !important;
  523. left: -100vw !important;
  524. top: -100vh !important;
  525. visibility: collaspe !important;
  526. pointer-events: none !important;
  527. user-select: none !important;
  528. touch-action: none !important;
  529. }
  530. #below ~ [id|="chat"],
  531. #primary-inner.ytd-watch-flexy ~ [id|="chat"],
  532. #primary.ytd-watch-flexy ~ [id|="chat"] {
  533. flex: 1;
  534. }
  535.  
  536. #below:not(:has(#chat)) {
  537. display: none;
  538. }
  539.  
  540. {buildL4('is', 'ytd-watch-flexy', '#columns.ytd-watch-flexy', '#primary.ytd-watch-flexy', '#primary-inner.ytd-watch-flexy')} {
  541. display: flex;
  542. flex-direction: column;
  543. margin: 0;
  544. flex: 1;
  545. }
  546.  
  547. ytd-watch-flexy {
  548. height: 100vh !important;
  549. max-height: 100vh !important;
  550. }
  551.  
  552. ytd-watch-flexy{buildL4('is', '[theater]', '[fullscreen]')} .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} {
  553.  
  554. min-height: unset !important;
  555. }
  556. }
  557. }
  558. content2cHTML() {
  559. // html
  560. body.lock-scrollbar {
  561. overflow-y: auto;
  562. }
  563. }
  564.  
  565. content2cMAIN() {
  566. // body or html
  567.  
  568. if chat-zoom-for-right-col > 1 or chat-zoom-for-right-col < 1 {
  569.  
  570. ytd-watch-flexy[is-two-columns_]:not([fullscreen]) iframe#chatframe {
  571.  
  572. position:absolute;
  573. margin-top:chat-btn-height;
  574.  
  575. transform: 'scale(%s)' % chat-zoom-for-right-col;
  576. transform-origin: 0 0;
  577. width: '%s !important' % (100% / chat-zoom-for-right-col);
  578. max-width: unset !important;
  579. height: s('calc( (100% - %s) / %s ) !important', chat-btn-height, chat-zoom-for-right-col);
  580. z-index: 1; /* for normal youtube */
  581.  
  582. }
  583.  
  584. }
  585.  
  586.  
  587. if no-masthead-w==0 {
  588.  
  589. ytd-watch-flexy.style-scope[is-two-columns_]:not([theater]):not([fullscreen]) {
  590.  
  591. .style-scope.ytd-watch-flexy{buildL4('is', '#secondary', '#secondary-inner')} {
  592. height: calc(100vh - var(--ytd-toolbar-height));
  593. max-height: 100%;
  594. }
  595. }
  596. }
  597.  
  598.  
  599. ytd-watch-flexy[is-two-columns_]:not([fullscreen]) #movie_player {
  600.  
  601. .ytp-chrome-bottom[style*="width"] {
  602. width: unset !important;
  603. left: chrome-bottom-bar-margin !important;
  604. right: chrome-bottom-bar-margin !important;
  605. }
  606.  
  607. }
  608.  
  609.  
  610. ytd-watch-flexy.style-scope[is-two-columns_]:not([theater]):not([fullscreen]) ytd-live-chat-frame#chat:not([collapsed]) {
  611. min-height: unset;
  612. }
  613.  
  614.  
  615.  
  616. ytd-watch-flexy.style-scope[is-two-columns_]:not([fullscreen]) #primary-inner.ytd-watch-flexy > *:not(#player) {
  617. padding: 0 primary-content-margin 0;
  618. }
  619.  
  620.  
  621. ytd-watch-flexy.style-scope[is-two-columns_]:not([theater]):not([fullscreen]) #player .ytd-watch-flexy{buildL4('is', '#player-container-outer', '#player-container-inner', '#player-container')}{
  622.  
  623. // layout outside
  624. // no effect
  625. // layout inside
  626. max-height: calc(100vh - var(--ytd-toolbar-height, 0px) - var(--ylb-min-below-area, 0px)); // for very wide screen
  627. }
  628.  
  629. ytd-watch-flexy.style-scope[is-two-columns_][theater]:not([fullscreen]) .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} {
  630. max-height: calc(100vh - var(--ytd-toolbar-height, 0px) - var(--ylb-min-below-area, 0px)); // for 4:3 video
  631.  
  632. }
  633.  
  634. ytd-watch-flexy.style-scope[is-two-columns_] #columns.ytd-watch-flexy > #secondary.ytd-watch-flexy {
  635. width: side-panel-width;
  636. }
  637. }
  638. contentfHTML(){
  639. // html
  640.  
  641. body ytd-watch-flexy[flexy] #player-container-outer.ytd-watch-flexy {
  642. max-width: unset; // override var(--ytd-watch-flexy-max-player-width);
  643. }
  644.  
  645. &:not([tabview-loaded]) {
  646.  
  647. body ytd-watch-flexy[flexy][is-two-columns_]{buildL4('is', '[is-extra-wide-video_]', '[is-four-three-to-sixteen-nine-video_]')} #primary.ytd-watch-flexy {
  648.  
  649. max-width: unset; // override var(--ytd-watch-flexy-max-player-width);
  650.  
  651. }
  652. }
  653. chat-selector = youtube-wpr ? '[youtube-wpr*="h2"]': ":has(#chat:not([collapsed]))"
  654.  
  655. &{selector(chat-selector)} {
  656. ytd-watch-flexy.style-scope:not([fullscreen]) {
  657. .style-scope{buildL4('is', '#chat', '#chat-container')}{
  658. flex: 77;
  659. }
  660. }
  661. }
  662. }
  663.  
  664. contentfMAIN() {
  665. // body or html
  666.  
  667. if (video-padding-left-right + video-padding-top-bottom) > 0 {
  668.  
  669. #player-container-outer.ytd-watch-flexy {
  670. padding-left: video-padding-left-right;
  671. padding-right: video-padding-left-right;
  672. padding-top: video-padding-top-bottom;
  673. padding-bottom: video-padding-top-bottom;
  674. }
  675.  
  676. }
  677.  
  678.  
  679. &:not([tabview-loaded]) {
  680.  
  681. ytd-watch-flexy:not([fullscreen]) .ytd-watch-flexy{buildL4('is', '#player-theater-container', '#player-wide-container')} {
  682. max-height: calc(100vh - var(--ytd-toolbar-height) - var(--ylb-min-below-area, 0px)) !important;
  683. }
  684.  
  685.  
  686. ytd-watch-flexy[is-two-columns_]:not([theater]):not([fullscreen]) {buildL4('is', '#columns', '#primary', '#primary-inner', '#secondary', '#secondary-inner')} {
  687. height: calc(100vh - var(--ytd-toolbar-height));
  688. }
  689.  
  690. }
  691.  
  692. if video-enlarging > 0 {
  693.  
  694. ytd-watch-flexy:not([theater]):not([fullscreen]) #movie_player video[src] {
  695. transform: 'scale(%s)' % (video-enlarging / 1000 + 1) ;
  696. transform-origin: 50% 50%;
  697. }
  698.  
  699. }
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707. ytd-watch-flexy[flexy][is-two-columns_][theater]:not([fullscreen]) {
  708.  
  709. --ylb-min-below-area: min-below-area-for-theater;
  710.  
  711. {buildL4('is', '#player', '#player-theater-container', '#player-wide-container', '#player-container-outer', '#player-container-inner', '#player-container', '#movie_player', '#movie_player video')} {
  712. object-fit: contain;
  713. max-height: calc(100vh - var(--ytd-toolbar-height) - var(--ylb-min-below-area, 0px)) !important;
  714. }
  715. }
  716.  
  717.  
  718.  
  719. if no-bottom-row {
  720.  
  721. #bottom-row.ytd-watch-metadata {
  722. display: none !important;
  723. }
  724. }
  725.  
  726. h1.ytd-watch-metadata {
  727. font-size: video-title-size;
  728. --font-size: video-title-size;
  729. line-height: 140%;
  730. margin-bottom: -2px;
  731. }
  732.  
  733. chat-selector = youtube-wpr ? '[youtube-wpr*="h2"]': ":has(#chat:not([collapsed]))"
  734. #secondary-inner.ytd-watch-flexy {
  735. --tabview-slider-right: 0px !important;
  736. }
  737.  
  738. ytd-watch-flexy.style-scope:not([fullscreen]) {
  739.  
  740. & {
  741. --ytd-margin-2y: var(--ytd-margin-2x);
  742. --ytd-margin-3y: var(--ytd-margin-3x);
  743. --ytd-margin-4y: var(--ytd-margin-4x);
  744. --ytd-margin-6y: var(--ytd-margin-6x);
  745. --ytd-margin-8y: var(--ytd-margin-8x);
  746. }
  747.  
  748. #columns.style-scope.ytd-watch-flexy {
  749. --ytd-margin-2x: 0;
  750. --ytd-margin-3x: 0;
  751. --ytd-margin-4x: 0;
  752. --ytd-margin-6x: 0;
  753. --ytd-margin-8x: 0;
  754. }
  755.  
  756. .style-scope.ytd-watch-flexy > :not(.ytd-watch-flexy):not(secondary-wrapper),
  757. .style-scope.ytd-watch-flexy > secondary-wrapper > :not(.ytd-watch-flexy),
  758. #below,
  759. #player {
  760. --ytd-margin-2x: var(--ytd-margin-2y);
  761. --ytd-margin-3x: var(--ytd-margin-3y);
  762. --ytd-margin-4x: var(--ytd-margin-4y);
  763. --ytd-margin-6x: var(--ytd-margin-6y);
  764. --ytd-margin-8x: var(--ytd-margin-8y);
  765. }
  766. if unlimit-player-max-width {
  767. html body ytd-watch-flexy.style-scope[class][flexy]:not([attr1][attr2]) #columns.ytd-watch-flexy.style-scope[class] {
  768. max-width: initial;
  769. }
  770. #columns {
  771. --ytd-watch-flexy-max-player-width: initial;
  772. }
  773. }
  774.  
  775. #secondary-inner.style-scope.ytd-watch-flexy {
  776. display: flex;
  777. flex-direction: column;
  778. height: 100%;
  779. }
  780.  
  781. #secondary-inner.style-scope.ytd-watch-flexy > * {
  782. flex-shrink: 0;
  783. }
  784.  
  785. #movie_player {
  786. position: relative;
  787. > .html5-video-container:has(video) {
  788. top: 0;
  789. bottom: 0;
  790. left: 0;
  791. right: 0;
  792. position: absolute;
  793. }
  794.  
  795. .html5-video-container > video {
  796. width: unset !important;
  797. height: 100% !important;
  798. left: 0 !important;
  799. right: 0 !important;
  800. max-height: 100%;
  801. max-width: 100%;
  802. margin: 0 auto;
  803. }
  804.  
  805. .html5-video-container > video[style*="top:"]:not(video[style*="top: -"]):not(video[style*="top:-"]) {
  806. top: 0 !important;
  807. }
  808.  
  809. }
  810.  
  811. #chat-container {
  812. display: flex;
  813. flex-direction: column;
  814. }
  815.  
  816. #right-tabs {
  817. display: flex;
  818. margin: 0 !important;
  819. flex: 1;
  820. flex-direction: column;
  821.  
  822. {buildL4('is', '#material-tabs', '.tab-content')} {
  823. outline: 0;
  824. }
  825.  
  826. .tab-content {
  827. flex: 77;
  828. }
  829. }
  830.  
  831. &:not([is-two-columns_]) #primary-inner > *:not(#player) {
  832. padding: 0;
  833. }
  834.  
  835. &:not([is-two-columns_]) #primary-inner #below > *:not([id|="chat"]) {
  836. padding: 0 primary-content-margin 0;
  837. }
  838.  
  839. }
  840.  
  841. if no-round-border {
  842.  
  843. ytd-live-chat-frame[rounded-container],
  844. ytd-live-chat-frame[rounded-container] #show-hide-button.ytd-live-chat-frame ytd-toggle-button-renderer.ytd-live-chat-frame,
  845. ytd-live-chat-frame[rounded-container] iframe.ytd-live-chat-frame,
  846. ytd-live-chat-frame[rounded-container] #show-hide-button.ytd-live-chat-frame ytd-toggle-button-renderer.ytd-live-chat-frame button.yt-spec-button-shape-next,
  847. ytd-live-chat-frame[rounded-container] #show-hide-button.ytd-live-chat-frame ytd-toggle-button-renderer.ytd-live-chat-frame button.yt-spec-button-shape-next:hover {
  848. border-radius: unset;
  849. }
  850. }
  851.  
  852.  
  853. if disable-cinematics {
  854. #cinematics.ytd-watch-flexy {
  855. display: none;
  856. }
  857. }
  858. } //
  859. contentgHTML() {
  860. // html
  861.  
  862. content2cHTML() //
  863. selector-g = '' //
  864. if mode-for-single-col=="disabled" { //
  865. selector-g = youtube-wpr ? '[youtube-wpr*="s"]': ":has(ytd-watch-flexy[is-two-columns_])" //
  866. } //
  867. &{s(selector-g)} { //
  868. // html
  869. contentfHTML() //
  870. } //
  871. }
  872. contentgMAIN() {
  873. // body or html
  874.  
  875. content2cMAIN() //
  876. selector-g = '' //
  877. if mode-for-single-col=="disabled" { //
  878. selector-g = youtube-wpr ? '[youtube-wpr*="s"]': ":has(ytd-watch-flexy[is-two-columns_])" //
  879. } //
  880. &{s(selector-g)} { //
  881. // html
  882. contentfMAIN() //
  883. } //
  884. }
  885. contentBase() //
  886. selectors-2col = { //
  887. "expanded-panel": join(', ',
  888. "html:not([tabview-loaded]):has(ytd-live-chat-frame#chat:not([collapsed])):has(iframe#chatframe)",
  889. "html[tabview-loaded]:has(ytd-watch-flexy[is-two-columns_]:not([fullscreen]))"
  890. ),
  891. "expanded-live": "html:has(ytd-live-chat-frame#chat:not([collapsed])):has(iframe#chatframe)",
  892. "expandable-live": "html:has(ytd-live-chat-frame#chat):has(iframe#chatframe)",
  893. "always": "html"
  894. } //
  895. if youtube-wpr {
  896. selectors-2col = { //
  897. "expanded-panel": join(', ',
  898. 'html:not([tabview-loaded])[youtube-wpr*="h2"][youtube-wpr*="f"]',
  899. 'html[tabview-loaded][youtube-wpr*="s"][youtube-wpr*="f"]'
  900. ),
  901. "expanded-live": 'html[youtube-wpr*="h2"][youtube-wpr*="f"]',
  902. "expandable-live": 'html:not([youtube-wpr*="h0"])[youtube-wpr*="f"]',
  903. "always": 'html[youtube-wpr*="f"]'
  904. } //
  905. }
  906. selector-2col = selectors-2col[mode-for-two-col]
  907. selectors-k = split(', ', selector-2col)
  908. for selector-k in selectors-k {
  909. {s(selector-k)} {
  910. if no-masthead-w==1 {
  911. contentNoMasthead()
  912. }
  913. if compatible-ytlstm {
  914. contentgHTML()
  915. body:not([data-ytlstm-theater-mode]) {
  916. contentgMAIN() //
  917. }
  918. } else {
  919. contentgHTML()
  920. contentgMAIN() //
  921. }
  922. }
  923. }
  924.  
  925. if single-col-mobile {
  926. m = youtube-wpr ? '[youtube-wpr*="S"][youtube-wpr*="f"]': ":has(ytd-watch-flexy:not([is-two-columns_]):not([fullscreen]))"
  927. html{selector(m)} {
  928.  
  929. if no-masthead-w==1 {
  930. contentNoMasthead()
  931. }
  932. if no-masthead-w==2 {
  933. if youtube-wpr {
  934. &[youtube-wpr*="h2"] {
  935. contentNoMasthead()
  936. }
  937. } else {
  938. &:has(#chat:not([collapsed])) {
  939. contentNoMasthead()
  940. }
  941. }
  942. }
  943. contentSingleColMobile()
  944. }
  945. }
  946.  
  947. @css {
  948.  
  949. @supports not selector(:has(body)) {
  950.  
  951.  
  952. html::after {
  953. display: block;
  954. content: 'Your browser does not support "has-selector". Please update to latest version and enable it via configuration.';
  955. width: 60vh;
  956. padding: 12px;
  957. height: auto;
  958. position: fixed;
  959. left: 50%;
  960. top: 50%;
  961. transform: translate(-50%, -50%);
  962. transform-origin: 0 0;
  963. background: #71210f;
  964. color: #d2dadb;
  965. font-size: 14pt;
  966. text-shadow: 1px 1px 2px #605262;
  967. }
  968.  
  969. }
  970. }
  971.  
  972.  
  973. if youtube-wpr {
  974.  
  975. @css {
  976. @supports selector(:has(body)) {
  977.  
  978. @keyframes wpr-message-appear {
  979. 0% {
  980. top: -300vh;
  981. }
  982. 1% {
  983. top: 50%;
  984. }
  985. 100% {
  986. top: 50%;
  987. }
  988. }
  989. html:not([youtube-wpr]) ytd-watch-flexy::after {
  990. display: block;
  991. content: 'YouTube Live Borderless: YouTube WPR is not yet installed. Please install the userscript https://greasyfork.org/scripts/457319 in order to use YouTube WPR';
  992. width: 60vh;
  993. padding: 12px;
  994. height: auto;
  995. position: fixed;
  996. left: 50%;
  997. top: -300vh;
  998. transform: translate(-50%, -50%);
  999. transform-origin: 0 0;
  1000. background: #71210f;
  1001. color: #d2dadb;
  1002. font-size: 14pt;
  1003. text-shadow: 1px 1px 2px #605262;
  1004. animation: wpr-message-appear 1ms 2s forwards;
  1005. z-index: 9999;
  1006. }
  1007. }
  1008.  
  1009. }
  1010.  
  1011. }
  1012. }