Greasy Fork is available in English.

YouTube Button Hider

You can hide share button, Thanks button, Clip button, Download button, Save (to platlist) button and live chat on YouTube videos.

  1. // ==UserScript==
  2. // @name YouTube Button Hider
  3. // @namespace YouTube Button Hider
  4. // @version 1.1.2
  5. // @author Hess
  6. // @match https://www.youtube.com/*
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  8. // @description You can hide share button, Thanks button, Clip button, Download button, Save (to platlist) button and live chat on YouTube videos.
  9. // @run-at document-idle
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 각 버튼의 숨기기 여부 (1: 숨기기, 0: 놔두기)
  17. const featureToggle = {
  18. hideShareButton: 1, // 공유 버튼 숨기기
  19. hideThanksButton: 1, // Thanks 버튼 숨기기
  20. hideClipButton: 1, // 클립 버튼 숨기기
  21. hideDownloadButton: 1, // 다운로드 버튼 숨기기
  22. hideSaveButton: 1, // (재생목록에) 저장 버튼 숨기기
  23. hideChatWindow: 1 // 채팅창 숨기기
  24. };
  25.  
  26. function hideButtons() {
  27. // 공유 버튼 숨기기
  28. if (featureToggle.hideShareButton) {
  29. const shareButton = document.querySelector(
  30. 'div#top-level-buttons-computed yt-button-view-model button-view-model button[aria-label="공유"]'
  31. );
  32. if (shareButton) {
  33. shareButton.style.display = 'none';
  34. }
  35. const shareButton2 = document.querySelector(
  36. 'div#top-level-buttons-computed yt-button-view-model button-view-model button[aria-label="Share"]'
  37. );
  38. if (shareButton2) {
  39. shareButton2.style.display = 'none';
  40. }
  41. const shareButton3 = document.querySelector(
  42. 'div#top-level-buttons-computed yt-button-view-model button-view-model button[aria-label="共有"]'
  43. );
  44. if (shareButton3) {
  45. shareButton3.style.display = 'none';
  46. }
  47. }
  48.  
  49. // Thanks 버튼 숨기기
  50. if (featureToggle.hideThanksButton) {
  51. const thanksButton = document.querySelector(
  52. 'button[aria-label="Thanks"]'
  53. );
  54. if (thanksButton) {
  55. thanksButton.style.display = 'none';
  56. }
  57. const thanksButton2 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  58. item => item.querySelector('yt-formatted-string').innerText === 'Thanks'
  59. );
  60. if (thanksButton2) {
  61. thanksButton2.style.display = 'none';
  62. }
  63. }
  64.  
  65. // 클립 버튼 숨기기
  66. if (featureToggle.hideClipButton) {
  67. const clipButton = document.querySelector(
  68. 'button[aria-label="클립"]'
  69. );
  70. if (clipButton) {
  71. clipButton.style.display = 'none';
  72. }
  73. const clipButton2 = document.querySelector(
  74. 'button[aria-label="Clip"]'
  75. );
  76. if (clipButton2) {
  77. clipButton2.style.display = 'none';
  78. }
  79. const clipButton3 = document.querySelector(
  80. 'button[aria-label="クリップ"]'
  81. );
  82. if (clipButton3) {
  83. clipButton3.style.display = 'none';
  84. }
  85. const clipButton4 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  86. item => item.querySelector('yt-formatted-string').innerText === '클립'
  87. );
  88. if (clipButton4) {
  89. clipButton4.style.display = 'none';
  90. }
  91. const clipButton5 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  92. item => item.querySelector('yt-formatted-string').innerText === 'Clip'
  93. );
  94. if (clipButton5) {
  95. clipButton5.style.display = 'none';
  96. }
  97. const clipButton6 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  98. item => item.querySelector('yt-formatted-string').innerText === 'クリップ'
  99. );
  100. if (clipButton6) {
  101. clipButton6.style.display = 'none';
  102. }
  103. }
  104.  
  105. // 오프라인 저장 버튼 숨기기
  106. if (featureToggle.hideDownloadButton) {
  107. const downloadButton = document.querySelector(
  108. 'ytd-download-button-renderer', 'ytd-menu-service-item-download-renderer'
  109. );
  110. if (downloadButton) {
  111. downloadButton.style.display = 'none';
  112. }
  113. const downloadButton2 = document.querySelector(
  114. 'ytd-menu-service-item-download-renderer'
  115. );
  116. if (downloadButton2) {
  117. downloadButton2.style.display = 'none';
  118. }
  119. }
  120.  
  121. // (재생목록에) 저장 버튼 숨기기
  122. if (featureToggle.hideSaveButton) {
  123. const saveButton = document.querySelector(
  124. 'button[aria-label="재생목록에 저장"]'
  125. );
  126. if (saveButton) {
  127. saveButton.style.display = 'none';
  128. }
  129. const saveButton2 = document.querySelector(
  130. 'button[aria-label="Save to platlist"]'
  131. );
  132. if (saveButton2) {
  133. saveButton2.style.display = 'none';
  134. }
  135. const saveButton3 = document.querySelector(
  136. 'button[aria-label="再生リストに保存"]'
  137. );
  138. if (saveButton3) {
  139. saveButton3.style.display = 'none';
  140. }
  141.  
  142. const saveButton4 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  143. item => item.querySelector('yt-formatted-string').innerText === '저장'
  144. );
  145. if (saveButton4) {
  146. saveButton4.style.display = 'none';
  147. }
  148. const saveButton5 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  149. item => item.querySelector('yt-formatted-string').innerText === 'Save'
  150. );
  151. if (saveButton5) {
  152. saveButton5.style.display = 'none';
  153. }
  154. const saveButton6 = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer[role="menuitem"] tp-yt-paper-item[role="option"]')).find(
  155. item => item.querySelector('yt-formatted-string').innerText === '保存'
  156. );
  157. if (saveButton6) {
  158. saveButton6.style.display = 'none';
  159. }
  160. }
  161.  
  162. // 채팅창 숨기기
  163. if (featureToggle.hideChatWindow) {
  164. const chatWindow = document.querySelector(
  165. '#chat'
  166. );
  167. if (chatWindow) {
  168. chatWindow.style.display = 'none';
  169. }
  170. }
  171. }
  172.  
  173. // 페이지 로드 시 버튼 숨기기
  174. hideButtons();
  175.  
  176. // 페이지 변경 감지 시 클립 버튼 숨기기
  177. const observer = new MutationObserver(hideButtons);
  178. observer.observe(document.body, { childList: true, subtree: true });
  179.  
  180. })();