X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/e9c6e57bcccc2a47bde53670d4effa4a5827a295..d920d94f69de0e6f5d354f58933290fcdf0345de:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 9514fd5f0..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) { @@ -256,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(); @@ -263,7 +270,7 @@ $(document).ready(function () { $(".search_form").on("submit", function(e) { e.preventDefault(); - $("#header").addClass("closed"); + $("header").addClass("closed"); var query = $(this).find("input[name=query]").val(); if (query) { OSM.route("/search?query=" + encodeURIComponent(query) + OSM.formatHash(map));