From 762af3089b0bb8c7597ba9883a0a3dfbd66b1698 Mon Sep 17 00:00:00 2001 From: moonpen Date: Tue, 5 Jan 2021 23:03:38 +1000 Subject: [PATCH] Added enter key listener A bit ghetto without reworking some of the JS --- iFakeLocation/Resources/main.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/iFakeLocation/Resources/main.html b/iFakeLocation/Resources/main.html index 1c3a878..79cc320 100644 --- a/iFakeLocation/Resources/main.html +++ b/iFakeLocation/Resources/main.html @@ -42,7 +42,7 @@

iFakeLocation

Click and drag to move the map. Use the mouse wheel or +/- buttons to zoom. Double-click anywhere (or drag the existing marker) to manually select a location.

-
+
@@ -321,6 +321,16 @@ // Handle search button $('#search').click(function() { + searchLocation(); + }); + + // Handle Enter Key in search field + document.getElementById('locationSearch').addEventListener('submit', function(e) { + e.preventDefault(); //to prevent form submission + searchLocation(); + }); + + function searchLocation(){ if (!$('#query').val()) return; $('#search').attr('disabled', true); @@ -336,7 +346,7 @@ $('#set-location').removeAttr('disabled'); } }); - }); + } // Disable double-click zooming map.doubleClickZoom.disable(); @@ -357,4 +367,4 @@ }); - \ No newline at end of file +