reddit comments expand

when you've collapsed a lot of comment threads on a reddit thread and don't want to expand them all one by one

  1. // ==UserScript==
  2. // @name reddit comments expand
  3. // @namespace http://old.reddit.com/
  4. // @version 1.6
  5. // @description when you've collapsed a lot of comment threads on a reddit thread and don't want to expand them all one by one
  6. // @author Antonio Lima
  7. // @match http://old.reddit.com/r/*/comments/*
  8. // @match https://old.reddit.com/r/*/comments/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. $('#siteTable .flat-list').append('<li><a href="#" id="expander">expand all comments</a></li>');
  13.  
  14. $('#expander').click(function(e){
  15. if($('.comment').hasClass("collapsed")) {
  16. $('.comment').removeClass("collapsed");
  17. $('.comment').addClass("noncollapsed");
  18. $('.expand').html("[–]");
  19. }
  20. //hides back deleted comments and comments with score below threshold
  21. $('.collapsed-for-reason').removeClass("noncollapsed");
  22. $('.collapsed-for-reason').addClass("collapsed");
  23. $('.deleted').removeClass("noncollapsed");
  24. $('.deleted').addClass("collapsed");
  25. //prevents jump to the top of the page
  26. e.preventDefault();
  27. });