2022-02-08 03:27:06 +00:00
|
|
|
var loopssevereweathermode = false;
|
|
|
|
var displayingAtmospheric = false;
|
|
|
|
var miniMap;
|
|
|
|
function Loops() {
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
// init the display loops
|
2022-02-08 03:27:06 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
displayForecast(0);
|
2022-02-08 03:27:06 +00:00
|
|
|
refreshObservationDisplay()
|
|
|
|
setInterval(refreshObservationDisplay,300000);
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
}
|
|
|
|
function refreshObservationDisplay() {
|
|
|
|
var cond = weatherInfo.currentCond.sidebar.cond;
|
|
|
|
$('#city').text(maincitycoords.displayname);
|
|
|
|
$('#forecast-city').text(maincitycoords.displayname + ':');
|
|
|
|
if (weatherInfo.radarTempUnavialable == false) {
|
|
|
|
if (loopssevereweathermode == false){
|
|
|
|
$('#minimap').fadeIn(0)
|
|
|
|
$('#minimap-title').fadeIn(0)
|
2022-03-11 04:03:38 +00:00
|
|
|
miniMap = new Radar("minimap", 3, 7, maincitycoords.lat, maincitycoords.lon);
|
2022-02-08 03:27:06 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$('#minimap').fadeOut(0)
|
|
|
|
$('#minimap-title').fadeOut(0)
|
|
|
|
}
|
|
|
|
if (weatherInfo.currentCond.sidebar.noReport == true) {
|
|
|
|
$('#now').fadeOut(0)
|
|
|
|
$('#current-temp').fadeOut(0)
|
|
|
|
$('#current-info').fadeOut(0)
|
|
|
|
$('#conditions-icon').fadeOut(0)
|
|
|
|
$('#current-info-severe').fadeOut(0)
|
|
|
|
$('#current-info-details').fadeOut(0)
|
|
|
|
$('#current-noreport').fadeIn(0)
|
|
|
|
} else {
|
|
|
|
if (displayingAtmospheric == false) {
|
|
|
|
if (loopssevereweathermode == false) { displayAtmospheric(0) } else { displaySevereAtmospheric(0) }
|
|
|
|
}
|
|
|
|
$('#now').fadeIn(0)
|
|
|
|
$('#current-temp').fadeIn(0)
|
|
|
|
if (loopssevereweathermode == false) { $('#current-info').fadeIn(0) } else {
|
|
|
|
$('#current-info-severe').fadeIn(0);
|
|
|
|
$('#current-info-details').fadeIn(0);
|
|
|
|
}
|
|
|
|
$('#current-noreport').fadeOut(0)
|
|
|
|
$('#conditions-icon').fadeIn(0)
|
|
|
|
$('#current-temp').text( weatherInfo.currentCond.sidebar.temp ) ;
|
|
|
|
$('#conditions-icon').css('background-image', 'url("' + getCCicon(+weatherInfo.currentCond.sidebar.icon, weatherInfo.currentCond.sidebar.windspeed) + '")');
|
|
|
|
}
|
|
|
|
}
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
|
|
|
|
function displayAtmospheric(idx) {
|
|
|
|
if (weatherInfo.currentCond.sidebar.noReport == false){
|
|
|
|
displayingAtmospheric = true;
|
2021-03-23 18:02:42 +00:00
|
|
|
var displays = {
|
2021-08-24 23:10:16 +00:00
|
|
|
conditions() {
|
2022-02-08 03:27:06 +00:00
|
|
|
return (weatherInfo.currentCond.sidebar.cond).toLowerCase();
|
2021-08-24 23:10:16 +00:00
|
|
|
},
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
wind(){ return 'wind ' + weatherInfo.currentCond.sidebar.wind; },
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2021-03-23 18:02:42 +00:00
|
|
|
gusts(){
|
2022-02-08 03:27:06 +00:00
|
|
|
if ( weatherInfo.currentCond.sidebar.gust!=undefined ) {
|
|
|
|
return (weatherInfo.currentCond.sidebar.gust!="none") ? 'gusts ' + weatherInfo.currentCond.sidebar.gust : '';
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
humidity(){ return 'humidity ' + weatherInfo.currentCond.sidebar.humid + '%'; },
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
dewpoint(){ return 'dew point ' + weatherInfo.currentCond.sidebar.dewpt + '°'; },
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
heatindex_windchill(){
|
2022-02-08 03:27:06 +00:00
|
|
|
if (weatherInfo.currentCond.sidebar.feelslike.type != "dontdisplay") {
|
|
|
|
return weatherInfo.currentCond.sidebar.feelslike.type + " " + weatherInfo.currentCond.sidebar.feelslike.val + '°'
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
pressure(){ return 'pressure ' + weatherInfo.currentCond.sidebar.pressure + ' ' + weatherInfo.currentCond.sidebar.pressureTrend},
|
|
|
|
|
|
|
|
visibility() { return 'visibility ' + weatherInfo.currentCond.sidebar.visibility + ' mile' + (weatherInfo.currentCond.sidebar.visibility != 1 ? 's' : ''); },
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
uvindex() { return 'UV index ' + weatherInfo.currentCond.sidebar.uvidx; },
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
keys = Object.keys(displays),
|
|
|
|
text = displays[ keys[idx] ]();
|
|
|
|
|
|
|
|
// increment the pointer
|
2022-03-03 23:21:10 +00:00
|
|
|
if (weatherInfo.reboot == true) {
|
|
|
|
$('#forecast-shadow').hide()
|
|
|
|
return;
|
|
|
|
}
|
2022-02-08 03:27:06 +00:00
|
|
|
if (loopssevereweathermode == false) {
|
|
|
|
idx = (++idx===keys.length ? 0 : idx);
|
|
|
|
|
|
|
|
if (text) {
|
|
|
|
$('#current-info').html(text);
|
|
|
|
setTimeout(function(){ displayAtmospheric(idx) }, 6000); // 6 second increment loop
|
|
|
|
} else {
|
|
|
|
// nothing to display - skip to the next one
|
|
|
|
setTimeout(function(){ displayAtmospheric(idx) }, 0);
|
2021-08-24 23:10:16 +00:00
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
}
|
2022-02-08 03:27:06 +00:00
|
|
|
} else {displayingAtmospheric = false}
|
2018-09-08 19:22:46 +00:00
|
|
|
} // end function
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
function displaySevereAtmospheric(idx) {
|
|
|
|
if (weatherInfo.currentCond.sidebar.noReport == false) {
|
|
|
|
displayingAtmospheric = true
|
|
|
|
$('#current-info-severe').text((weatherInfo.currentCond.sidebar.cond).toLowerCase());
|
|
|
|
var displays = {
|
|
|
|
display1() {
|
|
|
|
return 'wind ' + weatherInfo.currentCond.sidebar.wind + '<br>' + ((weatherInfo.currentCond.sidebar.gust!="none") ? 'gusts ' + weatherInfo.currentCond.sidebar.gust + '<br>' : '' ) + 'humidity ' + weatherInfo.currentCond.sidebar.humid + '%' + '<br>' + 'dew point ' + weatherInfo.currentCond.sidebar.dewpt + '°'
|
|
|
|
},
|
|
|
|
display2() {
|
|
|
|
return (((weatherInfo.currentCond.sidebar.feelslike.type != "dontdisplay") ? weatherInfo.currentCond.sidebar.feelslike.type + " " + weatherInfo.currentCond.sidebar.feelslike.val + '°' + '<br>' : '' ) + 'pressure ' + weatherInfo.currentCond.sidebar.pressure + weatherInfo.currentCond.sidebar.pressureTrend + '<br>' + 'visibility ' + weatherInfo.currentCond.sidebar.visibility + ((weatherInfo.currentCond.sidebar.visibility != 1 ) ? ' miles' : ' mile') + '<br>' + 'ceiling ' + ((weatherInfo.currentCond.sidebar.ceiling != null) ? ((weatherInfo.currentCond.sidebar.ceiling).toString() + ' ft') : ''))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
keys = Object.keys(displays),
|
|
|
|
text = displays[ keys[idx] ]();
|
|
|
|
|
|
|
|
idx = (++idx===keys.length ? 0 : idx);
|
2022-03-03 23:21:10 +00:00
|
|
|
if (weatherInfo.reboot == true) {
|
|
|
|
$('#forecast-shadow').hide()
|
|
|
|
return;
|
|
|
|
}
|
2022-02-08 03:27:06 +00:00
|
|
|
if (loopssevereweathermode == true) {
|
|
|
|
if (text) {
|
|
|
|
$('#current-info-details').html(text);
|
|
|
|
setTimeout(function(){ displaySevereAtmospheric(idx) }, 6000); // 6 second increment loop
|
|
|
|
} else {
|
|
|
|
// nothing to display - skip to the next one
|
|
|
|
setTimeout(function(){ displaySevereAtmospheric(idx) }, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {displayingAtmospheric = false}
|
|
|
|
} //end function
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
function displayForecast(idx) {
|
2021-03-23 18:02:42 +00:00
|
|
|
|
|
|
|
var displays = {
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
text1() {
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-header').prop('id', 'normalheader');
|
2022-02-08 03:27:06 +00:00
|
|
|
if (weatherInfo.dayDesc.lowerbar.noReport == true) {
|
|
|
|
$('#forecast-title').fadeOut(0)
|
|
|
|
$('#forecast-text').fadeOut(0)
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, 0)')
|
|
|
|
$('#forecast-shadow').css('background','rgba(0,0,0,0)')
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').fadeOut(0)
|
2022-02-08 03:27:06 +00:00
|
|
|
$('#forecast-noreport').fadeIn(0)
|
|
|
|
} else {
|
|
|
|
$('#forecast-noreport').fadeOut(0)
|
|
|
|
$('#forecast-shadow').css('background','#8cadd1')
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, .35)')
|
|
|
|
$('#forecast-text').fadeIn(0)
|
|
|
|
$('#forecast-title').fadeIn(0)
|
|
|
|
$('#forecast-title').text(weatherInfo.dayDesc.lowerbar.day[0].name + "'S" + " FORECAST");
|
|
|
|
resizeText(weatherInfo.dayDesc.lowerbar.day[0].desc);
|
|
|
|
}
|
2018-09-08 19:22:46 +00:00
|
|
|
},
|
|
|
|
text2() {
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-header').prop('id', 'normalheader');
|
2022-02-08 03:27:06 +00:00
|
|
|
if (weatherInfo.dayDesc.lowerbar.noReport == true) {
|
|
|
|
$('#forecast-shadow').css('background','rgba(0,0,0,0)')
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, 0)')
|
|
|
|
$('#forecast-title').fadeOut(0)
|
|
|
|
$('#forecast-text').fadeOut(0)
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').fadeOut(0)
|
2022-02-08 03:27:06 +00:00
|
|
|
$('#forecast-noreport').fadeIn(0)
|
|
|
|
} else {
|
|
|
|
$('#forecast-noreport').fadeOut(0)
|
|
|
|
$('#forecast-shadow').css('background','#8cadd1')
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, .35)')
|
|
|
|
$('#forecast-text').fadeIn(0)
|
|
|
|
$('#forecast-title').fadeIn(0)
|
|
|
|
$('#forecast-title').text(weatherInfo.dayDesc.lowerbar.day[1].name + "'S" + " FORECAST");
|
|
|
|
resizeText(weatherInfo.dayDesc.lowerbar.day[1].desc);
|
|
|
|
}
|
2018-09-08 19:22:46 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
fiveday() {
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-header').prop('id', 'normaltiles');
|
|
|
|
$('.forecast-tiles').prop('id', 'normalheader');
|
2022-02-08 03:27:06 +00:00
|
|
|
if (weatherInfo.fiveDay.lowerbar.noReport == true) {
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, 0)')
|
|
|
|
$('#forecast-shadow').css('background','rgba(0,0,0,0)')
|
|
|
|
$('#forecast-title').fadeOut(0)
|
|
|
|
$('#forecast-text').fadeOut(0)
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').fadeOut(0)
|
2022-02-08 03:27:06 +00:00
|
|
|
$('#forecast-noreport').fadeIn(0)
|
|
|
|
} else {
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, .35)')
|
|
|
|
$('#forecast-title').fadeIn(0)
|
|
|
|
$('#forecast-noreport').fadeOut(0)
|
|
|
|
var newtile, weekend, icons;
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
$('#forecast-title').text("5 DAY FORECAST");
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').empty();
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
for (var i=0; i<5; i++ ) {
|
|
|
|
newtile = $("<div class='forecast-tile daily" + weatherInfo.fiveDay.lowerbar.day[i].weekend + "'></div>");
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
$("<div class='header'></div>") .appendTo(newtile) .text(weatherInfo.fiveDay.lowerbar.day[i].name);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
icons = getCCicon(+weatherInfo.fiveDay.lowerbar.day[i].icon, weatherInfo.fiveDay.lowerbar.day[i].windspeed);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2021-08-24 23:10:16 +00:00
|
|
|
$("<img class='icon' src=''/>") .appendTo(newtile) .attr('src', icons);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2021-08-24 23:10:16 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
$("<div class='high'></div>") .appendTo(newtile) .text(weatherInfo.fiveDay.lowerbar.day[i].high);
|
|
|
|
$("<div class='low'></div>") .appendTo(newtile) .text(weatherInfo.fiveDay.lowerbar.day[i].low);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').append(newtile);
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').css('display','flex');
|
2022-02-08 03:27:06 +00:00
|
|
|
}
|
2018-09-08 19:22:46 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
hourly() {
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-header').prop('id', 'hourlyheader');
|
|
|
|
$('.forecast-tiles').prop('id', 'hourlytiles');
|
2022-02-08 03:27:06 +00:00
|
|
|
if (weatherInfo.dayPart.lowerbar.noReport == true) {
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, 0)')
|
|
|
|
$('#forecast-shadow').css('background','rgba(0,0,0,0)')
|
|
|
|
$('#forecast-title').fadeOut(0)
|
|
|
|
$('#forecast-text').fadeOut(0)
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').fadeOut(0)
|
2022-02-08 03:27:06 +00:00
|
|
|
$('#forecast-noreport').fadeIn(0)
|
|
|
|
} else {
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-header').prop('id', 'hourlyheader');
|
2022-02-08 03:27:06 +00:00
|
|
|
$('#forecast-title').fadeIn(0)
|
|
|
|
$('#forecast-noreport').fadeOut(0)
|
|
|
|
var newtile, icons, sizer, highbar, data, label, temps=[];
|
|
|
|
$('#forecast-shadow').css('box-shadow','0 3px 10px 0 rgba(0, 0, 0, .35)')
|
|
|
|
$('#forecast-title').text( weatherInfo.dayPart.lowerbar.daytitle );
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').empty();
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
for (var i = 0; i < 4; i++) {
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
newtile = $("<div class='forecast-tile hourly'></div>");
|
|
|
|
sizer = $("<div class='width-sizer'></div>").appendTo(newtile);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
icons = getCCicon(weatherInfo.dayPart.lowerbar.hour[i].icon, weatherInfo.dayPart.lowerbar.hour[i].windspeed);
|
2021-08-24 23:10:16 +00:00
|
|
|
$("<img class='icon' src=''/>") .appendTo(sizer) .attr('src', icons);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2021-08-24 23:10:16 +00:00
|
|
|
|
2022-03-03 23:21:10 +00:00
|
|
|
$("<div class='footer'></div>") .append("<span>" + weatherInfo.dayPart.lowerbar.hour[i].time + "</span>") .appendTo(newtile)
|
2018-09-08 19:22:46 +00:00
|
|
|
highbar = $("<div class='hourly-high'></div>") .appendTo(sizer);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
$("<div class='high'></div>") .appendTo(highbar) .text(weatherInfo.dayPart.lowerbar.hour[i].temp);
|
|
|
|
temps.push(weatherInfo.dayPart.lowerbar.hour[i].temp);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
$("<div class='temp-bar'></div>") .appendTo(highbar);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').append(newtile);
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').css('display','flex');
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
// animate grow and show temp
|
|
|
|
var min = Math.min(...temps), // 54
|
|
|
|
max = Math.max(...temps), // 73
|
2022-02-08 03:27:06 +00:00
|
|
|
range = ((max-min) != 0) ? (max-min) : .001,
|
2022-03-03 23:21:10 +00:00
|
|
|
prange = (94-75), // percent range for bar height
|
2021-03-23 18:02:42 +00:00
|
|
|
temp, value;
|
2018-09-08 19:22:46 +00:00
|
|
|
$('.forecast-tile').each(function(){
|
|
|
|
temp = $(this).find('.high').first().text();
|
|
|
|
value = ((temp-min)/range) * prange + 78; // find percentage of range and translate to percent and add that to the starting css % height number
|
|
|
|
$(this).find('.hourly-high').animate({height:value+"%"}, 1500,function(){
|
|
|
|
$(this).find('.high').fadeTo('slow', 1);
|
2021-03-23 18:02:42 +00:00
|
|
|
});
|
2018-09-08 19:22:46 +00:00
|
|
|
})
|
2022-02-08 03:27:06 +00:00
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
},
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
dummy(){}
|
|
|
|
},
|
|
|
|
keys = Object.keys(displays);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
displays[ keys[idx] ]();
|
|
|
|
|
|
|
|
// increment the pointer
|
|
|
|
idx = (++idx===keys.length ? 0 : idx);
|
|
|
|
|
|
|
|
setTimeout(function(){ displayForecast(idx) }, 15000); // 15 second increment loop
|
|
|
|
|
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
function resizeText(text){
|
2022-03-03 23:21:10 +00:00
|
|
|
var s = 41,
|
2018-09-08 19:22:46 +00:00
|
|
|
$test = $('<div style="position:absolute;top:100%;"></div>') .appendTo('#forecast-text') .css('font-size', s + 'px') .html(text);
|
|
|
|
$test.width($('#forecast-text').width() );
|
|
|
|
//setTimeout(function() {
|
|
|
|
while ($test.outerHeight(true) >= ($('#forecast-text').height()) ) {
|
|
|
|
s -= 1;
|
|
|
|
$test.css('font-size', s + 'px');
|
|
|
|
}
|
|
|
|
$('#forecast-text div') .text(text) .css('font-size', s + 'px');
|
|
|
|
$test.remove();
|
2022-03-03 23:21:10 +00:00
|
|
|
$('.forecast-tiles').hide();
|
2021-03-23 18:02:42 +00:00
|
|
|
//},100); // delay is a workaround for Interstate font not updating display
|
|
|
|
}
|
|
|
|
|
2021-08-24 23:10:16 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
// end Loops class
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
|
2022-02-08 03:27:06 +00:00
|
|
|
/*function buildHourlyHeaderTitle(time) {
|
2021-03-23 18:02:42 +00:00
|
|
|
var today = new Date(),
|
2018-09-08 19:22:46 +00:00
|
|
|
tomorrow = dateFns.addDays(today, 1),
|
|
|
|
sforecast = "'s Forecast";
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
// title based on the first hour reported
|
|
|
|
switch (dateFns.getHours(time)) {
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
case 6: // 6 - Nextday's Forecast / Today's Forecast
|
|
|
|
// if 6am today
|
|
|
|
if (dateFns.isToday(time)) {
|
2021-03-23 18:02:42 +00:00
|
|
|
return dateFns.format(today, 'dddd') + sforecast;
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
|
|
|
case 0: // 0 - Nextday's Forecast
|
|
|
|
return dateFns.format(tomorrow, 'dddd') + sforecast;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
return 'This Afternoon';
|
|
|
|
|
|
|
|
case 15:
|
|
|
|
return "Today's Forecast";
|
|
|
|
|
|
|
|
case 17:
|
|
|
|
return "Tonight's Forecast";
|
|
|
|
|
|
|
|
case 20:
|
|
|
|
return dateFns.format(today, 'ddd') + ' Night/' + dateFns.format(tomorrow, 'ddd');
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function buildHourlyTimeTitle(time){
|
|
|
|
var hour=dateFns.getHours(time);
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
if (hour===0) {
|
|
|
|
return 'midnight';
|
|
|
|
} else if (hour===12){
|
|
|
|
return 'noon';
|
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
return dateFns.format(time,'h a');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// finds the intervals to report on the hourly forecast
|
|
|
|
function calcHourlyReport(data) {
|
|
|
|
var ret = [],
|
|
|
|
targets = [0, 6, 12, 15, 17, 20], // hours that we report
|
|
|
|
current = dateFns.getHours(new Date()),
|
|
|
|
now = new Date(),
|
|
|
|
//firsthour = targets[ getNextHighestIndex(targets, current) ],
|
|
|
|
start,
|
|
|
|
hour, i=0;
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
switch (true) {
|
|
|
|
case (current < 3):
|
|
|
|
start = 6;
|
|
|
|
case (current < 9):
|
|
|
|
start = 12; break;
|
|
|
|
case (current < 12):
|
|
|
|
start = 15; break;
|
|
|
|
case (current < 15):
|
|
|
|
start = 17; break;
|
|
|
|
case (current < 17):
|
|
|
|
start = 20; break;
|
|
|
|
case (current < 20):
|
|
|
|
start = 0; break;
|
2021-03-23 18:02:42 +00:00
|
|
|
default:
|
|
|
|
start = 6;
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
while(ret.length<4){
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
// hour must be equal or greater than current
|
2021-08-24 23:10:16 +00:00
|
|
|
hour = dateFns.getHours( data.validTimeLocal[i] );
|
|
|
|
if ( dateFns.isAfter(data.validTimeLocal[i], now) && (hour==start || ret.length>0) ) {
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
if ( targets.indexOf(hour)>=0 ) { // it is in our target list so record its index
|
|
|
|
ret.push(i);
|
|
|
|
}
|
2021-03-23 18:02:42 +00:00
|
|
|
|
2018-09-08 19:22:46 +00:00
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2022-02-08 03:27:06 +00:00
|
|
|
*/
|
2018-09-08 19:22:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
wind E 14
|
|
|
|
gusts 17 mph
|
|
|
|
humidity 58%
|
|
|
|
dew point 72(degree symbol)
|
|
|
|
heat index 95(degree symbol) / wind chill
|
|
|
|
pressure 30.02 S
|
|
|
|
visibility 10 miles
|
|
|
|
uv index High
|
|
|
|
partly cloudy
|
|
|
|
|
|
|
|
*/
|