Merge pull request #534 from vita10gy/search

Feedback when geosearch finds nothing
This commit is contained in:
Jon Atkins 2013-10-27 09:14:37 -07:00
commit 282a33f033
2 changed files with 11 additions and 1 deletions

View File

@ -14,6 +14,7 @@ window.setupGeosearch = function() {
$('#geosearchwrapper img').click(function(){ $('#geosearchwrapper img').click(function(){
map.locate({setView : true, maxZoom: 13}); map.locate({setView : true, maxZoom: 13});
}); });
$('#geosearch').keyup(function(){$(this).removeClass('search_not_found')});
} }
window.search = function(search) { window.search = function(search) {
@ -22,7 +23,10 @@ window.search = function(search) {
} }
$.getJSON(NOMINATIM + encodeURIComponent(search), function(data) { $.getJSON(NOMINATIM + encodeURIComponent(search), function(data) {
if(!data || !data[0]) return true; if(!data || !data[0]) {
$('#geosearch').addClass('search_not_found');
return true;
}
var b = data[0].boundingbox; var b = data[0].boundingbox;
if(!b) return true; if(!b) return true;
var southWest = new L.LatLng(b[0], b[2]), var southWest = new L.LatLng(b[0], b[2]),

View File

@ -471,6 +471,12 @@ input {
margin-bottom: 2px; margin-bottom: 2px;
cursor: pointer; cursor: pointer;
} }
.search_not_found{
color:red;
font-style: italic;
}
::-webkit-input-placeholder { ::-webkit-input-placeholder {
font-style: italic; font-style: italic;
} }