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 @@