Consistently use the req object from Express.js

The existing code still manually parsed the URL in the req object, even though
Express.js already does that for us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Start a small JS library file to keep shared functions in

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix the marker position issue

On the map page the marker would occasionally disappear or be in the completely
wrong spot. This was caused by a bug that would potentially reference an
unitialized variable, especially when the car was parked.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add more functions to lib.js and similar functions to visualize.js

This is a fairly big commit, but hard to break into smaller pieces.

First it adds several more functions to lib.js and then uses those in
welcome, map, stats and energy pages. This makes the code more consistent,
easier to read and much more robust regarding query arguments (it now
deals with '-' as well as ' ' and '%20' as separators for date and time in
the query strings, for example).

This adds similar helper functions to visualize.js (it's rather awkward to
share the same helper functions between client side js and node.js on the
server side, so I opted to mostly duplicate the functions - but I also
changed the way they are used a little bit to make them more applicable
for the server side.

visualize.js now redirects the requests for the individual pages to new
request URLs that have all elements of the query arguments filled - this
allows simple consistent parsing everywhere.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix incorrect redirect for map

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix more bugs in maps

This also removes support for the obsolete 'replay' option in visualize.js

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Merge pull request #24 from dirkhh/moreFixes

More fixes