normalize code style.
Fix weird history problems.

Done by just listening for hashchange instead of popstate, and changing
location hash whenever we want to change the current page.

I've personally found history.pushstate/popstate extremely confusing to
debug, and something that works fine in one browser can cause infinite
loops in others, so I'd rather either use hashchange or a third-party
abstraction on top of pushstate that makes things easier.
replace for statements with forEach calls.
combined two trivially nested 'if' statements
remove unused class
Merge pull request #5 from toolness/fix-history-problems

Fix weird history problems