Upgrade to current JSHint

This also allows us to supply a .jshintrc for better IDE & command-line
integration - simply type "jshint" in the directory and it will discover
it. Unfortunately there appears to be a bug where using the
grunt-contrib-jshint jshintrc option will only report the first error
but duplicating the options inline will display all of them…
Remove trailing whitespace

The results of running this command::

    find . -name \*.js -print0 | xargs -0 perl -p -i -e "s|[ \t]+$||"
Remove unused variables

Mostly unused function arguments but there were also a fair number
of legacy names which are now no longer used.

One question which comes up – mostly in tilesource.js – is whether
there is any value in leaving unused variables for functions which
are intended to be overridden anyway. I'm inclined to say that the
docs + tests need to be sufficient as there's no enforcement that
whatever is in the base implementation will actually be followed by
any of the real functions.
Fix lack of braces on if statements

JavaScript's most popular rack in the grass for maintenance coders…
viewer.js: fix typos in variable declarations
referencestrip.js: declare undeclared variable
Replace gnarly ternary expression with if statement