YouTube Comments Delete Advanced

Convenient deletion of your comments on YouTube, on the comment history page https://www.youtube.com/feed/history/comment_history

目前為 2024-04-02 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name YouTube Comments Delete Advanced
  3. // @name:ru Удаление комментариев на YouTube (расширенный)
  4. // @name:de Erweitertes Löschen von YouTube-Kommentaren
  5. // @name:uk Розширене видалення коментарів на YouTube
  6. // @name:zh YouTube评论删除高级
  7. // @name:ja YouTubeコメント削除の高度な機能
  8. // @name:nl Geavanceerd verwijderen van YouTube-reacties
  9. // @name:pt Exclusão Avançada de Comentários do YouTube
  10. // @name:es Eliminación Avanzada de Comentarios de YouTube
  11. // @name:it Eliminazione Avanzata dei Commenti su YouTube
  12. // @name:ar حذف تعليقات YouTube المتقدمة
  13. // @name:fr Suppression avancée des commentaires YouTube
  14. // @name:pl Zaawansowane usuwanie komentarzy na YouTube
  15. // @name:az YouTube Şərhlərinin Ətraflı Silinməsi
  16. // @name:kz YouTube Пікірлерінің Кеңейтілген Жою
  17. // @name:hy YouTube-ի Դիտորդների Գրանցված Պատկերասրահները
  18. // @name:af YouTube Kommentaarverwydering Gevorderd
  19. // @name:ab YouTube-ре Комментариев Ирытхьит Къаьнапре
  20. // @name:bn ইউটিউব মন্তব্য মুছে দেওয়ার উন্নত বিষয়বস্তু
  21. // @name:bs Napredno brisanje komentara na YouTube-u
  22. // @name:ka YouTube-ის კომენტარების გაუქმების გაფართოება
  23. // @name:da Avanceret sletning af kommentarer på YouTube
  24. // @name:he מחיקת תגובות מתקדמת ביוטיוב
  25. // @name:yi אויפפירן קאָמענטאַרן אויף יוטוב אַדוואַנסירט
  26. // @name:id Penghapusan Komentar YouTube yang Lanjutan
  27. // @name:is Áframhaldandi Eyðing á Athugasemdum á YouTube
  28. // @name:kk YouTube Пікірлерінің Қиындылығы
  29. // @name:ky YouTube Комментарийлерди Өчүрүүнүн кеңири
  30. // @name:km ការលុបមតិយោបល់នៅលើ YouTube ដោយកម្រិតខ្ពស់
  31. // @name:et Edasijõudnud YouTube'i kommentaaride kustutamine
  32. // @name:lv YouTube Komentāru Papildināts Dzēšana
  33. // @name:lt Pažangus „YouTube“ komentarų trynimas
  34. // @name:ce YouTube-до Шхаштунаьхнах комментариев яцагийн
  35. // @name:hi YouTube पर टिप्पणियों का उन्नत रूप से हटाना
  36. // @name:tk YouTube-da maglumatlaryň gowjaňlaýyn
  37. // @name:tr YouTube Yorumlarınızın Gelişmiş Silinmesi
  38. // @name:uz YouTube Sharhlaringizni Gelişgan o'chirish
  39. // @name:fa حذف پیشرفته نظرات یوتیوب
  40. // @name:el Προηγμένη διαγραφή σχολίων στο YouTube
  41. // @name:be Расшыранае выдаленне каментароў на YouTube
  42. // @description Convenient deletion of your comments on YouTube, on the comment history page https://www.youtube.com/feed/history/comment_history
  43. // @description:ru Удобное удаление своих комментариев на YouTube, на странице истории https://www.youtube.com/feed/history/comment_history
  44. // @description:de Bequemes Löschen Ihrer Kommentare auf YouTube auf der Kommentarverlauf-Seite https://www.youtube.com/feed/history/comment_history
  45. // @description:uk Зручне видалення ваших коментарів на YouTube, на сторінці історії коментарів https://www.youtube.com/feed/history/comment_history
  46. // @description:zh 在YouTube上方便删除您的评论,位于评论历史页面 https://www.youtube.com/feed/history/comment_history
  47. // @description:ja YouTubeのコメント履歴ページhttps://www.youtube.com/feed/history/comment_historyで自分のコメントを便利に削除する
  48. // @description:nl Handig verwijderen van uw opmerkingen op YouTube, op de pagina met commentaargeschiedenis https://www.youtube.com/feed/history/comment_history
  49. // @description:pt Exclusão conveniente dos seus comentários no YouTube, na página de histórico de comentários https://www.youtube.com/feed/history/comment_history
  50. // @description:es Eliminación conveniente de sus comentarios en YouTube, en la página de historial de comentarios https://www.youtube.com/feed/history/comment_history
  51. // @description:it Comoda eliminazione dei tuoi commenti su YouTube, nella pagina della cronologia dei commenti https://www.youtube.com/feed/history/comment_history
  52. // @description:ar حذف مريح لتعليقاتك على YouTube، على صفحة تاريخ التعليقات https://www.youtube.com/feed/history/comment_history
  53. // @description:fr Suppression pratique de vos commentaires sur YouTube, sur la page d'historique des commentaires https://www.youtube.com/feed/history/comment_history
  54. // @description:pl Wygodne usuwanie swoich komentarzy na YouTube, na stronie historii komentarzy https://www.youtube.com/feed/history/comment_history
  55. // @description:az YouTube-da öz şərhlərinizin rahat silinməsi, şərhlərin tarix səhifəsində https://www.youtube.com/feed/history/comment_history
  56. // @description:kz YouTube-дағы комментарилеріңіздің оңтай өшіруі, комментарий тарихы бетінде https://www.youtube.com/feed/history/comment_history
  57. // @description:hy Ձեր մերժումների հեշտ ջնջումը YouTube- ում, մեկնաբանության պատմության էջում https://www.youtube.com/feed/history/comment_history
  58. // @description:af Gerieflike verwydering van jou kommentaar op YouTube, op die kommentaar geskiedenis bladsy https://www.youtube.com/feed/history/comment_history
  59. // @description:ab ГӀавзендагаш вашхӀа комментариеваш на YouTube, на страницан лхарьваруш https://www.youtube.com/feed/history/comment_history
  60. // @description:bn ইউটিউবে আপনার মন্তব্যগুলি সুবিধাজনকভাবে মুছে ফেলা, মন্তব্যের ইতিহাস পৃষ্ঠায় https://www.youtube.com/feed/history/comment_history
  61. // @description:bs Prikladno brisanje vaših komentara na YouTubeu, na stranici povijesti komentara https://www.youtube.com/feed/history/comment_history
  62. // @description:ka თქვენი კომენტარების წაშლა YouTube- ზე, კომენტარების ისტორიის გვერდზე https://www.youtube.com/feed/history/comment_history
  63. // @description:da Bequemes Löschen Ihrer Kommentare auf YouTube auf der Kommentarverlauf-Seite https://www.youtube.com/feed/history/comment_history
  64. // @description:he מחיקה נוחה של ההערות שלך ב- YouTube, בדף ההיסטוריית ההערות https://www.youtube.com/feed/history/comment_history
  65. // @description:yi געמיטלעך פון דיין קאָמענטאַרן אויפן יוטוב, אויף די קאָמענט ארכיו זײַט https://www.youtube.com/feed/history/comment_history
  66. // @description:id Penghapusan komentar YouTube Anda yang nyaman, di halaman riwayat komentar https://www.youtube.com/feed/history/comment_history
  67. // @description:is Þægilegt eyða athugasemdum þínum á YouTube, á athugasemdarsögu síðunni https://www.youtube.com/feed/history/comment_history
  68. // @description:kk YouTube-дегі пікірлеріңіздің ыңғай жоюы, пікірлер тарихы бетінде https://www.youtube.com/feed/history/comment_history
  69. // @description:ky YouTube-дагы комментарийлериңизди колдонмонун тарыхы бетиндеги ыңғайтуу өчүргүлөрү https://www.youtube.com/feed/history/comment_history
  70. // @description:km ការលុបស្ថានភាពរបស់លោកអ្នកនៅលើយូធូប YouTube, នៅលើទំព័រប្រវត្តិសាស្ត្រនៃយូធូប https://www.youtube.com/feed/history/comment_history
  71. // @description:et Teie kommentaaride mugav kustutamine YouTube'is, kommentaaride ajaloo lehel https://www.youtube.com/feed/history/comment_history
  72. // @description:lv Jūsu komentāru ērta dzēšana YouTube, komentāru vēstures lapā https://www.youtube.com/feed/history/comment_history
  73. // @description:lt Patogus jūsų komentarų šalinimas „YouTube“, komentarų istorijos puslapyje https://www.youtube.com/feed/history/comment_history
  74. // @description:ce YouTube-са бакъыт вац сацарыгӀ комментариев хьа егатарш, комментариев тариххаш https://www.youtube.com/feed/history/comment_history
  75. // @description:hi यूट्यूब पर अपने टिप्पणियों को सुविधाजनक रूप से हटाना, टिप्पणी इतिहास पृष्ठ पर https://www.youtube.com/feed/history/comment_history
  76. // @description:tk YouTube-da öz diňe kommentlerinizi gowjaňlaýyn, kommentler tarapyndan geçirýän sahypa https://www.youtube.com/feed/history/comment_history
  77. // @description:tr YouTube'daki yorumlarınızı rahatça silme, yorum geçmişi sayfasında https://www.youtube.com/feed/history/comment_history
  78. // @description:uz Sizning fikrlaringizni YouTube-da qulay o'chirish, fikrlar tarixi sahifasida https://www.youtube.com/feed/history/comment_history
  79. // @description:fa حذف راحت نظرات شما در YouTube، در صفحه تاریخچه نظرات https://www.youtube.com/feed/history/comment_history
  80. // @description:el Εύκολη διαγραφή των σχολίων σας στο YouTube, στη σελίδα ιστορικού σχολίων https://www.youtube.com/feed/history/comment_history
  81. // @description:be Зручнае выдаленне вашых каментараў на YouTube, на старонцы гісторыі каментароў https://www.youtube.com/feed/history/comment_history
  82. // @namespace https://greasyfork.org/users/1221433
  83. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  84. // @version 1.0
  85. // @author Sitego
  86. // @match *://myactivity.google.com/*
  87. // @grant GM_getResourceText
  88. // @license MIT
  89. // ==/UserScript==
  90.  
  91. (function () {
  92. 'use strict';
  93. function addButtons() {
  94. var deleteButtons = document.querySelectorAll('.VfPpkd-Bz112c-LgbsSe');
  95. deleteButtons.forEach(function (button) {
  96. if (!button.closest('[aria-haspopup="menu"]')) {
  97. if (!button.parentNode.querySelector('.comment-checkbox')) {
  98. var checkbox = document.createElement('input');
  99. checkbox.type = 'checkbox';
  100. checkbox.className = 'comment-checkbox';
  101. button.parentNode.insertBefore(checkbox, button);
  102. checkbox.addEventListener('change', function () {
  103. updateDeleteButtonState();
  104. });
  105. checkbox.addEventListener('mouseover', function (event) {
  106. handleCheckboxMouseover(event, checkbox);
  107. });
  108. }
  109. }
  110. });
  111. if (!document.querySelector('.delete-all-button')) {
  112. var deleteAllButton = document.createElement('button');
  113. deleteAllButton.textContent = 'Delete Selected Comments';
  114. deleteAllButton.className = 'delete-all-button';
  115. deleteAllButton.disabled = true;
  116. deleteAllButton.addEventListener('click', function () {
  117. deleteSelectedComments();
  118. });
  119. if (deleteButtons.length > 0) {
  120. deleteButtons[0].parentNode.parentNode.insertBefore(deleteAllButton, deleteButtons[0].parentNode);
  121. }
  122. }
  123. if (!document.querySelector('.select-all-button')) {
  124. var selectAllButton = document.createElement('button');
  125. selectAllButton.textContent = 'Select All';
  126. selectAllButton.className = 'select-all-button';
  127. selectAllButton.addEventListener('click', function () {
  128. selectAllCheckboxes();
  129. });
  130. if (deleteButtons.length > 0) {
  131. deleteButtons[0].parentNode.parentNode.insertBefore(selectAllButton, deleteButtons[0].parentNode);
  132. }
  133. }
  134. if (!document.querySelector('.clear-all-button')) {
  135. var clearAllButton = document.createElement('button');
  136. clearAllButton.textContent = 'Clear All';
  137. clearAllButton.className = 'clear-all-button';
  138. clearAllButton.addEventListener('click', function () {
  139. clearAllCheckboxes();
  140. });
  141. if (deleteButtons.length > 0) {
  142. deleteButtons[0].parentNode.parentNode.insertBefore(clearAllButton, deleteButtons[0].parentNode);
  143. }
  144. }
  145. }
  146. function updateDeleteButtonState() {
  147. var deleteAllButton = document.querySelector('.delete-all-button');
  148. var checkboxes = document.querySelectorAll('.comment-checkbox');
  149. var anyChecked = Array.from(checkboxes).some(function (checkbox) {
  150. return checkbox.checked;
  151. });
  152. if (deleteAllButton) {
  153. if (anyChecked) {
  154. deleteAllButton.removeAttribute('disabled');
  155. } else {
  156. deleteAllButton.setAttribute('disabled', 'disabled');
  157. }
  158. }
  159. }
  160. function deleteSelectedComments() {
  161. var checkboxes = document.querySelectorAll('.comment-checkbox');
  162. checkboxes.forEach(function (checkbox) {
  163. if (checkbox.checked) {
  164. var deleteButton = checkbox.nextElementSibling;
  165. deleteButton.click();
  166. }
  167. });
  168. }
  169. function selectAllCheckboxes() {
  170. var checkboxes = document.querySelectorAll('.comment-checkbox');
  171. checkboxes.forEach(function (checkbox) {
  172. checkbox.checked = true;
  173. });
  174. updateDeleteButtonState();
  175. }
  176. function clearAllCheckboxes() {
  177. var checkboxes = document.querySelectorAll('.comment-checkbox');
  178. checkboxes.forEach(function (checkbox) {
  179. checkbox.checked = false;
  180. });
  181. updateDeleteButtonState();
  182. }
  183. function handleCheckboxMouseover(event, currentCheckbox) {
  184. if (currentCheckbox.checked) {
  185. currentCheckbox.checked = false;
  186. } else {
  187. currentCheckbox.checked = true;
  188. }
  189. }
  190. window.addEventListener('load', function () {
  191. addButtons();
  192. });
  193. document.addEventListener('DOMSubtreeModified', function () {
  194. updateDeleteButtonState();
  195. addButtons();
  196. });
  197. var buttonStyles = document.createElement('style');
  198. buttonStyles.textContent = `
  199. .delete-all-button, .select-all-button, .clear-all-button {
  200. position: fixed;
  201. top: 50%;
  202. right: 20px;
  203. transform: translateY(-50%);
  204. background-color: red;
  205. color: white;
  206. padding: 10px 20px;
  207. border: none;
  208. border-radius: 5px;
  209. cursor: pointer;
  210. z-index: 9999;
  211. margin-bottom: 10px;
  212. font-weight: bold;
  213. }
  214. .delete-all-button:hover, .select-all-button:hover, .clear-all-button:hover {
  215. background-color: #777;
  216. }
  217. .select-all-button {
  218. top: 40%;
  219. background-color: #1988FF;
  220. font-weight: bold;
  221. }
  222. .clear-all-button {
  223. top: 60%;
  224. background-color: #1DA044;
  225. font-weight: bold;
  226. }
  227. `;
  228. document.head.appendChild(buttonStyles);
  229. var checkboxStyles = document.createElement('style');
  230. checkboxStyles.textContent = `
  231. .comment-checkbox {
  232. -webkit-appearance: none;
  233. -moz-appearance: none;
  234. appearance: none;
  235. width: 24px;
  236. height: 24px;
  237. border: 2px solid #ccc;
  238. border-radius: 5px;
  239. cursor: pointer;
  240. float: right;
  241. margin-top: 10px;
  242. }
  243.  
  244. .comment-checkbox:checked {
  245. background-color: #007bff;
  246. border-color: #007bff;
  247. }
  248.  
  249. .comment-checkbox:checked::after {
  250. content: '\\2713';
  251. font-size: 18px;
  252. color: white;
  253. margin-left: 4px;
  254. }
  255. .comment-checkbox:hover {
  256. background-color: #007bff;
  257. }
  258. `;
  259. document.head.appendChild(checkboxStyles);
  260. })();