From a13c2f854071a363f27ffc393b9b5b91383b9e43 Mon Sep 17 00:00:00 2001 From: ddeitterick Date: Wed, 16 Jul 2014 21:42:02 -0400 Subject: [PATCH 1/3] Add Distance to Table Info Add distance to table if site coordinates are provided and sort the table by distance. If coordinates aren't provided, the column isn't displayed. --- public_html/script.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/public_html/script.js b/public_html/script.js index 05d29b7..062bba0 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -399,11 +399,16 @@ function refreshTableInfo() { 'align="right">Altitude'; html += 'Speed'; - html += 'Distance'; + } + html += 'Track'; - html += 'Msgs'; - html += 'Seen'; for (var tablep in Planes) { var tableplane = Planes[tablep] @@ -447,6 +452,25 @@ function refreshTableInfo() { html += '' + tableplane.altitude + ''; html += '' + tableplane.speed + ''; } + // Add distance column to table if site coordinates are provided + if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) { + html += ''; + if (tableplane.vPosition) { + var siteLatLon = new google.maps.LatLng(SiteLat, SiteLon); + var planeLatLon = new google.maps.LatLng(tableplane.latitude, tableplane.longitude); + var dist = google.maps.geometry.spherical.computeDistanceBetween (siteLatLon, planeLatLon); + if (Metric) { + dist /= 1000; + } else { + dist /= 1852; + } + dist = (Math.round((dist)*10)/10).toFixed(1); + html += dist; + } else { + html += '0'; + } + html += ''; + } html += ''; if (tableplane.vTrack) { @@ -499,6 +523,8 @@ function sortTable(szTableID,iCol) { if (typeof iCol==='undefined'){ if(iSortCol!=-1){ var iCol=iSortCol; + } else if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) { + var iCol=5; } else { var iCol=iDefaultSortCol; } From f933ed2723bb47e54b6e1b264c7f9c661929ab3d Mon Sep 17 00:00:00 2001 From: ddeitterick Date: Wed, 16 Jul 2014 21:51:41 -0400 Subject: [PATCH 2/3] Center "Distance from Site" for Selected Plane Center "Distance from Site" under "Lat/Long" for selected plane. --- public_html/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public_html/script.js b/public_html/script.js index 05d29b7..4e1ed2d 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -326,12 +326,12 @@ function refreshSelected() { dist /= 1852; } dist = (Math.round((dist)*10)/10).toFixed(1); - html += 'Distance from Site: ' + dist + + html += 'Distance from Site: ' + dist + (Metric ? ' km' : ' NM') + ''; } // End of SiteShow } else { if (SiteShow) { - html += 'Distance from Site: n/a ' + + html += 'Distance from Site: n/a ' + (Metric ? ' km' : ' NM') + ''; } else { html += 'n/a'; From e5fddba1824879160e67ebc4150a9d61df8e1405 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Sun, 10 Aug 2014 00:01:31 -0700 Subject: [PATCH 3/3] Add flightradar24.com link --- public_html/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public_html/script.js b/public_html/script.js index 05d29b7..fa81925 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -263,6 +263,7 @@ function refreshSelected() { } else if (selected && selected.squawk == 7700) { // General Emergency html += '  Squawking: General Emergency '; } else if (selected && selected.flight != '') { + html += ' [FR24]'; html += ' [FlightStats]'; }