YT Theatermode

Auto and full screeded Theater mode.

当前为 2021-10-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YT Theatermode
  3. // @namespace YT Theatermode
  4. // @author ndaesik
  5. // @include https://www.youtube.com/*
  6. // @run-at document-start
  7. // @icon https://lh3.googleusercontent.com/iLZyxGK7l1343U4E7eAfgKbRWW6qhzCJq-Z92M60JzCMntFyaFF2GUQVRxPhfGcy6qRISLjHv4fX1vtq0TZkZMAzBjM=w128-h128-e365-rj-sc0x00ffffff
  8. // @description Auto and full screeded Theater mode.
  9. // @version 1.0
  10. // ==/UserScript==
  11.  
  12.  
  13. window.addEventListener("yt-navigate-finish", function(event) {
  14. var timer = setTimeout(function() {
  15. if ((document.querySelector('ytd-player').offsetWidth + 100) < window.innerWidth) {
  16. document.querySelector('.ytp-size-button').click();
  17. console.log("hello");
  18. }
  19. }, 500)
  20. })
  21.  
  22. var styles = `
  23. [dark] .gstl_50.sbdd_a *{background-color:#232323!important;border-color:#282828!important}
  24. [dark] .gsfs,[dark] .sbpqs_a{color:#FFF!important}
  25.  
  26. ytd-app:not([guide-persistent-and-visible]) ytd-page-manager {
  27. margin-top: 0!important;
  28. }
  29.  
  30. ytd-app:not([guide-persistent-and-visible]) #player-theater-container:empty~#columns #primary,
  31. ytd-app:not([guide-persistent-and-visible]) #player-theater-container:empty~#columns #secondary{
  32. padding-top: 56px;
  33. }
  34.  
  35. ytd-app:not([guide-persistent-and-visible]) ytd-masthead,
  36. ytd-app:not([guide-persistent-and-visible]) #masthead-container.ytd-app::after {
  37. transform: translateY(-56px);
  38. transition: transform .1s .5s ease-out;
  39. }
  40. ytd-app:not([guide-persistent-and-visible]) #masthead-container:hover ytd-masthead,
  41. ytd-app:not([guide-persistent-and-visible]) #masthead-container:hover.ytd-app::after {
  42. transform: translateY(0px);
  43. }
  44.  
  45. ytd-app:not([guide-persistent-and-visible]) [theater] #player.ytd-watch {
  46. height: 100vh!important;
  47. max-height: 100vh!important;
  48. }
  49.  
  50. ytd-watch-flexy[theater] #player-theater-container.ytd-watch-flexy,
  51. ytd-watch-flexy[fullscreen] #player-theater-container.ytd-watch-flexy,
  52. ytd-app:not([guide-persistent-and-visible]) [theater] #player video {
  53. width: 100%!important;
  54. height: 100vh!important;
  55. max-height: 100vh!important;
  56. max-width: 100%!important;
  57. left: 0!important;
  58. }
  59.  
  60. ytd-app:not([guide-persistent-and-visible]) .ytp-chrome-top.ytp-share-button-visible,
  61. ytd-app:not([guide-persistent-and-visible]) #iv-drawer .iv-drawer-header,
  62. ytd-app:not([guide-persistent-and-visible]) #iv-drawer .iv-drawer-content {
  63. margin-top: 30px;
  64. }
  65.  
  66. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-chrome-top.ytp-share-button-visible,
  67. ytd-app:not([guide-persistent-and-visible]) [theater] #iv-drawer .iv-drawer-header,
  68. ytd-app:not([guide-persistent-and-visible]) [theater] #iv-drawer .iv-drawer-content,
  69. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-multicam-menu-header,
  70. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-multicam-menu-items,
  71. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-playlist-menu-header,
  72. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-playlist-menu-items,
  73. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-share-panel-close {
  74. margin-top: 56px;
  75. }
  76.  
  77. ytd-app:not([guide-persistent-and-visible]) .ytp-tooltip.ytp-tooltip-opaque.ytp-bottom {
  78. right: 60px!important;
  79. top: 35px!important;
  80. }
  81.  
  82. ytd-app:not([guide-persistent-and-visible]) [theater] .ytp-tooltip.ytp-tooltip-opaque.ytp-bottom {
  83. right: 60px!important;
  84. top: 60px!important;
  85. }
  86. `
  87.  
  88. var styleSheet = document.createElement("style")
  89. styleSheet.type = "text/css"
  90. styleSheet.innerText = styles
  91. document.head.appendChild(styleSheet)