🏠 Home 

Youtube toggle comments

Makes to Youtube comments click to view rather than always showing them or hiding them


Install this script?
  1. // ==UserScript==
  2. // @name Youtube toggle comments
  3. // @description Makes to Youtube comments click to view rather than always showing them or hiding them
  4. // @author Lewis Aron Milne
  5. // @include http://www.youtube.com/watch*
  6. // @include https://www.youtube.com/watch*
  7. // @include http://youtube.com/watch*
  8. // @include https://youtube.com/watch*
  9. // @run-at document-end
  10. // @grant none
  11. // @version 0.0.1.20150228222421
  12. // @namespace https://greasyfork.org/users/7439
  13. // ==/UserScript==
  14. (function () {
  15. var comments = document.getElementById("watch-discussion");
  16. var toggleLoc = document.getElementById("watch8-secondary-actions");
  17. var toggleDiv = document.createElement("div");
  18. toggleDiv.style.textAlign = "center";
  19. toggleDiv.innerHTML = "<button id='toggleBtn' class='yt-uix-button yt-uix-button-default'> Show Comments </button>";
  20. comments.parentNode.insertBefore(toggleDiv, comments);
  21. comments.style.display = "none";
  22. var toggleBtn = document.getElementById("toggleBtn");
  23. toggleBtn.onclick = function() {
  24. if (comments.style.display !== "none") {
  25. comments.style.display = "none";
  26. toggleBtn.innerHTML = "Show Comments";
  27. }
  28. else {
  29. comments.style.display = "";
  30. toggleBtn.innerHTML = "Hide Comments";
  31. }
  32. }
  33. }) ();