diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index c5532cfc4..55f1f8f1e 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -201,10 +201,6 @@ $(document).ready(function () { e.preventDefault(); }); - if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) { - remoteEditHandler(map.getBounds()); - } - if (OSM.params().edit_help) { $('#editanchor') .removeAttr('title') @@ -284,6 +280,11 @@ $(document).ready(function () { "/changeset/:id": OSM.Browse(map, 'changeset') }); + if (OSM.preferred_editor == "remote" && document.location.pathname == "/edit") { + remoteEditHandler(map.getBounds()); + OSM.router.setCurrentPath("/"); + } + OSM.router.load(); $(document).on("click", "a", function(e) { diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index 200edd266..2f76f2f18 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -167,6 +167,11 @@ OSM.Router = function(map, rts) { router.stateChange(loadState || {}); }; + router.setCurrentPath = function (path) { + currentPath = path; + currentRoute = routes.recognize(currentPath); + }; + map.on('moveend baselayerchange overlaylayerchange', router.updateHash); $(window).on('hashchange', router.hashUpdated);