X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a56d1036d58d45777d6adeffd5a950519bc70318..35458c009652645972a9167d80aba1c4fdce82cf:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 62d47a3af..91855f823 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -210,7 +210,6 @@ $(document).ready(function () { }); } - initializeSearch(map); initializeBrowse(map, params); initializeNotes(map, params); @@ -249,6 +248,7 @@ $(document).ready(function () { var router = OSM.Router({ "/": OSM.Index(map), + "/search": OSM.Search(map), "/export": OSM.Export(map), "/browse/changesets": OSM.ChangesetList(map), "/browse/:type/:id(/history)": OSM.Browse(map) @@ -257,4 +257,14 @@ $(document).ready(function () { $(document).on("click", "a", function(e) { if (router(this.pathname + this.search + this.hash)) e.preventDefault(); }); + + $("#search_form").on("submit", function(e) { + e.preventDefault(); + router("/search?query=" + encodeURIComponent($("#query").val()) + OSM.formatHash(map)); + }); + + $("#describe_location").on("click", function(e) { + e.preventDefault(); + router("/search?query=" + encodeURIComponent(map.getCenter().lat + "," + map.getCenter().lng)); + }); });