Permalinks for directions
This commit is contained in:
parent
2b252e8337
commit
f2bf38606e
14 changed files with 244 additions and 208 deletions
|
@ -121,6 +121,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));
|
||||
|
@ -129,7 +133,7 @@ OSM.Router = function(map, rts) {
|
|||
}
|
||||
};
|
||||
} else {
|
||||
router.route = function (url) {
|
||||
router.route = router.replace = function (url) {
|
||||
window.location.assign(url);
|
||||
};
|
||||
|
||||
|
@ -174,9 +178,6 @@ OSM.Router = function(map, rts) {
|
|||
|
||||
map.on('moveend baselayerchange overlaylayerchange', router.updateHash);
|
||||
$(window).on('hashchange', router.hashUpdated);
|
||||
$(window).on('unload', function(e) {
|
||||
$(".query_wrapper.routing input").val("");
|
||||
});
|
||||
|
||||
return router;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue