Fixed E/W and altitude conversionFixed comment spelling error

master
Keith Irwin 2018-10-04 00:30:08 +00:00
parent c14553940e
commit c10ee9e061
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 6 additions and 5 deletions

View File

@ -11,7 +11,7 @@ if (!navigator.geolocation) $('#no-gps').show()
// Start tracking // Start tracking
else navigator.geolocation.watchPosition( else navigator.geolocation.watchPosition(
// Got location callback // Got location callbackw
function(pos) { function(pos) {
let lat = pos.coords.latitude.toFixed(4) let lat = pos.coords.latitude.toFixed(4)
let lon = pos.coords.longitude.toFixed(4) let lon = pos.coords.longitude.toFixed(4)
@ -21,16 +21,17 @@ else navigator.geolocation.watchPosition(
) )
$('#lon').text( $('#lon').text(
(lon.substring(0,1)=='-')? // Negative values are East (lon.substring(0,1)=='-')? // Negative values are East
lon.substring(1)+' E' : lon+' W' lon.substring(1)+' W' : lon+' E'
) )
// Get altitude // Get altitude
if (pos.coords.altitude) if (pos.coords.altitude) {
$('#alt').show().text( $('#alt').show().text(
(metric)? // Convert to feet if needed (metric)? // Convert to feet if needed
pos.coords.altitude.toFixed(1)+' m': pos.coords.altitude.toFixed(1)+' m':
(pos.coords.altitude*0.3048).toFixed(1)+' ft' (pos.coords.altitude*3.28084).toFixed(1)+' ft'
) )
}
else $('#alt').hide() else $('#alt').hide()
}, },