YouTube Live Borderless

Make YouTube Live Borderless

目前为 2024-05-03 提交的版本,查看 最新版本

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