mirror of
https://github.com/jbowdre/lolz.git
synced 2024-12-22 07:42: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
|
||||
conditions = (res.conditions).toLowerCase();
|
||||
temp = (res.air_temperature)+ "°f ("+(((res.air_temperature-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';
|
||||
tempDiff = Math.abs(res.air_temperature - res.feels_like);
|
||||
temp = `${res.air_temperature}°f (${(((res.air_temperature - 32) * 5) / 9).toFixed(1)}°c)`;
|
||||
if (tempDiff >= 5) {
|
||||
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;
|
||||
pressure = (res.station_pressure).toFixed(2) + 'inhg and ' + pressureTrend;
|
||||
pressure = `${res.station_pressure}inhg and ${pressureTrend}`;
|
||||
icon = res.icon;
|
||||
|
||||
// display data
|
||||
|
|
Loading…
Reference in a new issue