Toggle Youtube Styles

Adds toggles to enable/disable some styles that change Youtube

当前为 2024-06-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Toggle Youtube Styles
  3. // @license MIT
  4. // @namespace rtonne
  5. // @match https://www.youtube.com/*
  6. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  7. // @version 1.5
  8. // @author Rtonne
  9. // @description Adds toggles to enable/disable some styles that change Youtube
  10. // @require https://update.gf.qytechs.cn/scripts/498119/1395413/setupToggleCommands.js
  11. // @grant GM.addStyle
  12. // @grant GM.registerMenuCommand
  13. // @grant GM.unregisterMenuCommand
  14. // @grant GM.getValue
  15. // @grant GM.setValue
  16. // ==/UserScript==
  17.  
  18. const commands = [
  19. {
  20. id: "guide_sections",
  21. default: true,
  22. on_text: "☑ Guide Sections",
  23. off_text: "☐ Guide Sections",
  24. toggleOnFunction: () =>
  25. GM.addStyle(`
  26. #sections.ytd-guide-renderer > ytd-guide-section-renderer:nth-child(n+3) {
  27. display: unset;
  28. }
  29. `),
  30. toggleOffFunction: () =>
  31. GM.addStyle(`
  32. #sections.ytd-guide-renderer > ytd-guide-section-renderer:nth-child(n+3) {
  33. display: none;
  34. }
  35. `),
  36. },
  37. {
  38. id: "comments",
  39. default: true,
  40. on_text: "☑ Comments",
  41. off_text: "☐ Comments",
  42. toggleOnFunction: () =>
  43. GM.addStyle(`
  44. ytd-comments#comments {
  45. display: unset;
  46. }
  47. `),
  48. toggleOffFunction: () =>
  49. GM.addStyle(`
  50. ytd-comments#comments {
  51. display: none;
  52. }
  53. `),
  54. },
  55. {
  56. id: "related_videos",
  57. default: true,
  58. on_text: "☑ Related Videos",
  59. off_text: "☐ Related Videos",
  60. toggleOnFunction: () =>
  61. GM.addStyle(`
  62. #secondary.ytd-watch-flexy > #secondary-inner > #related {
  63. display: unset;
  64. }
  65. `),
  66. toggleOffFunction: () =>
  67. GM.addStyle(`
  68. #secondary.ytd-watch-flexy > #secondary-inner > #related {
  69. display: none;
  70. }
  71. `),
  72. },
  73. {
  74. id: "shorts",
  75. default: true,
  76. on_text: "☑ Shorts",
  77. off_text: "☐ Shorts",
  78. toggleOnFunction: () =>
  79. GM.addStyle(`
  80. ytd-rich-section-renderer:has(> div > [is-shorts]) {
  81. display: unset;
  82. }
  83. `),
  84. toggleOffFunction: () =>
  85. GM.addStyle(`
  86. ytd-rich-section-renderer:has(> div > [is-shorts]) {
  87. display: none;
  88. }
  89. `),
  90. },
  91. {
  92. id: "community",
  93. default: true,
  94. on_text: "☑ Community Posts",
  95. off_text: "☐ Community Posts",
  96. toggleOnFunction: () =>
  97. GM.addStyle(`
  98. ytd-rich-section-renderer:has(> div > :not([is-shorts]):not([thumbnail-style])) {
  99. display: unset;
  100. }
  101. `),
  102. toggleOffFunction: () =>
  103. GM.addStyle(`
  104. ytd-rich-section-renderer:has(> div > :not([is-shorts]):not([thumbnail-style])) {
  105. display: none;
  106. }
  107. `),
  108. },
  109. ];
  110.  
  111. setupToggleCommands(commands);

QingJ © 2025

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