YouTube Comments Delete Advanced

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

  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.20
  85. // @author Sitego
  86. // @match *://myactivity.google.com/*
  87. // @include *://www.youtube.com/feed/history/*
  88. // @grant GM_getResourceText
  89. // @license MIT
  90. // @category YouTube
  91. // ==/UserScript==
  92.  
  93. (function () {
  94. 'use strict';
  95. function addButtons() {
  96. var deleteButtons = document.querySelectorAll('div[class^="VfPpkd-Bz112c-"]');
  97. deleteButtons.forEach(function (button) {
  98. if (!button.closest('[aria-haspopup="menu"]')) {
  99. if (!button.parentNode.querySelector('.comment-checkbox')) {
  100. var checkbox = document.createElement('input');
  101. checkbox.type = 'checkbox';
  102. checkbox.className = 'comment-checkbox';
  103. button.parentNode.insertBefore(checkbox, button);
  104. checkbox.addEventListener('change', function () {
  105. updateDeleteButtonState();
  106. });
  107. checkbox.addEventListener('mouseover', function (event) {
  108. handleCheckboxMouseover(event, checkbox);
  109. });
  110. }
  111. }
  112. });
  113. if (!document.querySelector('.delete-all-button')) {
  114. var deleteAllButton = document.createElement('button');
  115. deleteAllButton.textContent = 'Delete Selected Comments';
  116. deleteAllButton.className = 'delete-all-button';
  117. deleteAllButton.disabled = true;
  118. deleteAllButton.addEventListener('click', function () {
  119. deleteSelectedComments();
  120. });
  121. if (deleteButtons.length > 0) {
  122. deleteButtons[0].parentNode.parentNode.insertBefore(deleteAllButton, deleteButtons[0].parentNode);
  123. }
  124. }
  125. if (!document.querySelector('.select-all-button')) {
  126. var selectAllButton = document.createElement('button');
  127. selectAllButton.textContent = 'Select All';
  128. selectAllButton.className = 'select-all-button';
  129. selectAllButton.addEventListener('click', function () {
  130. selectAllCheckboxes();
  131. });
  132. if (deleteButtons.length > 0) {
  133. deleteButtons[0].parentNode.parentNode.insertBefore(selectAllButton, deleteButtons[0].parentNode);
  134. }
  135. }
  136. if (!document.querySelector('.clear-all-button')) {
  137. var clearAllButton = document.createElement('button');
  138. clearAllButton.textContent = 'Clear All';
  139. clearAllButton.className = 'clear-all-button';
  140. clearAllButton.addEventListener('click', function () {
  141. clearAllCheckboxes();
  142. });
  143. if (deleteButtons.length > 0) {
  144. deleteButtons[0].parentNode.parentNode.insertBefore(clearAllButton, deleteButtons[0].parentNode);
  145. }
  146. }
  147. }
  148. function updateDeleteButtonState() {
  149. var deleteAllButton = document.querySelector('.delete-all-button');
  150. var checkboxes = document.querySelectorAll('.comment-checkbox');
  151. var anyChecked = Array.from(checkboxes).some(function (checkbox) {
  152. return checkbox.checked;
  153. });
  154. if (deleteAllButton) {
  155. if (anyChecked) {
  156. deleteAllButton.removeAttribute('disabled');
  157. } else {
  158. deleteAllButton.setAttribute('disabled', 'disabled');
  159. }
  160. }
  161. }
  162. function deleteSelectedComments() {
  163. var checkboxes = document.querySelectorAll('.comment-checkbox');
  164. checkboxes.forEach(function (checkbox) {
  165. if (checkbox.checked) {
  166. var deleteButton = checkbox.nextElementSibling;
  167. deleteButton.click();
  168. }
  169. });
  170. }
  171. function selectAllCheckboxes() {
  172. var checkboxes = document.querySelectorAll('.comment-checkbox');
  173. checkboxes.forEach(function (checkbox) {
  174. checkbox.checked = true;
  175. });
  176. updateDeleteButtonState();
  177. }
  178. function clearAllCheckboxes() {
  179. var checkboxes = document.querySelectorAll('.comment-checkbox');
  180. checkboxes.forEach(function (checkbox) {
  181. checkbox.checked = false;
  182. });
  183. updateDeleteButtonState();
  184. }
  185. function handleCheckboxMouseover(event, currentCheckbox) {
  186. if (currentCheckbox.checked) {
  187. currentCheckbox.checked = false;
  188. } else {
  189. currentCheckbox.checked = true;
  190. }
  191. }
  192. window.addEventListener('load', function () {
  193. addButtons();
  194. });
  195. document.addEventListener('DOMSubtreeModified', function () {
  196. updateDeleteButtonState();
  197. addButtons();
  198. });
  199. var buttonStyles = document.createElement('style');
  200. buttonStyles.textContent = `
  201. .delete-all-button, .select-all-button, .clear-all-button {
  202. position: fixed;
  203. top: 50%;
  204. right: 20px;
  205. transform: translateY(-50%);
  206. background-color: red;
  207. color: white;
  208. padding: 10px 20px;
  209. border: none;
  210. border-radius: 5px;
  211. cursor: pointer;
  212. z-index: 9999;
  213. margin-bottom: 10px;
  214. font-weight: bold;
  215. }
  216. .delete-all-button:hover, .select-all-button:hover, .clear-all-button:hover {
  217. background-color: #777;
  218. }
  219. .select-all-button {
  220. top: 40%;
  221. background-color: #1988FF;
  222. font-weight: bold;
  223. }
  224. .clear-all-button {
  225. top: 60%;
  226. background-color: #1DA044;
  227. font-weight: bold;
  228. }
  229. `;
  230. document.head.appendChild(buttonStyles);
  231. var checkboxStyles = document.createElement('style');
  232. checkboxStyles.textContent = `
  233. .comment-checkbox {
  234. -webkit-appearance: none;
  235. -moz-appearance: none;
  236. appearance: none;
  237. width: 24px;
  238. height: 24px;
  239. border: 3px solid #ccc;
  240. border-radius: 5px;
  241. cursor: pointer;
  242. float: right;
  243. margin-right: -4em;
  244. }
  245.  
  246. .comment-checkbox:checked {
  247. background-color: #007bff;
  248. border-color: #007bff;
  249. }
  250.  
  251. .comment-checkbox:checked::after {
  252. content: '\\2713';
  253. font-size: 18px;
  254. color: white;
  255. margin-left: 4px;
  256. }
  257. .comment-checkbox:hover {
  258. background-color: #007bff;
  259. }
  260. `;
  261. document.head.appendChild(checkboxStyles);
  262. })();