X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/58a0184fc00ad85103367fe9877ab5af3a9aeb03..091818da5d4619e02f3093cff6ac9ca31f0ea84e:/app/assets/javascripts/index/directions.js?ds=inline diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 1a3e0d4ec..8a80328cc 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -40,7 +40,8 @@ OSM.Directions = function (map) { shadowUrl: OSM.MARKER_SHADOW, shadowSize: [41, 41] }), - draggable: true + draggable: true, + autoPan: true }); endpoint.marker.on('drag dragend', function (e) { @@ -53,6 +54,10 @@ OSM.Directions = function (map) { } }); + input.on("keydown", function() { + input.removeClass("error"); + }); + input.on("change", function (e) { awaitingGeocode = true; @@ -64,6 +69,7 @@ OSM.Directions = function (map) { endpoint.setValue = function(value, latlng) { endpoint.value = value; delete endpoint.latlng; + input.removeClass("error"); input.val(value); if (latlng) { @@ -86,7 +92,8 @@ OSM.Directions = function (map) { endpoint.awaitingGeocode = false; endpoint.hasGeocode = true; if (json.length === 0) { - alert(I18n.t('javascripts.directions.errors.no_place')); + input.addClass("error"); + alert(I18n.t('javascripts.directions.errors.no_place', {place: endpoint.value})); return; }