优酷影院模式

自动转到更宽的 YouTube 屏幕

目前为 2022-05-15 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name:ko 유튜브 극장모드
  3. // @name Youtube Theatermode
  4. // @name:ru Youtube Театральный режим
  5. // @name:jp Youtubeシアターモード
  6. // @name:zh-CN 优酷影院模式
  7. // @name:zh-TW 優酷影院模式
  8.  
  9. // @description:ko 유튜브 화면을 자동으로 꽉 찬 화면으로 바꿉니다.
  10. // @description Turn to wider Youtube screen automatially.
  11. // @description:ru Автоматически переключайтесь на более широкий экран Youtube.
  12. // @description:jp 自動的に広いYouTube画面に移動します
  13. // @description:zh-CN 自动转到更宽的 YouTube 屏幕
  14. // @description:zh-TW 自動轉到更寬的 YouTube 屏幕
  15.  
  16. // @namespace https://ndaesik.tistory.com/
  17. // @version 2022.05.15.14.42
  18. // @author ndaesik
  19. // @icon https://lh3.googleusercontent.com/iLZyxGK7l1343U4E7eAfgKbRWW6qhzCJq-Z92M60JzCMntFyaFF2GUQVRxPhfGcy6qRISLjHv4fX1vtq0TZkZMAzBjM
  20. // @match https://www.youtube.com/*
  21. // ==/UserScript==
  22. let DEF = document.createElement("style")
  23. , TOG = document.createElement("style")
  24. DEF.innerText = `
  25. #chips-wrapper.ytd-feed-filter-chip-bar-renderer {top:56px}
  26. [dark] .gstl_50.sbdd_a * {background-color:#232323!important; border-color:#282828!important}
  27. [dark] .gsfs,[dark] .sbpqs_a{color:#FFF!important}
  28. [dark] .sbqs_c:before {filter: invert(1)!important}
  29. ytd-app:not([guide-persistent-and-visible]) [theater] #player.ytd-watch {height: 100vh!important; max-height: 100vh!important}
  30. :is(ytd-watch-flexy[theater],ytd-watch-flexy[fullscreen]) #player-theater-container.ytd-watch-flexy,
  31. ytd-app:not([guide-persistent-and-visible]) [theater] #player video {
  32. width: 100%!important; height: 100vh!important; max-height: 100vh!important; max-width: 100%!important; left: 0!important}`
  33. document.head.appendChild(DEF)
  34. TOG.innerText = `
  35. ytd-app:not([guide-persistent-and-visible]) :is(#masthead-container ytd-masthead, #masthead-container.ytd-app::after) {transform: translateY(-56px); transition: transform .1s .3s ease-out}
  36. ytd-app:not([guide-persistent-and-visible]) :is(#masthead-container:hover ytd-masthead, #masthead-container:hover.ytd-app::after, #masthead-container:focus-within ytd-masthead) {transform: translateY(0px)}
  37. ytd-app:not([guide-persistent-and-visible]) ytd-page-manager {margin-top: 0!important}`
  38. TOG.className = "TOGstyle"
  39.  
  40. "yt-navigate-finish load".split(" ").forEach((e) => {
  41. window.addEventListener(e, () => {
  42. document.head.appendChild(TOG)
  43. let full = setInterval(() => {((document.querySelector("#ytd-player")?.offsetWidth + 50) < window.innerWidth) ? document.querySelectorAll(".ytp-size-button").forEach(el=>el.click()) : clearInterval(full)},100)
  44. setTimeout(() => {if (document.querySelector("ytd-watch-flexy") == null) document.querySelector(".TOGstyle")?.remove()}, 100)
  45. setTimeout(() => {clearInterval(full)}, 10000)
  46. window.scrollTo(0, 0)
  47. });
  48. });
  49.  
  50. window.addEventListener("mouseup", () => {
  51. setTimeout(() => {
  52. ((document.querySelector("#ytd-player").offsetWidth + 50) < window.innerWidth || document.URL.indexOf("watch") == -1) ?
  53. document.querySelector(".TOGstyle")?.remove() : document.head.appendChild(TOG)
  54. }, 100)
  55. })

QingJ © 2025

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