X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6b09732854d0efa94b5211000afe3226e1f61da0..83d97699ccde00436a5f08a9e35e1bc1cd26f2e3:/app/assets/javascripts/router.js diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index dcf8ea6a8..0f37e32f1 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -86,7 +86,7 @@ OSM.Router = function(map, rts) { var routes = []; for (var r in rts) - routes.push(Route(r, rts[r])); + routes.push(new Route(r, rts[r])); routes.recognize = function(path) { for (var i = 0; i < this.length; i++) { @@ -127,6 +127,10 @@ OSM.Router = function(map, rts) { return true; }; + router.replace = function (url) { + window.history.replaceState(OSM.parseHash(url), document.title, url); + }; + router.stateChange = function(state) { if (state.center) { window.history.replaceState(state, document.title, OSM.formatHash(state)); @@ -135,7 +139,7 @@ OSM.Router = function(map, rts) { } }; } else { - router.route = function (url) { + router.route = router.replace = function (url) { window.location.assign(url); };