rhysbrettbowen/PlastronJS — pull request #14 by Just-MadDEN (2012-09-06 11:35:37+00:00)
Title: Routing improvements

I've made some improvements while was trying to apply routing system:

1) When user changes hash value in address bar in Chrome, browser emits "popstate" and "hashchange" events with the same hash value, so router.onChange_ handler runs twice. Added router.currentFragment check to prevent this.
2) Firefox doesn't emit "popstate" event at page load, so if address already contains any hash, it is not routed after adding routers. Added current fragment check when adding router.
3) If main route task is not to render page content, but to show a popup window on a specified hash value (like login popup) it is necessary to hide this popup when route changes. So, I added "route expired" event to router, to catch route change.