var params = OSM.mapParams();
var map = createMap("map");
+ map.events.register("moveend", map, updateLocation);
+ map.events.register("changelayer", map, updateLocation);
+
if (!params.object_zoom) {
if (params.bbox) {
var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat);
$(window).load(function() { addObjectToMap(url, params.object_zoom) });
}
- map.events.register("moveend", map, updateLocation);
- map.events.register("changelayer", map, updateLocation);
-
- updateLocation();
handleResize();
$("#show_data").click(function (e) {
$("#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();
}
});