From 1d2eec7f8042843a41b84118ed40768bd99dd202 Mon Sep 17 00:00:00 2001 From: vita10gy Date: Tue, 3 Sep 2013 18:42:45 -0700 Subject: [PATCH] Feedback when geosearch finds nothing Subtle, but it's driven me crazy in the past where seemingly reasonable searches do nothing and "worked - but found nothing" and "maybe it's just taking a second to work" aren't apparent. --- code/geosearch.js | 6 +++++- style.css | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/code/geosearch.js b/code/geosearch.js index ab67a56c..0a3165c8 100644 --- a/code/geosearch.js +++ b/code/geosearch.js @@ -14,6 +14,7 @@ window.setupGeosearch = function() { $('#geosearchwrapper img').click(function(){ map.locate({setView : true, maxZoom: 13}); }); + $('#geosearch').keyup(function(){$(this).removeClass('search_not_found')}); } window.search = function(search) { @@ -22,7 +23,10 @@ window.search = function(search) { } $.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; if(!b) return true; var southWest = new L.LatLng(b[0], b[2]), diff --git a/style.css b/style.css index 532bc501..c72baec6 100644 --- a/style.css +++ b/style.css @@ -469,6 +469,12 @@ input { margin-bottom: 2px; cursor: pointer; } + +.search_not_found{ + color:red; + font-style: italic; +} + ::-webkit-input-placeholder { font-style: italic; }