mirror of
https://github.com/jbowdre/lolz.git
synced 2024-11-22 13:12:19 +00:00
display "feels like" if difference is >= 5
also use template literals (backticks) for better legibility of concatenated strings
This commit is contained in:
parent
00f4327e74
commit
a537fb9fe9
1 changed files with 9 additions and 5 deletions
14
tempest.html
14
tempest.html
|
@ -37,12 +37,16 @@
|
||||||
|
|
||||||
// parse data
|
// parse data
|
||||||
conditions = (res.conditions).toLowerCase();
|
conditions = (res.conditions).toLowerCase();
|
||||||
temp = (res.air_temperature)+ "°f ("+(((res.air_temperature-32)*5)/9).toFixed(1) + "°c)";
|
tempDiff = Math.abs(res.air_temperature - res.feels_like);
|
||||||
humidity = res.relative_humidity + "% humidity";
|
temp = `${res.air_temperature}°f (${(((res.air_temperature - 32) * 5) / 9).toFixed(1)}°c)`;
|
||||||
wind = res.wind_gust + "mph (" + (res.wind_gust*1.609344).toFixed(1)+ "kph) from " + (res.wind_direction_cardinal).toLowerCase();
|
if (tempDiff >= 5) {
|
||||||
precipToday = res.precip_accum_local_day + '" of rain today';
|
temp += `, feels ${res.feels_like}°f (${(((res.feels_like - 32) *5) / 9).toFixed(1)}°c)`;
|
||||||
|
}
|
||||||
|
humidity = `${res.relative_humidity}% humidity`;
|
||||||
|
wind = `${res.wind_gust}mph (${(res.wind_gust*1.609344).toFixed(1)}kph) from ${(res.wind_direction_cardinal).toLowerCase()}`;
|
||||||
|
precipToday = `${res.precip_accum_local_day}" of rain today`;
|
||||||
pressureTrend = res.pressure_trend;
|
pressureTrend = res.pressure_trend;
|
||||||
pressure = (res.station_pressure).toFixed(2) + 'inhg and ' + pressureTrend;
|
pressure = `${res.station_pressure}inhg and ${pressureTrend}`;
|
||||||
icon = res.icon;
|
icon = res.icon;
|
||||||
|
|
||||||
// display data
|
// display data
|
||||||
|
|
Loading…
Reference in a new issue