Reformat js:

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