comments: collapse.js refactoring

* Export collpase toggle functions as module.

Signed-off-by: Adrian-Tudor Panescu <adrian.tudor.panescu@cern.ch>