Youtube - Wide video container

wide video container on youtube

当前为 2019-03-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube - Wide video container
  3. // @namespace 1N07
  4. // @author 1N07
  5. // @description wide video container on youtube
  6. // @include https://www.youtube.com/*
  7. // @version 1.7
  8. // @grant GM_registerMenuCommand
  9. // @grant GM_unregisterMenuCommand
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // ==/UserScript==
  13.  
  14. (function() {
  15.  
  16. var FPPHandle;
  17. var FPPCompOn = GM_getValue("FPPCompOn", false);
  18. SetOptionHandle();
  19.  
  20. if(!!document.getElementById("early-body")) { //if old youtube
  21. document.getElementById("content").setAttribute("style", "width: 99%;");
  22. } else { //new youtube
  23. addGlobalStyle(`
  24. #page-manager > ytd-browse:not([page-subtype="playlist"]) ytd-two-column-browse-results-renderer.ytd-browse,
  25. ytd-browse ytd-video-masthead-ad-v3-renderer.ytd-browse
  26. {
  27. box-sizing: border-box;
  28. width: 99%;
  29. width: calc(100% - 20px) !important;
  30. position: relative !important;
  31. }
  32. `);
  33.  
  34. if(FPPCompOn) {
  35. addGlobalStyle(`
  36. /*========== Fade++ Compatibility ==========*/
  37. ytd-app[guide-persistent-and-visible] ytd-page-manager ytd-browse
  38. {
  39. margin-left: 240px;
  40. }
  41. ytd-two-column-browse-results-renderer[page-subtype='subscriptions']
  42. {
  43. background-color:rgba(0,0,0,.7);
  44. margin-top:20px;
  45. padding:0 20px;
  46. border-radius:10px
  47. }
  48. `);
  49. }
  50. }
  51.  
  52. function SetOptionHandle() {
  53. GM_unregisterMenuCommand(FPPCompOn);
  54.  
  55. FPPHandle = GM_registerMenuCommand("Fade++ Compatibility mode (" + (FPPCompOn ? "On" : "Off") + ") -click to change-", function(){
  56. FPPCompOn = !FPPCompOn;
  57. GM_setValue("FPPCompOn", FPPCompOn);
  58. SetOptionHandle();
  59.  
  60. if(confirm('Press "OK" to refresh the page to apply new settings'))
  61. location.reload();
  62. });
  63. }
  64.  
  65. function addGlobalStyle(css) {
  66. var head, style;
  67. head = document.getElementsByTagName('head')[0];
  68. if (!head) { return; }
  69. style = document.createElement('style');
  70. style.type = 'text/css';
  71. style.innerHTML = css;
  72. head.appendChild(style);
  73. }
  74. })();

QingJ © 2025

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