From: Dirk Koopman Date: Wed, 9 Dec 2015 23:44:13 +0000 (+0000) Subject: display speeds in mph rather than m/s X-Git-Url: http://scm.dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6dfcac9f39721c08bf81c82847d872d46f28f19c;p=dweather.git display speeds in mph rather than m/s --- 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