X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/d9fe25ac2e1aa93c7ce3de574556739d52b4486c..f8e1d392085fe5319dce03957874d9efddd9fc54:/website/js/nominatim-ui.js diff --git a/website/js/nominatim-ui.js b/website/js/nominatim-ui.js index d631e7aa..72c1b3b0 100644 --- a/website/js/nominatim-ui.js +++ b/website/js/nominatim-ui.js @@ -20,11 +20,37 @@ function parse_and_normalize_geojson_string(raw_string){ jQuery(document).ready(function(){ if ( !$('#search-page,#reverse-page').length ){ return; } - + var is_reverse_search = !!( $('#reverse-page').length ); $('#q').focus(); + $(document).ready(function() { + $("input[name='query-selector']").click(function(){ + var query_val = $("input[name='query-selector']:checked").val() ; + if (query_val == "simple") { + $("div.form-group-structured").hide(); + $("div.form-group-simple").show(); + $("div.form-group-structured .form-control").prop('disabled', true); + $("div.form-group-simple .form-control").prop('disabled', false); + $('.form-group-structured').find('input:text').val(''); + } + else if (query_val == "structured") { + $("div.form-group-simple").hide(); + $("div.form-group-structured").show(); + $("div.form-group-structured .form-control").prop('disabled', false); + $("div.form-group-simple .form-control").prop('disabled', true); + $('.form-group-simple').find('input:text').val(''); + } + }); + + if (nominatim_structured_query) { + $('input#structured').prop('checked', true).trigger('click'); + } else { + $('input#simple').prop('checked', true).trigger('click'); + } + }); + map = new L.map('map', { attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length), scrollWheelZoom: true, // !L.Browser.touch, @@ -185,7 +211,7 @@ jQuery(document).ready(function(){ circle.on('click', function(){ highlight_result(position); }); - layerGroup.addLayer(circle); + layerGroup.addLayer(circle); } if (result.aBoundingBox){