Greasy Fork 还支持 简体中文。

優酷影院模式

自動轉到更寬的 YouTube 屏幕

目前為 2022-01-25 提交的版本,檢視 最新版本

  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.01.25.16: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. DEF.innerText = `
  24. [dark] .gstl_50.sbdd_a * {background-color:#232323!important; border-color:#282828!important}
  25. [dark] .gsfs,[dark] .sbpqs_a{color:#FFF!important}
  26.  
  27. ytd-app:not([guide-persistent-and-visible]) [theater] #player.ytd-watch {height: 100vh!important; max-height: 100vh!important}
  28. :is(ytd-watch-flexy[theater],ytd-watch-flexy[fullscreen]) #player-theater-container.ytd-watch-flexy,
  29. ytd-app:not([guide-persistent-and-visible]) [theater] #player video {
  30. width: 100%!important; height: 100vh!important; max-height: 100vh!important; max-width: 100%!important; left: 0!important}`
  31. document.head.appendChild(DEF)
  32.  
  33. let TOG = document.createElement("style")
  34. TOG.innerText = `
  35. ytd-app:not([guide-persistent-and-visible]) :is(ytd-masthead, #masthead-container.ytd-app::after) {transform: translateY(-56px); transition: transform .1s .5s ease-out}
  36. ytd-app:not([guide-persistent-and-visible]) :is(#masthead-container:hover ytd-masthead, #masthead-container:hover.ytd-app::after) {transform: translateY(0px)}
  37. ytd-app:not([guide-persistent-and-visible]) ytd-page-manager {margin-top: 0!important}`
  38. TOG.className = "TOGstyle"
  39.  
  40. window.addEventListener("yt-navigate-finish", () => {
  41. document.head.appendChild(TOG)
  42. setTimeout(() => {if (document.querySelector("ytd-watch-flexy") == null) document.querySelector(".TOGstyle").remove()}, 100)
  43. setTimeout(() => {if ((document.querySelector("#ytd-player").offsetWidth + 50) < window.innerWidth) document.querySelector(".ytp-size-button").click()}, 1500)
  44. window.scrollTo(0, 0);
  45. })
  46.  
  47. window.addEventListener("mouseup", () => {
  48. setTimeout(() => {
  49. ((document.querySelector("#ytd-player").offsetWidth + 50) < window.innerWidth && document.URL.indexOf("watch") > -1) ?
  50. document.querySelector(".TOGstyle").remove() :
  51. document.head.appendChild(TOG)
  52. }, 100)
  53. })