User Script to Auto-Expand Threads on Discussion Boards

Code-with-Ski
Community Coach
Community Coach
3
381

This is a user script to automatically click the expand threads button when going to a discussion board.  It will also click the expand threads button when going to a new page of replies.

To use the user script, you will need to use a tool for loading user scripts (such as TamperMonkey Chrome Web Store Listing) or add it as a part of the theme in your Canvas environment (if you are an Account Admin).  If using a tool for loading user scripts, be sure to update the @match web address (as needed) on line 7 in the header comment.  Users using the Canvas hosted domain name shouldn't need to make any adjustments.  The Auto-Click Expand Threads Raw Source Code will need to be installed for use with your tool for user scripts or added to your JavaScript Canvas theme file.

This user script is part of the Code with Ski User Scripts Repository.  It is recommended to review and test the code before using it.  Be sure to check with your school administration/IT staff before using any user scripts in case they have security and/or review guidelines that must be followed before use.

3 Comments
James
Community Champion

I love mutation observers :). This meets a definite need: it's much more difficult for students to find new replies with the new discussions.

Code-with-Ski
Community Coach
Community Coach
Author

@James Thank you for introducing me to mutation observers with the code you have shared!  It helped me learn about this JavaScript feature and got me started on using it rather than an older script example I saw using timeouts to keep checking.

I participated in the new survey and ranked this as one of the most important features to prioritize.  I'm hoping to see it released as an official feature in the near feature.  In the meantime, I hope this code can help others looking for replies to be expanded by default.

dspiel
Community Participant

Thanks for sharing. It amazes me at the great resources the community has created since Instructure won't design a product that users need. I've written twice over the last year that they need to get rid of the pages as students rarely go to pages 2 or 3 of a discussion and only read the first page. It needs to be a running list like it used to be.