X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7b10012f90fa8772032ebf076a2db599cba185ff..b92cb5b7729287d0256bbe915bfb99ef27d7b940:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index d612b2778..f1644c06f 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -203,6 +203,11 @@ $(document).ready(function () { map.invalidateSize({pan: false}) .panBy([-300, 0], {animate: false}); OSM.loadSidebarContent(path); + page.load(); + }; + + page.load = function() { + return map.getState(); }; page.popstate = function(path) { @@ -230,19 +235,7 @@ $(document).ready(function () { }; page.load = function(path, type, id) { - if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return; - - map.addObject({type: type, id: parseInt(id)}, - { - zoom: window.location.hash == "", - style: { - color: "#FF6200", - weight: 4, - opacity: 1, - fillOpacity: 0.5 - } - } - ); + map.addObject({type: type, id: parseInt(id)}); }; page.unload = function() { @@ -268,6 +261,8 @@ $(document).ready(function () { "/browse/:type/:id(/history)": OSM.Browse(map) }); + OSM.route.load(); + $(document).on("click", "a", function(e) { if (e.isDefaultPrevented() || e.isPropagationStopped()) return; if (this.host === window.location.host && OSM.route(this.pathname + this.search + this.hash)) e.preventDefault();