X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c4d9f902d0bf8bec7a43409001abec00074e2243..7e3ca66fffec0b44efe676760650994b719609e1:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 7d47057b8..0ceb015a7 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -1,3 +1,7 @@ +//= require index/browse +//= require index/export +//= require index/key + $(document).ready(function () { var marker; var params = OSM.mapParams(); @@ -122,8 +126,22 @@ $(document).ready(function () { $("#exportanchor").click(); } - var query; - if (query = getArgs(window.location.toString()).query) { - doSearch(query); + $("#search_form").submit(function () { + var extent = unproj(map.getExtent()); + + $("#sidebar_title").html(I18n.t('site.sidebar.search_results')); + $("#sidebar_content").load($(this).attr("action"), { + query: $("#query").val(), + minlon: extent.left, + minlat: extent.bottom, + maxlon: extent.right, + maxlat: extent.top + }, openSidebar); + + return false; + }); + + if ($("#query").val()) { + $("#search_form").submit(); } });