Optimize criteria expansion/collapsing

For issue https://github.com/MarkUsProject/Markus/issues/916.

Instead of doing AJAX calls, do client-side JavaScript to expand/collapse the criteria.