summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-03-04 17:49:37 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-03-04 17:49:37 +0100
commitbc5e0d40113ff12fac9d460e264ec620d3b04735 (patch)
treefe1392cfb853dd9c5077477c582c721b9b3f21c1 /js
parenta76caf717fd2c60f30bc62baa2522a16e4467268 (diff)
downloadsite-bc5e0d40113ff12fac9d460e264ec620d3b04735.tar.gz
Select home when hash is not given.
Diffstat (limited to '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';
+ }
})();