Add today to forecast tab

Skylar Ittner 4 years ago
parent f9916d8464
commit 4513b4d824

@ -191,12 +191,12 @@ function loadWeather(reload) {
// //
forecastItems = []; forecastItems = [];
for (var i = 1; i < resp.forecast.length; i++) { for (var i = 0; i < resp.forecast.length; i++) {
var low = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.min)) : Math.round(resp.forecast[i].temp.min)); var low = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.min)) : Math.round(resp.forecast[i].temp.min));
var high = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.max)) + " &deg;C" : Math.round(resp.forecast[i].temp.max) + " &deg;F"); var high = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.max)) + " &deg;C" : Math.round(resp.forecast[i].temp.max) + " &deg;F");
var precipcolor = precipChanceToColor(resp.forecast[i].precipitation.chance); var precipcolor = precipChanceToColor(resp.forecast[i].precipitation.chance);
forecastItems.push({ forecastItems.push({
day: formatTimestamp('l', resp.forecast[i].date), day: (i == 0 ? "Today" : formatTimestamp('l', resp.forecast[i].date)),
temps: low + " to " + high, temps: low + " to " + high,
uv_index: resp.forecast[i].uv_index, uv_index: resp.forecast[i].uv_index,
uv_color: uvIndexToColor(resp.forecast[i].uv_index), uv_color: uvIndexToColor(resp.forecast[i].uv_index),
@ -253,20 +253,20 @@ function loadWeather(reload) {
$("#app").on("click", "#weather-forecast .forecast-uv-badge", function () { $("#app").on("click", "#weather-forecast .forecast-uv-badge", function () {
app.toast.show({ app.toast.show({
text: "<i class='fas fa-info-circle'></i> UV index", text: "<i class='fas fa-info-circle'></i> UV index",
position: "bottom", position: "bottom",
destroyOnClose: true, destroyOnClose: true,
closeTimeout: 1000 * 3 closeTimeout: 1000 * 3
}); });
}); });
$("#app").on("click", "#weather-forecast .forecast-precip-badge", function () { $("#app").on("click", "#weather-forecast .forecast-precip-badge", function () {
app.toast.show({ app.toast.show({
text: "<i class='fas fa-info-circle'></i> Chance of precipitation", text: "<i class='fas fa-info-circle'></i> Chance of precipitation",
position: "bottom", position: "bottom",
destroyOnClose: true, destroyOnClose: true,
closeTimeout: 1000 * 3 closeTimeout: 1000 * 3
}); });
}); });
function uvIndexToColor(index) { function uvIndexToColor(index) {

Loading…
Cancel
Save