Yes. This function is taken from https://github.com/edx/django-wiki/blob/master/wiki/static/wiki/js/diff.js. I have just cleaned it up a bit and added a few lines to toggleClass('collapsed') and do focus() at the appropriate places.