YouTube Live Borderless

Make YouTube Live Borderless

当前为 2025-06-03 提交的版本,查看 最新版本

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