Reformat js:

fix indenting (2 spaces),
spaces around brackets
add semicolons
etc.

Rebased & squashed