diff --git a/js/app.js b/js/app.js index 351cf18..b939590 100644 --- a/js/app.js +++ b/js/app.js @@ -445,6 +445,25 @@ var format_time_friendly = function(start, end) { } }; +var format_coordinates = function(lat, lon, name) { + var coords_text; + var ua = navigator.userAgent.toLowerCase(); + + // determine how to link the coordinates to a native app, if on a mobile device + if(ua.indexOf('iphone') > -1) { + coords_text = '' + + roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +''; + } else if(ua.indexOf('android') > -1) { + coords_text = '' + + roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +''; + } else { + coords_text = '' + + roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +''; + } + + return coords_text; +}; + // runs every second var updateTime = function(date) { // update timebox @@ -553,12 +572,6 @@ $(window).ready(function() { $("#main").removeClass("drag"); }); - // confirm dialog when launchnig a native map app with coordinates - //$('#main').on('click', '#launch_mapapp', function() { - // var answer = confirm("Launch your maps app?"); - // return answer; - //}); - // follow vehicle by clicking on data $('#main').on('click', '.row .data', function() { var e = $(this).parent(); diff --git a/js/station.js b/js/station.js index 3a2f4a5..74f053c 100644 --- a/js/station.js +++ b/js/station.js @@ -179,7 +179,7 @@ function drawHistorical (data, station) { html = "
" +
formatDate(new Date(parseInt(data.time) * 1000), true) + "\n\n" +
@@ -4665,7 +4636,7 @@ function updateRecoveryMarker(recovery) {
html = "";
html += ""+recovery.serial+(recovery.recovered ? " Recovered" : " Not Recovered")+"";
html += "
";
- html += " "+roundNumber(recovery.lat, 5) + ', ' + roundNumber(recovery.lon, 5)+"";
+ html += " "+format_coordinates(recovery.lat, recovery.lon, recovery.serial)+"";
var imp = offline.get('opt_imperial');
var text_alt = Number((imp) ? Math.floor(3.2808399 * parseInt(recovery.alt)) : parseInt(recovery.alt)).toLocaleString("us");
@@ -4777,7 +4748,7 @@ function updateRecoveryPane(r){
html += "";
html += ""+r[i].serial+(r[i].recovered ? " Recovered by " : " Not Recovered by ")+r[i].recovered_by+"";
- html += " "+roundNumber(lat, 5) + ', ' + roundNumber(lon, 5)+"";
+ html += " "+format_coordinates(lat, lon, r[i].serial)+"";
var imp = offline.get('opt_imperial');
var text_alt = Number((imp) ? Math.floor(3.2808399 * parseInt(alt)) : parseInt(alt)).toLocaleString("us");