MDL-43504 Course: Include the course/category collapse JS correctly

This was previously only included when there were hidden categories to show
which were not yet visible. As a result, if all categories were visible,
then the JS was not included.