Make Preferences dialog smaller.

Fix JSHint warnings/errors.
#269
Put HTML in own template file.