X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a4e514033df5fbe3f494d757892589772a690cce..9e2841ad446ef333178c6b4f695fc927669ff643:/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){