From a37c75bf83208a495056d30cf4ac69f05dc77be2 Mon Sep 17 00:00:00 2001 From: Carlos Salaverria Date: Tue, 30 Aug 2016 16:38:41 -0500 Subject: [PATCH] Show additional data in selected aircraft info block --- public_html/formatter.js | 26 +++++++++++++++++++++----- public_html/index.html | 10 +++++++++- public_html/script.js | 23 ++++++++++++++++------- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/public_html/formatter.js b/public_html/formatter.js index 23a3b70..cf23f4f 100644 --- a/public_html/formatter.js +++ b/public_html/formatter.js @@ -161,15 +161,31 @@ function convert_distance(dist, displayUnits) { // rate in ft/min function format_vert_rate_brief(rate, displayUnits) { - if (rate === null) { + if (rate === null || rate === undefined) { return ""; } - if (displayUnits === "metric") { - return (rate/196.85).toFixed(1); // ft/min to m/s - } else { - return Math.round(rate); + return convert_vert_rate(rate, displayUnits).toFixed(displayUnits === "metric" ? 1 : 0); +} + +// rate in ft/min +function format_vert_rate_long(rate, displayUnits) { + if (rate === null || rate === undefined) { + return "n/a"; } + + var rate_text = convert_vert_rate(rate, displayUnits).toFixed(displayUnits === "metric" ? 1 : 0) + NBSP + get_unit_label("verticalRate", displayUnits); + + return rate_text; +} + +// rate in ft/min +function convert_vert_rate(rate, displayUnits) { + if (displayUnits === "metric") { + return (rate / 196.85); // ft/min to m/s + } + + return rate; } // p is a [lon, lat] coordinate diff --git a/public_html/index.html b/public_html/index.html index f4e0794..a135e9d 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -70,7 +70,7 @@ - [FlightAware] + @@ -88,6 +88,11 @@ RSSI: n/a + + Vertical rate: n/a + Messages: n/a + + Track: n/a Last seen: n/a @@ -100,6 +105,9 @@ Distance from Site: n/a + + +