From 6dfcac9f39721c08bf81c82847d872d46f28f19c Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Wed, 9 Dec 2015 23:44:13 +0000 Subject: [PATCH] display speeds in mph rather than m/s --- templates/index.html.ep | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/templates/index.html.ep b/templates/index.html.ep index c8ef3b5..443408d 100644 --- a/templates/index.html.ep +++ b/templates/index.html.ep @@ -30,6 +30,13 @@ var h = new Object(); + var trans = { + "Wind" : function (speed) { return (speed * 2.236936).toFixed(1); }, + "Wind_1m" : function (speed) { return (speed * 2.236936).toFixed(1); }, + "Wind_Max": function (speed) { return (speed * 2.236936).toFixed(1); } + }; + + function do_debug(text) { document.getElementById("do_debug").innerHTML = text; } @@ -41,7 +48,12 @@ function fill_html(key,value) { var d = document.getElementById(key); if (d !== null) { - d.innerHTML = value; + var f = trans[key]; + if (f && typeof(f) === "function") { + d.innerHTML = trans[key](value); + } else { + d.innerHTML = value; + } } } @@ -711,9 +723,9 @@ Humidity: % Dew Point: °C - Wind: ° @ m/s - Wind Minute Avg: ° @ m/s - Day Max Speed: m/s @ + Wind: ° @ mph + Wind Minute Avg: ° @ mph + Day Max Speed: mph @ Rain 30mins: mm -- 2.34.1