Minor tweaks to JavaScript format.
Add auto-run feature for window-focus.