From 1df8bbfb327d8022a34cd2158853ad7e13d1a01e Mon Sep 17 00:00:00 2001 From: mtmail Date: Wed, 10 Feb 2021 15:04:19 +0100 Subject: [PATCH] split latitude value if copy&pasted as pair (#62) --- src/components/ReverseBar.svelte | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/ReverseBar.svelte b/src/components/ReverseBar.svelte index a045a82..c7f081d 100644 --- a/src/components/ReverseBar.svelte +++ b/src/components/ReverseBar.svelte @@ -23,6 +23,16 @@ document.querySelector('input[name=lon]').value = lat; document.querySelector('form').submit(); } + + // common mistake is to copy&paste latitude and longitude into the 'lat' search box + function maybeSplitLatitude(e) { + var coords_split = e.target.value.split(','); + if (coords_split.length === 2) { + document.querySelector('input[name=lat]').value = L.Util.trim(coords_split[0]); + document.querySelector('input[name=lon]').value = L.Util.trim(coords_split[1]); + } + } +
@@ -35,7 +45,8 @@ type="text" class="form-control form-control-sm" placeholder="latitude" - value="{api_request_params.lat || ''}" /> + value="{api_request_params.lat || ''}" + on:change={maybeSplitLatitude} />