]> git.openstreetmap.org Git - nominatim.git/commitdiff
UI: allow copy&pasting lat,lon into the lat search field
authormarc tobias <mtmail@gmx.net>
Sat, 21 Oct 2017 12:11:46 +0000 (14:11 +0200)
committermarc tobias <mtmail@gmx.net>
Sat, 21 Oct 2017 12:11:46 +0000 (14:11 +0200)
lib/template/address-html.php
website/js/nominatim-ui.js

index db735477147e5fef7f01c8b47692c3e229610e74..621c9773e758113fbbaa6a038fa43d3b65b16520 100644 (file)
@@ -15,7 +15,7 @@
             <input name="format" type="hidden" value="html">
             lat
             <input name="lat" type="text" class="form-control input-sm" placeholder="latitude" value="<?php echo $fLat; ?>" >
-            <span id="switch-coords" title="switch lat and lon">&lt;&gt;</span>
+            <button class="btn btn-default btn-xs" id="switch-coords" title="switch lat and lon">&lt;&gt;</button>
             lon
             <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo $fLon; ?>" >
             max zoom
index 0560b45ff3b4625930e2baa94cc54738af0dacab..956feae699f03dfc19e71a004211965030d30f69 100644 (file)
@@ -248,6 +248,14 @@ jQuery(document).on('ready', function(){
 
     highlight_result(0, false);
 
+    // common mistake is to copy&paste latitude and longitude into the 'lat' search box
+    $('form input[name=lat]').on('change', function(){
+        var coords = $(this).val().split(',');
+        if (coords.length == 2) {
+            $(this).val(coords[0]);
+            $(this).siblings('input[name=lon]').val(coords[1]);
+        }
+    });
 
 });