Greasy Fork is available in English.

Add Link To Expand YouTube Community Comments

Add a link to expand YouTube Community comment contents and replies

  1. // ==UserScript==
  2. // @name Add Link To Expand YouTube Community Comments
  3. // @version 1.1
  4. // @namespace AddLinkToExpandYouTubeCommunityComments
  5. // @description Add a link to expand YouTube Community comment contents and replies
  6. // @author jcunews
  7. // @include https://www.youtube.com/comments*
  8. // ==/UserScript==
  9.  
  10. function expandCommentsInPage() {
  11. var i, eles = document.querySelectorAll('#yt-comments-list .comment-entry'), ele;
  12. for (i = eles.length-1; i >= 0; i--) {
  13. ele = eles[i].querySelector(".expand");
  14. if (ele) {
  15. eles[i].click();
  16. }
  17. ele = eles[i].querySelector(".show-more");
  18. if (ele) {
  19. eles[i].click();
  20. }
  21. }
  22. }
  23.  
  24. var btn = document.createElement("A");
  25. btn.textContent = "Expand All Comments";
  26. btn.style = "margin-left:2ex";
  27. btn.href="javascript:void(0)";
  28. btn.onclick = expandCommentsInPage;
  29. document.querySelector("#ytch-root .tabs-container").appendChild(btn);