summaryrefslogtreecommitdiff
path: root/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/main.js')
-rw-r--r--js/main.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/js/main.js b/js/main.js
index 5e6816e..8f96057 100644
--- a/js/main.js
+++ b/js/main.js
@@ -29,11 +29,15 @@
addEventListener('hashchange', function(ev) {
var m = /#\/(.+)/.exec(ev.newURL);
- if (!m)
- return;
- selectPage(m[1]);
+ if (m) {
+ selectPage(m[1]);
+ } else if (!/#/.test(ev.newURL)) {
+ location.hash = '#/home';
+ }
});
// Tries to load the current page, falling back to "home" for unknown URLs.
- selectPage(location.hash.replace(/^#\//, '')) || selectPage('home');
+ if (!selectPage(location.hash.replace(/^#\//, ''))) {
+ location.hash = '#/home';
+ }
})();