}
};
- var currentPath = window.location.pathname.replace(/\/$/, "") + window.location.search,
+ var currentPath = window.location.pathname.replace(/(.)\/$/, '$1') + window.location.search,
currentRoute = routes.recognize(currentPath),
currentHash = location.hash || OSM.formatHash(map);
};
router.load = function() {
- var loadState = currentRoute.run('load', currentPath);
- router.stateChange(loadState || {});
+ if (currentRoute) {
+ var loadState = currentRoute.run('load', currentPath);
+ router.stateChange(loadState || {});
+ } else {
+ console.log("Unable to match route for: " + currentPath);
+ }
};
map.on('moveend baselayerchange overlaylayerchange', router.updateHash);