X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6ba9f8ba294bb21d53060e92541dc465b9e42c4a..f45437f83622c71468bbfb769fb892f50771b923:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index e83b49947..f1644c06f 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -37,6 +37,7 @@ $.ajax({ url: path, + dataType: "html", complete: function(xhr) { clearTimeout(loaderTimeout); $('#sidebar_loader').hide(); @@ -202,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) { @@ -229,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() { @@ -267,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();