Added Health, fixed radar lag, changed apis and too much more to list

This commit is contained in:
BuildTools 2021-08-24 19:10:16 -04:00
parent b3cc2cb195
commit f2f3e6da20
10 changed files with 1695 additions and 482 deletions

View File

@ -58,6 +58,26 @@
<!-- CURRENT CONDITIONS AND FORECAST-->
<div class="info-slide bulletin" style="display: none">
<div class="info-subheader">
<span id="subhead-titlei">WEATHER BULLETIN</span><span id="subhead-noaa" style="display:">FROM THE NATIONAL WEATHER SERVICE</span>
</div>
<div class='blue curve left'></div>
<div class='blue curve bottom'></div>
<div class='yellow curve left'></div>
<div class='yellow curve right'></div>
<div class='white curve right'></div>
<div class='white curve bottom'></div>
<div class='frost-pane' style="display:">
<div class='cityname'>Gainesville Area</div>
<div class='warnings'>Severe Thunderstorm Watch 720 in effect until 4:30 PM EST Tuesday.
</br>
</br>
Severe Thunderstorm Watch 720 in effect until 4:30 PM EST Tuesday.
</div>
</div>
</div>
<div class="info-slide city-info-slide" style="display:none">
<div class="info-subheader">
<span id="subhead-titlei"></span><span id="subhead-city"></span>
@ -69,6 +89,7 @@
<div class='blue curve bottom'></div>
<div class='yellow curve left'></div>
<div class='yellow curve right'></div>
<div class='yellow curve right2'></div>
<div class='white curve right'></div>
<div class='white curve bottom'></div>
@ -193,19 +214,458 @@
<div class='templow'></div>
</div>
</div>
<div class='info-slide-content almanac' style="display:none">
<div class='frost-pane half'>
<div class='thing'>Jul 26</div>
<div class='averagetitle'>Average</div>
<div class='recordtitle'>Record</div>
<div class='ahigh'>High</div>
<div class='ahightext'>90</div>
<div class='alow'>Low</div>
<div class='alowtext'>70</div>
<div class='rhigh'>High</div>
<div class='rhightext'>98</div>
<div class='rlow'>Low</div>
<div class='rlowtext'>54</div>
<div class='rhighyear'>1987</div>
<div class='rlowyear'>1999</div>
</div>
<div class='frost-pane purple'>
<div class='icon'></div>
<div class='sunrisetitle'>Sunrise</div>
<div class='sunsettitle'>Sunset</div>
<div class='sunrisetext'>7:02 am</div>
<div class='sunsettext'>8:37</div>
<div class='phase i'>
<div class ='phasetext'>NEW</div>
<div class ='icon'></div>
<div class ='date'>Aug 3</div>
</div>
<div class='phase ii'>
<div class ='phasetext'>FIRST</div>
<div class ='icon'></div>
<div class ='date'>Aug 11</div>
</div>
<div class='phase iii'>
<div class ='phasetext'>FULL</div>
<div class ='icon'></div>
<div class ='date'>Aug 18</div>
</div>
<div class='phase iv'>
<div class ='phasetext'>LAST</div>
<div class ='icon'></div>
<div class ='date'>Aug 25</div>
</div>
</div>
</div>
<div class='info-slide-content aroundcityinfo' style="display:none">
<div class="frost-pane city i">
<div class="cityname">Jacksonville</div>
<div class="temp">82</div>
<div class="icon"></div>
<div class="wind">SE 12</div>
</div>
<div class="frost-pane city ii">
<div class="cityname">Gainesville</div>
<div class="temp">80</div>
<div class="icon"></div>
<div class="wind">SW 12</div>
</div>
<div class="frost-pane city iii">
<div class="cityname">Tampa</div>
<div class="temp">85</div>
<div class="icon"></div>
<div class="wind">W 6</div>
</div>
<div class="frost-pane city iv">
<div class="cityname">Fort</div>
<div class="temp">83</div>
<div class="icon"></div>
<div class="wind">W 6</div>
</div>
</div>
</div>
<!-- DOPPLER RADAR -->
<div class="info-slide radar-slide">
<div class="info-slide radar-slide" style="display: none">
<div class="info-subheader">
<span>Local Doppler Radar</span>
<span class="radar-color-legend">Past 3 Hours<br>Light&nbsp;<img src="images/precip-legend.png" alt="Past 3 Hours"/>&nbsp;Heavy</span>
<span class="radar-color-legend" style="display: none">Past 3 Hours<br>Light&nbsp;<img src="images/precip-legend.png" alt="Past 3 Hours"/>&nbsp;Heavy</span>
</div>
<div id="radar-container" class="info-slide-content">
<div id="radar-container" class="info-slide-content radar-content" style="">
<div id="radar-1" class="map"></div>
</div>
</div>
<!-- Intros -->
<div class="info-slide city-slide-intro" style="display:none">
<div class="weatherscancopyright" style="display:none"> <span class="copyrighttext"> Weatherscan is brought to you by The Weather Channel® and MIDCO </span></div>
<div class='cityaccent viii curve' style="display:none"></div>
<div class='cityaccent ii curve' style="display:none"></div>
<div class='cityaccent i curve' style="display:none"></div>
<div class='cityaccent iii curve' style="display:none"></div>
<div class='cityaccent iv curve' style="display:none"></div>
<div class='cityaccent v curve' style="display:none"></div>
<div class='cityaccentviishadow curve'></div>
<div class='cityaccentvii curve'></div>
<div class='cityaccent ix curve' style="display:none"></div>
<div class='cityweatherscanmarquee' style="display:none">weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan</div>
<div class='segment' style="display:none">Airport Conditions</div>
</div>
<div class="info-slide airport-slide-intro" style="display:none">
<div class='accent i curve' style="display:none"></div>
<div class='accent ii curve' style="display:none"></div>
<div class='accent iii curve' style="display:none"></div>
<div class='accent iv curve' style="display:none"></div>
<div class='accent v curve' style="display:none"></div>
<div class='accent vi curve' style="display:none"></div>
<div class='accentviishadow curve'></div>
<div class='accentvii curve'></div>
<div class='accent viii curve' style="display:none"></div>
<div class='accent ix curve' style="display:none"></div>
<div class='weatherscanmarquee' style="display:none">weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan</div>
<div class='segment' style="display:none">Airport Conditions</div>
</div>
<div class="info-slide health-slide-intro" style="display: none">
<div class='accent i curve' style="display:none"></div>
<div class='accent ii curve' style="display:none"></div>
<div class='accent iii curve' style="display:none"></div>
<div class='accent iv curve' style="display:none"></div>
<div class='accent v curve' style="display:none"></div>
<div class='accent vi curve' style="display:none"></div>
<div class='accentviishadow curve'></div>
<div class='accentvii curve'></div>
<div class='accent viii curve' style="display:none"></div>
<div class='accent ix curve' style="display:none"></div>
<div class='weatherscanmarquee' style="display:none">weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan weatherscan</div>
<div class='segment' style="display:none">Weather & Your Health</div>
</div>
<!-- AIRPORT -->
<div class="info-slide airport-slide" style="display:none">
<div class="info-subheader">
<span id="subhead-titlei"></span><span id="subhead-city"></span>
</div>
<div class="info-subheadershadowfix">
<span id="subhead-title">Current Airport Conditions</span>
</div>
<div class='blue curve left'></div>
<div class='blue curve bottom'></div>
<div class='yellow curve left'></div>
<div class='yellow curve right'></div>
<div class='white curve right'></div>
<div class='white curve bottom'></div>
<div class='info-slide-content airportpanel'>
<div class='leftpanel'>
<div class='thing'>Gainesvile International Airport</div>
<div class='frost-pane top'>
<div class='title'>Arrivals</div>
<div class='delay'>DELAY</div>
<div class='delayfill'>No Delay</div>
<div class='reason'>REASON</div>
<div class='reasonfill'></div>
</div>
<div class='frost-pane bottom'>
<div class='title'>Departure</div>
<div class='delay'>DELAY</div>
<div class='delayfill'>No Delay</div>
<div class='reason'>REASON</div>
<div class='reasonfill'></div>
<div class='source'>Source: FAA</div>
</div>
</div>
<div class='frost-pane right'>
<div class='thing'></div>
<div class='icon'></div>
<div class='conditions'>Mostly Cloudy</div>
<div class='temp'>87</div>
</div>
</div>
</div>
<!-- BOAT & BEACH -->
<div class="info-slide beach-slide" style="display: none">
<div class="info-subheader">
<span id="subhead-titlei"></span><span id="subhead-city"></span>
</div>
<div class="info-subheadershadowfix">
<span id="subhead-title">Current Surf Report</span>
</div>
<div class='blue curve left'></div>
<div class='blue curve bottom'></div>
<div class='yellow curve left'></div>
<div class='yellow curve right'></div>
<div class='white curve right'></div>
<div class='white curve bottom'></div>
<div class='info-slide-content surfreport' style="display:none">
<div class='leftpanel'>
<div class='thing'>St Augustine Pier</div>
<div class='frost-pane'>
<div class='title wind'>Wind</div>
<div class='title waveperiod'>Wave Period</div>
<div class='windvalue'>E 10 mph</div>
<div class='waveperiodvalue'>5 seconds</div>
<div class='title watertemp'>Surface Water Temperature</div>
<div class='watertempbar'>30 40 50 60 70 80 90
<div class='temparrow'>
<div class='temp'>80</div>
</div>
</div>
</div>
</div>
<div class='frost-pane right'>
<div class='thing'></div>
<div class='title waveheight'>Average Wave Height</div>
<div class='wavebar'>
<div class='wavevalue'>5</div>
<div class='feet'>feet</div>
</div>
</div>
</div>
<div class='info-slide-content coastalwaters warnings' style="display:none">
<div class='thing'>FROM THE NATIONAL WEATHER SERVICE</div>
<div class='frost-pane content'>Small craft should exercise caution until 2 AM EDT
<br></br>
Small Craft Advisory in effect from 2 AM EDT Monday through Monday evening.</div>
</div>
<div class='info-slide-content coastalwaters forecasts' style="display:none">
<div class='thing'>FROM THE NATIONAL WEATHER SERVICE</div>
<div class='frost-pane content'>
<div class='title day'>Rest of Today</div>
<div class='forecasttext'>a</div>
</div>
</div>
<div class='info-slide-content tides' style="display:none">
<div class='thingnotpurple'>
<span class='hightide'>HIGH TIDE</span>
<span class='lowtide'>LOW TIDE</span>
</div>
<div class='frost-pane top'>
<div class='place'>St Augustine Beach</div>
<div class='hightide'>
12:39 am Mon </br>
12:50 pm Mon
</div>
<div class='lowtide'>
12:39 am Mon </br>
12:50 pm Mon
</div>
</div>
<div class='frost-pane mid'>
<div class='place'>St Augustine Beach</div>
<div class='hightide'>
12:39 am Mon </br>
12:50 pm Mon
</div>
<div class='lowtide'>
12:39 am Mon </br>
12:50 pm Mon
</div>
</div>
<div class='frost-pane bottom'>
<div class='place'>St Augustine Beach</div>
<div class='title sunrise'>Sunrise</div>
<div class='title sunset'>Sunset</div>
<div class='sunrisetext'>11:00 am</div>
<div class='sunsettext'> 11:59 pm</div>
</div>
</div>
</div>
<div class="info-slide health" style="display: ">
<div class="info-subheader">
<span id="subhead-titlei"></span><span id="subhead-city"></span>
</div>
<div class="info-subheadershadowfix">
<span id="subhead-title">Health Forecast</span>
</div>
<div class='blue curve left'></div>
<div class='blue curve bottom'></div>
<div class='yellow curve left'></div>
<div class='yellow curve right'></div>
<div class='white curve right'></div>
<div class='white curve bottom'></div>
<div class='info-slide-content health-forecast' style="display: none">
<div class='thing'>Forecast for Thursday</div>
<div class='frost-pane mainforecast'>
<div class='icon'></div>
<div class='low'>Low</div>
<div class='high'>High</div>
<div class='lowtext'>62</div>
<div class='hightext'>78</div>
<div class='title heatwind'>Heat Index 78</div>
</div>
<div class='frost-pane forecastdetails'>
<div class='title chanceprecip'>Chance of Precipitation</div>
<div class='title humid'>Humidity</div>
<div class='title wind'>Wind</div>
<div class='chancepreciptext'>50%</div>
<div class='humidtext'>100%</div>
<div class='windtext'>SSE 5</div>
</div>
</div>
<div class='info-slide-content allergy' style="display: none">
<div class='frost-pane pollen'>
<div class='thing'>As of Aug 7</div>
<div class='pollenbar tree'>
<div class='bar'>
<div class='bararrow'>
</div>
</div>
<div class='type'>Tree Pollen<br>Oak</div>
</div>
<div class='pollenbar grass'>
<div class='bar'>
<div class='bararrow'>
</div>
</div>
<div class='type'>Grass Pollen</div>
</div>
<div class='pollenbar weed'>
<div class='bar'>
<div class='bararrow'>
</div>
</div>
<div class='type'>Weed Pollen</div>
</div>
<div class='pollenbar mold'>
<div class='bar'>
<div class='bararrow'></div>
</div>
<div class='type'>Mold Spores</div>
</div>
<div class='scale low'>None</div>
<div class='scale high'>Very High</div>
</div>
<div class='frost-pane totalpollen'>
<div class='thing'><span class='thingtext'>Total <br> Pollen Count</span></div>
<div class='cat'>9</div>
<div class='desc'>Low</div>
</div>
</div>
<div class='info-slide-content Aches-Breath' style="display: none">
<div class='thing'>Thursday</div>
<div class='frost-pane aches'>
<div class='whitetitle aches'>Aches and Pains Index</div>
<div class='desc aches'>Potentional for feeling aches and pains based on weather conditions.</div>
<div class='bar'>
<div class='bararrow'>
<div class='bararrowtext' style='display:none'>Low</div>
</div>
</div>
</div>
<div class='frost-pane breath'>
<div class='whitetitle breath'>Respiratory Index</div>
<div class='desc breath'>Weather's influence on breathing conditions, excluding pollen or<br> air quality.</div>
<div class='bar'>
<div class='bararrow'>
<div class='bararrowtext' style='display:none'>Good</div>
</div>
</div>
</div>
</div>
<div class='info-slide-content airquality' style="display: none">
<div class='frost-pane airforecast'>
<div class='thing'>Thursday</div>
<div class='bar'>
<div class='bar red' style="background-color:#bc1264"><span class='forecast' style="display:none">Very unhealthy</span></div>
<div class='bar deeporange' style="background-color:#ff552a"><span class='forecast' style="display:none">Unhealthy</span></div>
<div class='bar orange' style="background-color:#e5a51d"><span class='forecast' style="display:none">Unhealthy for <br>sensitive groups</span></div>
<div class='bar yellow' style="background-color:#d9d320"><span class='forecast' style="display:none">Moderate</span></div>
<div class='bar green' style="background-color:#3b9f3c"><span class='forecast' style="display:none">Good</span></div>
<div class='arrow'></div>
</div>
</div>
<div class='frost-pane primarypolute'>
<div class='thing'><span class=pollutetext>Primary<br>Contributing Pollutant</span></div>
<div class='pollutant'>Ozone</div>
<div class='source'>Source: EPA</div>
<div class='ozoneaction' style="display:none">
<div class='icon'></div>
<div class='ozone'>OZONE</div>
<div class='actionday'>Action Day</div>
</div>
</div>
</div>
<div class='info-slide-content uvindex' style="display:">
<div class='weatherreadyheader'>
<div class='icon'></div>
<div class='weathertext'>W</div>
<div class='weathertext2'>eather</div>
<div class='readytext'>READY</div>
</div>
<div class='thing'>
<div class='currentlytext'>Currently</div>
<div class='uvtime i'>
<div class='uvtime'>9pm</div>
<div class='uvday'>Mon</div>
</div>
<div class='uvtime ii'>
<div class='uvtime'>12pm</div>
<div class='uvday'>Mon</div>
</div>
<div class='uvtime iii'>
<div class='uvtime'>12pm</div>
<div class='uvday'>Mon</div>
</div>
</div>
<div class='frost-pane currentuv'>
<div class='bar'>
<div class='num' style="display:none">10</div>
<div class='cat' style="display:none">Extreme</div>
</div>
</div>
<div class='frost-pane forecastuv'>
<div class='bar i'>
<div class='num' style="display:none">11</div>
<div class='cat' style="display:none">Extreme</div>
</div>
<div class='bar ii'>
<div class='num' style="display:none">9</div>
<div class='cat' style="display:none">Very High</div>
</div>
<div class='bar iii'>
<div class='num' style="display:none">11</div>
<div class='cat' style="display:none">Extreme</div>
</div>
<div class='scalebar'>
<div class='low'>0</div>
<div class='mid'>5</div>
<div class='high'>10+</div>
</div>
</div>
</div>
<div class='info-slide-content healthtip' style="display:none">
<div class='weatherreadyheader'>
<div class='icon'></div>
<div class='weathertext'>W</div>
<div class='weathertext2'>eather</div>
<div class='readytext'>READY</div>
</div>
<div class='frost-pane tipcontent'>
Incase of Lightning -
<br>
An automobile provides better insulation against<br>
lightning than being in the open. <br>
<br>
Avoid contact with any metal conducting surfaces<br>
either inside your car or outside.
</div>
</div>
<div class='info-slide-content moreinfoimage' style="display:none">
<div class='frost-pane image'>
<div class='moreinfotext'>For more on weather and your health<br>
tune to The Weather Channel or<br>
go to weather.com/health
</div>
</div>
</div>
</div>
</div>
</div>
@ -225,6 +685,11 @@
<div id="current-info"></div>
</div>
<div id="minimap-cover" style="display:none">
<div class="gradient1"></div>
<div class="gradient2"></div>
<div class="gradient3"></div>
</div>
<div id="minimap-title">PAST 3 HOURS</div>
<div id="minimap"></div>
<div id="logo-area"><img src="images/midco_logo_shadow.png"/></div>
@ -255,7 +720,26 @@
information in graphical format on a continuous loop that is generated by an IntelliStar unit installed at the cable
provider's headend; unlike The Weather Channel, Weatherscan does not feature on-air talent of any kind.
</div>
<div class="marqueeheadersevere" style="display:none">SEVERE THUNDERSTORM WARNING</div>
<div id="marqueeSevere" class="marquee" style="display:none">
Severe Thunderstorm Warning National Weather Service Lincoln IL 113 AM CDT Thu May 23 2019 The National Weather Service in Lincoln has issued a * Severe Thunderstorm Warning for...
Piatt County in central Illinois...
Southeastern De Witt County in central Illinois...
Champaign County in east central Illinois...
Northeastern Macon County in central Illinois...
* Until 200 AM CDT.
* At 113 AM CDT, a severe thunderstorm was located near Monticello,
moving east at 55 mph.
HAZARD...70 mph wind gusts and quarter size hail.
SOURCE...Trained weather spotters.
IMPACT...Hail damage to vehicles is expected. Expect considerable
tree damage. Wind damage is also likely to mobile homes,
roofs, and outbuildings.
* Locations impacted include...
Champaign, Monticello, Urbana, Savoy, Mahomet, St. Joseph, Tolono,
Bement, Philo, Sidney, Homer, Thomasboro, Gifford, Ogden, Pesotum,
De Land, Bondville, Broadlands, Allerton and Lake Of The Woods.
</div>
</div>
</body>

View File

@ -6,49 +6,49 @@ function WeatherAudio() {
mobilePlaying = false;
(function() {
$('body').append($players);
// start the music
buildMusicArray(musicarr);
shuffle(musicarr);
shuffle(musicarr);
startPlaying(musicarr, true);
function buildMusicArray(arr) {
var musicpath = "music/";
// insert track names
for (var i = 1; i<66; i++) {
for (var i = 32; i<66; i++) {
arr.push(musicpath + "Track " + String('0'+i).slice(-2) + '.mp3');
}
}
}
}
})();
function startPlaying(arrPlayList, bLoop) {
// only allow one set of players to be created
var myclass = (bLoop ? 'music' : 'voice');
if ($players.find('.' + myclass).length>0) {return}
var current=-1,
var current=-1,
len = arrPlayList.length,
$player = initPlayer('p1'),
$player = initPlayer('p1'),
$preloader = initPlayer('p2'),
$myplayers = $players.find('.' + myclass);
// init the event to output ID3 track info if this is a music play
if (myclass=='music') {
$players.find('.music').bind($.jPlayer.event.play,
$players.find('.music').bind($.jPlayer.event.play,
function() { // event.jPlayer.status.media
if (that.playCallback) {
if (that.playCallback) {
var mp3url = $(this).data('jPlayer').status.src,
relativeUrl = mp3url.replace('%20',' ').slice(-arrPlayList[current].length);
@ -62,27 +62,27 @@ function WeatherAudio() {
}
}
}
);
);
} else {
// duck the music if we're going to play a vocal
$players.find('.music').jPlayer('volume', 0.30);
}
// prime the preloader
$preloader.jPlayer("setMedia", {mp3:arrPlayList[0]});
$preloader.jPlayer("setMedia", {mp3:arrPlayList[0]});
playNext();
playNext();
function playNext() {
current = nextIndex();
current = nextIndex();
if (nextIndex()===null) {
// nothing to preload so don't fire off a playNext after this play
$preloader.unbind($.jPlayer.event.ended);
$preloader.bind($.jPlayer.event.ended,
function() {
$preloader.bind($.jPlayer.event.ended,
function() {
$players.find('.music').jPlayer('volume', 0.80); // bring music volume back up
$player.remove();
$preloader.remove();
@ -95,12 +95,12 @@ function WeatherAudio() {
// preload the next track
function doPreload(trackname) {
try {
$preloader.jPlayer("setMedia", {mp3:arrPlayList[nextIndex()]}).jPlayer("play").jPlayer("stop");
$preloader.jPlayer("setMedia", {mp3:arrPlayList[nextIndex()]}).jPlayer("play").jPlayer("stop");
} catch(e) {
setTimeout( function() {doPreload(trackname)}, 500);
}
}
}
doPreload( arrPlayList[nextIndex()] );
doPreload( arrPlayList[nextIndex()] );
}
@ -115,8 +115,8 @@ function WeatherAudio() {
}
function initPlayer(id){
var $div;
$div = $('<div id=' + id + ' class="jplayer ' + myclass + '">');
@ -134,63 +134,57 @@ function WeatherAudio() {
function swapAndPlay() {
// who would think swapping two vars would be so hard?
var $temp1 = $player,
$temp2 = $preloader;
$temp2 = $preloader;
$player = null; $preloader = null;
$player=$temp2; $preloader=$temp1;
$player.jPlayer("play");
$player.jPlayer("play");
$(document).mousedown( function() {
if (!mobilePlaying) {
$player.jPlayer("play");
mobilePlaying = true;
}
});
});
}
}
// click for debugging or whater you want
// click for debugging or whater you want
$('body').on('click', function(){
//$player.jPlayer("playHead", 100);
//getWeatherbyLocation();
});
this.playCallback = {};
// plays the vocal current conditions announcement
this.playCurrentConditions = function (currentConditions) {
var array2play = ['CC_INTRO' + (Math.floor(Math.random()*2)+1), currentConditions.temp.replace('-', 'M')],
condfile = mapCurrentConditions(currentConditions.code);
if (condfile) { array2play.push(condfile); }
$.each(array2play, function(i,v){
array2play[i] = '/localvocals/' + v + '.mp3';
});
startPlaying(array2play, false);
function mapCurrentConditions(ccCode){
return "CC" + {0:"422",1:"EF300",2:"EF300",3:"422",4:"400",5:"500",6:"600",7:"700",8:"800",9:"901",10:"1000",11:"1100",12:"2680",13:"1601",14:"1312",15:"1500",16:"1600",17:"1730",18:"1800",19:"1939",20:"2000",21:"2000",22:"2200",23:"2410",24:"2410",26:"2600",27:"2700",28:"2700",29:"2900",30:"2900",31:"3100",32:"3200",33:"3400",34:"3400",35:"1730",37:"429",38:"429",39:"429",40:"2680",41:"1402",42:"1312",43:"1402",44:"2900",45:"1100",46:"1312",47:"EF3900"}[ccCode];
}
this.playCurrentConditions = function () {
startPlaying(['/localvocals/narrations/Your_current_conditions.mp3'], false);
}
this.playwarningbeep = function () {
startPlaying(['/localvocals/narrations/warningbeep.mp3'], false);
}
this.playLocalRadar = function() {
startPlaying(['/localvocals/RADAR.mp3'], false);
startPlaying(['/localvocals/narrations/The_local_Doppler_radar.mp3'], false);
}
this.playLocalforecasti = function() {
startPlaying(['/localvocals/narrations/Your_local_forecast_1.mp3'], false);
}
this.playLocalforecastii = function() {
startPlaying(['/localvocals/narrations/Your_local_forecast_2.mp3'], false);
}
}
var weatherAudio = new WeatherAudio();
@ -228,4 +222,4 @@ b,c){return c.S(a)};f.b.CNT=f.b.PCNT;f.b["T*"]=function(a,b,c){var d=h(c.a(a));r
q,"UTF-8");break;case "uint8":k=b.F(v);break;case "jpeg":case "png":k={format:"image/"+w,data:b.s(v,q)}}a[x[0]]="comment"===x[0]?{text:k}:k}}g+=l}}var c={types:{0:"uint8",1:"text",13:"jpeg",14:"png",21:"uint8"},o:{"\u00a9alb":["album"],"\u00a9art":["artist"],"\u00a9ART":["artist"],aART:["artist"],"\u00a9day":["year"],"\u00a9nam":["title"],"\u00a9gen":["genre"],trkn:["track"],"\u00a9wrt":["composer"],"\u00a9too":["encoder"],cprt:["copyright"],covr:["picture"],"\u00a9grp":["grouping"],keyw:["keyword"],
"\u00a9lyr":["lyrics"],"\u00a9cmt":["comment"],tmpo:["tempo"],cpil:["compilation"],disk:["disc"]},u:function(a,b){a.i([0,7],function(){h(a,0,a.l(),b)})},v:function(a){var b={};f(b,a,0,a.l());return b}};l.f=c},{}],9:[function(g,l){l.f={J:function(h,f,c){var a=0,b=1,g=0;c=Math.min(c||h.length,h.length);254==h[0]&&255==h[1]?(f=!0,a=2):255==h[0]&&254==h[1]&&(f=!1,a=2);f&&(b=0,g=1);f=[];for(var d=0;a<c;d++){var e=h[a+b],l=(e<<8)+h[a+g],a=a+2;if(0==l)break;else 216>e||224<=e?f[d]=String.fromCharCode(l):
(e=(h[a+b]<<8)+h[a+g],a+=2,f[d]=String.fromCharCode(l,e))}h=new String(f.join(""));h.j=a;return h},K:function(h,f){var c=0;f=Math.min(f||h.length,h.length);239==h[0]&&187==h[1]&&191==h[2]&&(c=3);for(var a=[],b=0;c<f;b++){var g=h[c++];if(0==g)break;else if(128>g)a[b]=String.fromCharCode(g);else if(194<=g&&224>g){var d=h[c++];a[b]=String.fromCharCode(((g&31)<<6)+(d&63))}else if(224<=g&&240>g){var d=h[c++],e=h[c++];a[b]=String.fromCharCode(((g&255)<<12)+((d&63)<<6)+(e&63))}else if(240<=g&&245>g){var d=
h[c++],e=h[c++],l=h[c++],g=((g&7)<<18)+((d&63)<<12)+((e&63)<<6)+(l&63)-65536;a[b]=String.fromCharCode((g>>10)+55296,(g&1023)+56320)}}a=new String(a.join(""));a.j=c;return a},I:function(g,f){var c=[];f=f||g.length;for(var a=0;a<f;){var b=g[a++];if(0==b)break;c[a-1]=String.fromCharCode(b)}c=new String(c.join(""));c.j=a;return c}}},{}]},{},[4])(4)});
h[c++],e=h[c++],l=h[c++],g=((g&7)<<18)+((d&63)<<12)+((e&63)<<6)+(l&63)-65536;a[b]=String.fromCharCode((g>>10)+55296,(g&1023)+56320)}}a=new String(a.join(""));a.j=c;return a},I:function(g,f){var c=[];f=f||g.length;for(var a=0;a<f;){var b=g[a++];if(0==b)break;c[a-1]=String.fromCharCode(b)}c=new String(c.join(""));c.j=a;return c}}},{}]},{},[4])(4)});

View File

@ -1,8 +1,8 @@
function DataManager(pointSearch){
var $this = $(this),
that = this,
excludeRadiusMiles=5;
includeRadiusMiles=50;
excludeRadiusMiles=10;
includeRadiusMiles=30;
var _locations = [];
@ -33,25 +33,25 @@ function DataManager(pointSearch){
// find reporting stations
var observationData = _locations[0].observations(0),
lat = observationData.lat,
lon = observationData.lon,
lat = observationData.latitude,
lon = observationData.longitude,
locList = [];
// begin the forcast pull
_locations[0].initForecasts();
// get a list of observation stations info
$.getJSON('https://api.weather.gov/points/' + lat + ',' + lon + '/stations', function(data) {
// get a list of observation stations info //https://api.weather.com/v3/location/near?geocode=33.74,-84.39&product=observation&format=json&apiKey=yourApiKey
$.getJSON('https://api.weather.com/v3/location/near?geocode=' + lat + ',' + lon + '&product=observation&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525', function(data) {
var feature, geo, station, dist;
for (var i=0; i < data.features.length; i++) {
feature = data.features[i];
geo = feature.geometry.coordinates;
dist = distance(lat, lon, geo[1], geo[0]);
for (var i=0; i < data.location.stationName.length || i <= 3; i++) {
feature = data.location;
latgeo = feature.latitude[i];
longeo = feature.longitude[i];
dist = feature.distanceMi[i];
if (dist < includeRadiusMiles && dist > excludeRadiusMiles) {
locList.push({lat: geo[1], long:geo[0], distance:dist, stationUrl:feature.id});
locList.push({lat: latgeo, long:longeo, distance:dist, stationUrl:feature.stationId[i]});
}
}
@ -67,13 +67,12 @@ function DataManager(pointSearch){
// set the station for location 0
_locations[0].stationUrl = locList[0].stationUrl
_locations[0].initNWSObservations();
// create location objects, get inital pull
for(var loc of locList) {
loc.location = new Location();
$(loc.location).on('init',onLocationInit);
loc.location.init(loc.lat+','+loc.long);
loc.location.init(loc.lat+','+loc.long, loc.location.stationName);
loc.location.stationUrl = loc.stationUrl;
}
@ -99,8 +98,7 @@ function DataManager(pointSearch){
if (_locations.filter(e => e.city == loc.location.city).length === 0) {
_locations.push(loc.location);
loc.location.initForecasts();
loc.location.initNWSObservations();
//loc.location.initForecasts();
}
}

View File

@ -37,7 +37,7 @@ function GroupDataManager() {
// woeid is the id for the location to pull data for
var url = 'https://api.openweathermap.org/data/2.5/weather?q='+ location.name + '&appid=putapikeyhere&units=imperial'
var url = 'https://api.openweathermap.org/data/2.5/weather?q='+ location.name + '&appid=0cb279a98124446dd16dba02fbfb60ee&units=imperial'
pullData(url, location);
@ -60,7 +60,7 @@ function GroupDataManager() {
}
// display the current info
$span.text(location.name + ': ' + Math.round(parseInt(location.data.main.temp)) + ' ' + location.data.weather[0].description.toLowerCase());
$span.text(location.name + ': ' + Math.round(parseInt(location.data.main.temp)) + ' ' + (getCC(location.data.weather[0].id + location.data.weather[0].icon, location.data.wind.speed)).toLowerCase());
// set the expiration date/time

View File

@ -9,7 +9,7 @@ function Location() { // onReady, onRefresh, onAllComplete
if (_observations[1]!=null && _observations[1].temperature.value) {
return C2F(_observations[1].temperature.value);
} else {
return Math.round( _observations[0].current.temp );
return Math.round( _observations[0].temperature );
}
}
@ -26,15 +26,12 @@ function Location() { // onReady, onRefresh, onAllComplete
this.initForecasts = function() {
// start the forecast data pull
if (_observations[0] != undefined){
_forecastmgr = new ForecastManager(_observations[0].lat, _observations[0].lon, function() {
_forecastmgr = new ForecastManager(_observations[0].latitude, _observations[0].longitude, function() {
$this.trigger('ready');
});
}
};
this.initNWSObservations = function(){
stationObservations();
};
// check to see if data needs to be refreshed
@ -51,24 +48,28 @@ function Location() { // onReady, onRefresh, onAllComplete
if (location != undefined) {
var loclat = location.split(",")[0]
var loclong = location.split(",")[1]
var url = 'https://api.openweathermap.org/data/2.5/onecall?lat=' + loclat + '&lon=' + loclong + '&appid=putkeyhere&units=imperial'
//old var url = 'https://api.openweathermap.org/data/2.5/onecall?lat=' + loclat + '&lon=' + loclong + '&appid=0cb279a98124446dd16dba02fbfb60ee&units=imperial'
https://api.weather.com/v3/aggcommon/v3-wx-observations-current;v3-location-point?geocode=33.74,-84.39&language=en-US&units=e&format=json&apiKey=yourApiKey
var url = 'https://api.weather.com/v3/aggcommon/v3-wx-observations-current;v3-location-point?geocode=' + loclat + ',' + loclong + '&language=en-US&units=e&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525'
// ajax the latest observation
$.getJSON(url, function(data) {
_observations[0] = json = data;
_observations[0] = json = data['v3-wx-observations-current'];
_observations[0].latitude = loclat;
_observations[0].longitude = loclong;
_observations[0].cityname = data['v3-location-point'].location.city;
$this.trigger('refresh');
// the following block only runs on init
if (that.woeid===undefined) {
that.woeid = loclat
that.woeid = loclat;
that.lat = data.lat
that.long = data.lon;
that.lat = loclat;
that.long = loclong;
//that.city = data.query.results.channel.location.city;
that.city = data['v3-location-point'].location.city;
$this.trigger('init');
@ -79,42 +80,20 @@ function Location() { // onReady, onRefresh, onAllComplete
setTimeout(checkRefresh, getRandom(5000, 10000));
});
$.getJSON('http://api.openweathermap.org/geo/1.0/reverse?lat=' + loclat + '&lon=' + loclong + '&limit=1&appid=0cb279a98124446dd16dba02fbfb60ee', function(sloc) {
that.city = (sloc[0].name);
});
}
}
// pull observations from the location observation station
function stationObservations() {
var url = that.stationUrl + '/observations/current';
// check the expiration
if ( _observations[1]!=undefined && dateFns.isFuture( _observations[1].xdate ) ) {
setTimeout(checkRefresh, getRandom(5000, 10000));
return;
}
// ajax the current conditions
$.getJSON(url, function(data) {
_observations[1] = data.properties;
// set the expiration date/time
_observations[1].xdate = dateFns.addMinutes(data.properties.timestamp, 60);
setTimeout(stationObservations, getRandom(5000, 10000));
});
}
function ForecastManager (latitude, longitude, readyCallback) {
var _forecasts = {},
keys =['daily','hourly'],
keys =['alert','daily','hourly','almanac','pollen','achesindex','breathindex','airquality','forecastuvindex', 'uvindex'],
key,
readycount = 0;
@ -141,8 +120,29 @@ function ForecastManager (latitude, longitude, readyCallback) {
function Forecast(type, lat, lon, readyCallback) {
var that = this,
url = 'https://api.weather.gov/points/' + lat + ',' + lon + "/forecast/" + (type==='hourly' ? type : '');
var that = this;
var url;
if (type == 'hourly') {
url = 'https://api.weather.com/v3/wx/forecast/hourly/2day?geocode=' + lat + ',' + lon + "&format=json&units=e&language=en-US&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'daily') {
url = 'https://api.weather.com/v3/wx/forecast/daily/5day?geocode=' + lat + ',' + lon + "&format=json&units=e&language=en-US&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'alert') {
url = 'https://api.weather.com/v3/alerts/headlines?geocode=' + lat + ',' + lon + "&format=json&language=en-US&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'almanac') {
url = 'https://api.weather.com/v3/wx/almanac/daily/1day?geocode=' + lat + ',' + lon + "&format=json&units=e" + "&day=" + dateFns.format(new Date(), "D") + "&month=" + dateFns.format(new Date(),"M") + "&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'pollen') {
url = 'https://api.weather.com/v1/geocode/'+ lat + '/' + lon + '/observations/pollen.json?language=en-US&apiKey=e1f10a1e78da46f5b10a1e78da96f525'
} else if (type == 'achesindex') {
url = 'https://api.weather.com/v2/indices/achePain/daypart/3day?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'breathindex') {
url = 'https://api.weather.com/v2/indices/breathing/daypart/3day?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'airquality') {
url = 'https://api.weather.com/v3/wx/globalAirQuality?geocode=' + lat + ',' + lon + "&language=en-US&scale=EPA&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
} else if (type == 'forecastuvindex') {
url = 'https://api.weather.com/v2/indices/uv/hourly/48hour?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
}else if (type == 'uvindex') {
url = 'https://api.weather.com/v2/indices/uv/current?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525"
}
this.data = {};
@ -159,20 +159,17 @@ function Forecast(type, lat, lon, readyCallback) {
// ajax the forecast
$.getJSON(url, function(data) {
that.data = data.properties.periods;
that.data = data
// trigger ready callback on first data pull
// set the expiration date/time
})
.always(function() {
if (readyCallback){
readyCallback();
}
// set the expiration date/time
that.data.xdate = dateFns.addMinutes(data.properties.updated, 60);
that.data.xdate = dateFns.addMinutes(new Date(), 5);
setTimeout(checkRefresh, getRandom(5000, 10000));
});
});
}
}

View File

@ -1,4 +1,4 @@
var severemode
function Loops(bindDataManager) {
var //dataManager,
obsData,
@ -17,45 +17,59 @@ function Loops(bindDataManager) {
function displayAtmospheric(idx) {
var displays = {
conditions() {
return (obsData(0).wxPhraseLong).toLowerCase();
},
conditions() {
return (getCC(obsData(0).current.weather[0].id + obsData(0).current.weather[0].icon, obsData(0).current.wind_speed)).toLowerCase();
},
wind(){ return 'wind ' + degToCompass(obsData(0).current.wind_deg) + ' ' + Math.round(parseInt(obsData(0).current.wind_speed)); },
wind(){ return 'wind ' + ((obsData(0).windDirectionCardinal == "CALM") ? 'calm' : obsData(0).windDirectionCardinal) + ' ' + ((obsData(0).windSpeed === 0) ? '' : obsData(0).windSpeed); },
gusts(){
if ( obsData(1)!=undefined ) {
return obsData(1).windGust.value!=null ? 'gusts ' + mps2mph( obsData(1).windGust.value ) : '';
return obsData(1).windGust.value!=null ? 'gusts ' + obsData(1).windGust.value : '';
}
},
humidity(){ return 'humidity ' + obsData(0).current.humidity + '%'; },
humidity(){ return 'humidity ' + obsData(0).relativeHumidity + '%'; },
dewpoint(){ return 'dew point ' + dewPoint(obsData(0).current.temp, obsData(0).current.humidity ) + '&deg;'; },
dewpoint(){ return 'dew point ' + obsData(0).temperatureDewPoint + '&deg;'; },
heatindex_windchill(){
var windchill = 35.74 + (0.6215 * parseInt(obsData(0).current.temp)) + (0.4275 * parseInt(obsData(0).current.temp) - 35.75) * parseInt(obsData(0).current.wind_speed) ^ 0.16;
if (parseInt(obsData(0).current.temp)<80 && windchill < parseInt(obsData(0).current.temp)) {
var windchill = Math.round(35.74 + 0.6215 * parseInt(obsData(0).temperature) - 35.75 * Math.pow(parseInt(obsData(0).windSpeed),0.16) + 0.4275 * parseInt(obsData(0).temperature) * Math.pow(parseInt(obsData(0).windSpeed),0.16) -1);
if (parseInt(obsData(0).temperature)<80 && windchill < parseInt(obsData(0).temperature)) {
return 'wind chill ' + windchill + '&deg;';
} else if (parseInt(obsData(0).current.temp)>=80 && parseInt(obsData(0).current.humidity)>=40 ){
return 'heat index ' + heatIndex(obsData(0).current.temp, obsData(0).current.humidity) + '&deg;';
} else if (parseInt(obsData(0).temperature)>=80 && parseInt(obsData(0).relativeHumidity)>=40 ){
return 'heat index ' + heatIndex(obsData(0).temperature, obsData(0).relativeHumidity) + '&deg;';
}
else return '';
},
pressure(){ return 'pressure ' + (obsData(0).current.pressure*0.0295301).toFixed(2) },
pressure(){ return 'pressure ' + obsData(0).pressureAltimeter },
//+ ['S','R','F'][obsData(0).current.rising];
visibility() { return 'visibility ' + (parseInt(obsData(0).current.visibility) / 1000) + ' mile' + (obsData(0).current.visibility != 1 ? 's' : ''); },
visibility() { return 'visibility ' + obsData(0).visibility + ' mile' + (obsData(0).visibility != 1 ? 's' : ''); },
uvindex() { return 'UV index ' + obsData(0).current.uvi; },
uvindex() { return 'UV index ' + obsData(0).uvDescription; },
},
keys = Object.keys(displays),
text = displays[ keys[idx] ]();
// increment the pointer
if (severemode == true) {
var si = 0;
function resetInfo() {
if (si == 0) {
stext = (obsData(0).wxPhraseLong).toLowerCase() + '<br><br>' + 'wind ' + ((obsData(0).windDirectionCardinal == "CALM") ? 'calm' : obsData(0).windDirectionCardinal) + ' ' + ((obsData(0).windSpeed === 0) ? '' : obsData(0).windSpeed) + '<br>' + 'humidity ' + obsData(0).relativeHumidity + '%' + '<br>' + 'dew point ' + obsData(0).temperatureDewPoint + '&deg;'
$('#current-info').html(stext);
si = 1;
} else {
$('#current-info').html((obsData(0).wxPhraseLong).toLowerCase() + '<br><br>' + 'pressure ' + obsData(0).pressureAltimeter + '<br>' + 'visibility ' + obsData(0).visibility + ((obsData(0).visibility != 1 ) ? 'miles' : 'mile') + '<br>' + 'ceiling' + ((obsData(0).cloudCeiling != null) ? ((obsData(0).cloudCeiling).toString() + 'ft') : ''));
si = 0;
}
setTimeout(function(){resetInfo()}, 6000);
}
resetInfo()
} else {
idx = (++idx===keys.length ? 0 : idx);
if (text) {
@ -65,7 +79,7 @@ function Loops(bindDataManager) {
// nothing to display - skip to the next one
setTimeout(function(){ displayAtmospheric(idx) }, 0);
}
}
} // end function
@ -74,36 +88,45 @@ function Loops(bindDataManager) {
var displays = {
text1() {
$('#forecast-title').text( possessiveForecast(foreDataDaily[0].name) );
resizeText(foreDataDaily[0].detailedForecast);
if (foreDataDaily.daypart[0].daypartName[0] != null) {
$('#forecast-title').text(foreDataDaily.daypart[0].daypartName[0] + "'S" + " FORECAST");
resizeText(foreDataDaily.daypart[0].narrative[0] + ((foreDataDaily.daypart[0].qualifierPhrase[0] != null && foreDataDaily.daypart[0].narrative[0].includes(foreDataDaily.daypart[0].qualifierPhrase[0]) === false) ? foreDataDaily.daypart[0].qualifierPhrase[0] : '') + ((foreDataDaily.daypart[0].windPhrase[0] != null && foreDataDaily.daypart[0].narrative[0].includes(foreDataDaily.daypart[0].windPhrase[0]) === false) ? foreDataDaily.daypart[0].windPhrase[0] : ''));
} else {
$('#forecast-title').text(foreDataDaily.daypart[0].daypartName[1] + "'S" + " FORECAST");
resizeText(foreDataDaily.daypart[0].narrative[1] + ((foreDataDaily.daypart[0].qualifierPhrase[1] != null && foreDataDaily.daypart[0].narrative[1].includes(foreDataDaily.daypart[0].qualifierPhrase[1]) === false) ? foreDataDaily.daypart[0].qualifierPhrase[1] : '') + ((foreDataDaily.daypart[0].windPhrase[1] != null && foreDataDaily.daypart[0].narrative[1].includes(foreDataDaily.daypart[0].windPhrase[1]) === false) ? foreDataDaily.daypart[0].windPhrase[1] : ''));
}
},
text2() {
$('#forecast-title').text( possessiveForecast(foreDataDaily[1].name) );
resizeText(foreDataDaily[1].detailedForecast);
if (foreDataDaily.daypart[0].daypartName[0] != null) {
$('#forecast-title').text( foreDataDaily.daypart[0].daypartName[1] + "'S" + " FORECAST" );
resizeText(foreDataDaily.daypart[0].narrative[1] + ((foreDataDaily.daypart[0].qualifierPhrase[1] != null && foreDataDaily.daypart[0].narrative[1].includes(foreDataDaily.daypart[0].qualifierPhrase[1]) === false) ? foreDataDaily.daypart[0].qualifierPhrase[1] : '') + ((foreDataDaily.daypart[0].windPhrase[1] != null && foreDataDaily.daypart[0].narrative[1].includes(foreDataDaily.daypart[0].windPhrase[1]) === false) ? foreDataDaily.daypart[0].windPhrase[1] : ''));
} else {
$('#forecast-title').text(foreDataDaily.dayOfWeek[1] + "'S" + " FORECAST");
resizeText(foreDataDaily.daypart[0].narrative[2] + ((foreDataDaily.daypart[0].qualifierPhrase[2] != null && foreDataDaily.daypart[0].narrative[2].includes(foreDataDaily.daypart[0].qualifierPhrase[2]) === false) ? foreDataDaily.daypart[0].qualifierPhrase[2] : '') + ((foreDataDaily.daypart[0].windPhrase[2] != null && foreDataDaily.daypart[0].narrative[2].includes(foreDataDaily.daypart[0].windPhrase[2]) === false) ? foreDataDaily.daypart[0].windPhrase[2] : ''));
}
},
fiveday() {
var newtile, weekend, icons,
startidx = (foreDataDaily[0].name==='Tonight' ? 1 : 2),
days = ['SUN','MON','TUE','WED','THU','FRI','SAT'];
startidx = (foreDataDaily.daypart[0].daypartName[0] != null ? 0 : 2);
$('#forecast-title').text("5 DAY FORECAST");
$('#forecast-tiles').empty();
for (var i=startidx; i<=10; i+=2 ) {
for (var i=startidx; i<=(startidx + 8); i+=2 ) {
weekend = ( dateFns.isWeekend(foreDataDaily[i].startTime) ? ' weekend' : '');
weekend = ( dateFns.isWeekend(foreDataDaily.validTimeLocal[i/2]) ? ' weekend' : '');
newtile = $("<div class='forecast-tile daily" + weekend + "'></div>");
$("<div class='header'></div>") .appendTo(newtile) .text(days[ dateFns.getDay(foreDataDaily[i].startTime) ]);
$("<div class='header'></div>") .appendTo(newtile) .text((foreDataDaily.dayOfWeek[i/2]).substring(0,3));
icons = mapNWSicons(foreDataDaily[i].icon);
for (x=icons.length-1; x>=0; x--){
$("<img class='icon' src=''/>") .appendTo(newtile) .attr('src', icons[x]);
}
icons = getCCicon(+foreDataDaily.daypart[0].iconCode[i], foreDataDaily.daypart[0].windSpeed[i]);
$("<div class='high'></div>") .appendTo(newtile) .text(foreDataDaily[i].temperature);
$("<div class='low'></div>") .appendTo(newtile) .text(foreDataDaily[i+1].temperature);
$("<img class='icon' src=''/>") .appendTo(newtile) .attr('src', icons);
$("<div class='high'></div>") .appendTo(newtile) .text(foreDataDaily.temperatureMax[i/2]);
$("<div class='low'></div>") .appendTo(newtile) .text(foreDataDaily.temperatureMin[i/2]);
$('#forecast-tiles').append(newtile);
}
@ -116,26 +139,26 @@ function Loops(bindDataManager) {
indexes = calcHourlyReport(foreDataHourly),
data, label, temps=[];
$('#forecast-title').text( buildHourlyHeaderTitle(foreDataHourly[indexes[0]].startTime) );
$('#forecast-title').text( buildHourlyHeaderTitle(foreDataHourly.validTimeLocal[indexes[0]]) );
$('#forecast-tiles').empty();
for (var i of indexes) {
data = foreDataHourly[i];
data = foreDataHourly;
newtile = $("<div class='forecast-tile hourly'></div>");
sizer = $("<div class='width-sizer'></div>").appendTo(newtile);
icons = mapNWSicons(data.icon);
for (var x=icons.length-1; x>=0; x--){
$("<img class='icon' src=''/>") .appendTo(sizer) .attr('src', icons[x]);
}
icons = getCCicon(data.iconCode[i], data.windSpeed[i]);
$("<div class='footer'></div>") .appendTo(newtile) .text(buildHourlyTimeTitle(data.startTime));
$("<img class='icon' src=''/>") .appendTo(sizer) .attr('src', icons);
$("<div class='footer'></div>") .appendTo(newtile) .text(buildHourlyTimeTitle(data.validTimeLocal[i]));
highbar = $("<div class='hourly-high'></div>") .appendTo(sizer);
$("<div class='high'></div>") .appendTo(highbar) .text(data.temperature);
temps.push(data.temperature);
$("<div class='high'></div>") .appendTo(highbar) .text(data.temperature[i]);
temps.push(data.temperature[i]);
$("<div class='temp-bar'></div>") .appendTo(highbar);
@ -188,9 +211,7 @@ function Loops(bindDataManager) {
//},100); // delay is a workaround for Interstate font not updating display
}
function possessiveForecast(text){
return text + (text.toUpperCase() != 'OVERNIGHT' ? "'S" : '') + ' FORECAST';
}
} // end Loops class
@ -272,8 +293,8 @@ function calcHourlyReport(data) {
while(ret.length<4){
// hour must be equal or greater than current
hour = dateFns.getHours( data[i].startTime );
if ( dateFns.isAfter(data[i].startTime, now) && (hour==start || ret.length>0) ) {
hour = dateFns.getHours( data.validTimeLocal[i] );
if ( dateFns.isAfter(data.validTimeLocal[i], now) && (hour==start || ret.length>0) ) {
if ( targets.indexOf(hour)>=0 ) { // it is in our target list so record its index
ret.push(i);

View File

@ -6,7 +6,8 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
intervalHours = intervalHoursIn,
zoom = zoomIn,
latitude = latitudeIn,
longitude = longitudeIn;
longitude = longitudeIn,
timeLayers = [];
this.setView = function(lat, long, zoomLevel){
map.setView(L.latLng(lat, long), zoomLevel)
@ -14,16 +15,6 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
startAnimation();
setInterval(updatePeriod, 300000);
function updatePeriod() {
var endDate = roundDate(new Date()),
startDate = dateFns.subHours(endDate, 3),
newAvailableTimes = L.TimeDimension.Util.explodeTimeRange(startDate, endDate, 'PT5M');
map.timeDimension.setAvailableTimes(newAvailableTimes, 'replace');
map.timeDimension.setCurrentTime(startDate);
}
// snap date to 5 minute intervals
function roundDate(date) {
@ -40,31 +31,8 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
map = L.map(divID, {
zoom: zoom,
fullscreenControl: false,
timeDimension: true,
timeDimensionControl: true,
timeDimensionOptions:{
timeInterval: "PT" + intervalHours + "H/" + endDate.toISOString(),
period: "PT5M",
currentTime: endDate
},
timeDimensionControlOptions: {
autoPlay: true,
playerOptions: {
buffer: 36,
transitionTime: 100,
loop: false,
startOver:true
}
},
center: [latitude, longitude] // 31.205482,-82.4331197 test coordinates
});
map.timeDimensionControl._player.on('stop', function(){
setTimeout( function() {
map.timeDimensionControl._player.setLooped(true);
map.timeDimensionControl._player.start();
setTimeout(function(){map.timeDimensionControl._player.setLooped(false)}, 1000);
}, 1000)
center: [latitude, longitude]
// 31.205482,-82.4331197 test coordinates
});
@ -73,19 +41,44 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
// satellite streets cj8p1qym6976p2rqut8oo6vxr
// weatherscan green cj8owq50n926g2smvagdxg9t8
// mapbox://styles/goldbblazez/ckgc7fwvr4qmn19pevtvhyabl
L.tileLayer('https://api.mapbox.com/styles/v1/goldbblazez/ckgc8lzdz4lzh19qt7q9wbbr9/tiles/{z}/{x}/{y}?access_token=putapikeyhere', {
// https://api.mapbox.com/styles/v1/goldbblazez/ckgc8lzdz4lzh19qt7q9wbbr9.html?fresh=true&title=copy&access_token=pk.eyJ1IjoiZ29sZGJibGF6ZXoiLCJhIjoiY2tiZTRnb2Q2MGkxajJwbzV2bWd5dXI5MyJ9.jU-2DqGCBI14K-acyN9RCw
L.tileLayer('https://api.mapbox.com/styles/v1/goldbblazez/ckgc8lzdz4lzh19qt7q9wbbr9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZ29sZGJibGF6ZXoiLCJhIjoiY2ttbTRyYjlsMGMwdDJvbnh6ZDd3b3l4ZyJ9.AcR8BHOrQGjoISQfC-dNFw', {
tileSize: 512,
zoomOffset: -1
}).addTo(map);
$.getJSON("https://api.weather.com/v3/TileServer/series/productSet/PPAcore?filter=radar&apiKey=e1f10a1e78da46f5b10a1e78da96f525", function(data) {
for (var i = 0; i < data.seriesInfo.radar.series.length; i++) {
timeLayers.push(
L.tileLayer("https://api.weather.com/v3/TileServer/tile/radar?ts="+ data.seriesInfo.radar.series[i].ts +"&xyz={x}:{y}:{z}&apiKey=e1f10a1e78da46f5b10a1e78da96f525", {
opacity: 0
}))
}
timeLayers.forEach(timeLayers => {
var radarWMS = L.nonTiledLayer.wms("https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer", {
layers: '1',
format: 'image/png',
transparent: true,
opacity: 0.8
timeLayers.addTo(map);
});
});
const sleepNow = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
async function animationLoop() {
for (let i = timeLayers.length; i > 0; i--) {
timeLayers[i - 1].setOpacity(1)
await sleepNow(100)
timeLayers[i - 1].setOpacity(0)
if (i === 1) {
timeLayers[i - 1].setOpacity(1)
await sleepNow(1750)
timeLayers[i - 1].setOpacity(0)
animationLoop()
}
}
}
setTimeout(function() {
animationLoop()
}, 1000);
if (withSat) {
var goes_visible_sat = L.nonTiledLayer.wms('https://nowcoast.noaa.gov/arcgis/services/nowcoast/sat_meteo_imagery_time/MapServer/WMSServer', {
@ -149,15 +142,6 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
}
var proxy = 'js/leaflet/proxy.php';
var radarTimeLayer = L.timeDimension.layer.wms(radarWMS, {
proxy: proxy,
updateTimeDimension: false
});
radarTimeLayer.addTo(map);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -90,24 +90,134 @@ function heatIndex(T, R) { // T = temp, R = relative humidity
// maps current condition code to icon
function getCCicon(ccCode, windData){
var icon = "images/icons/" + ( "0" + {"20011d":1,"20011n":1,"20111d":1,"20111n":1,"20211d":1,"20211n":1,"21011d":46,"21011n":46,"21111d":46,"21111n":46,"21211d":46,"21211n":46,"22111d":1,"22111n":1,"23011d":1,"23011n":1,"23111d":1,"23111n":1,"23211d":1,"23211n":1,"30009d":5,"30009n":5,"30109d":5,"30109n":5,"30209d":5,"30209n":5,"31009d":5,"31009n":5,"31109d":5,"31109n":5,"31209d":5,"31209n":5,"31309d":5,"31309n":5,"31409d":5,"31409n":5,"32109d":5,"32109n":5,"50010d":7,"50010n":7,"50110d":8,"50110n":8,"50210d":31,"50210n":31,"50310d":31,"50310n":31,"50410d":31,"50410d":31,"51110d":6,"51110n":6,"52010d":7,"52010n":7,"52110d":8,"52110n":8,"52210d":31,"52210n":31,"53110d":29,"53110n":37,"60013d":10,"60013n":10,"60113d":12,"60113n":12,"60213d":33,"60213n":33,"61113d":13,"61113n":13,"61213d":13,"61213n":13,"61313d":13,"61313n":13,"61513d":2,"61513n":2,"61613d":2,"61613n":2,"62013d":10,"62013n":10,"62113d":12,"62113n":12,"62213d":33,"62213n":33,"70150d":15,"70150n":15,"71150d":14,"71150n":14,"72150d":16,"72150n":16,"73150d":16,"73150n":16,"74150d":15,"74150n":15,"75150d":16,"75150n":16,"76150d":14,"76150n":14,"76250d":14,"76250n":14,"77150d":18,"77150n":18,"78150d":1,"78150n":1,"80001d":26,"80001n":25,"80102d":28,"80102n":27,"80203d":22,"80203n":21,"80304d":24,"80304n":23,"80404d":20,"80404n":20}[ccCode]).slice(-2) + ".png";
var icon = "images/icons/" + ( "0" + {"0":0,"1":0,"2":0,"3":47,"4":01,"5":02,"6":38,"7":03,"8":04,"9":05,"10":06,"11":08,"12":08,"13":09,"14":12,"15":11,"16":12,"17":48,"18":48,"19":16,"20":49,"21":16,"22":14,"23":0,"24":50,"25":34,"26":20,"27":21,"28":22,"29":23,"30":24,"31":25,"32":26,"33":27,"34":28,"35":13,"36":41,"37":29,"38":29,"39":30,"40":31,"41":32,"42":33,"43":34,"44":19,"45":35,"46":36,"47":37}[ccCode]).slice(-2) + ".png";
if (parseInt(windData) >= 20) {
if (ccCode === "50110d" || "50110n" || "52110d" || "52110d") {
if (ccCode === "11" || "12" || "40") {
icon = "images/icons/45.png"
}
if (ccCode === "60113d" || "60113n" || "62113d" || "62113n") {
if (ccCode === "14" || "16" || "42") {
icon = "images/icons/34.png"
}
}
return icon
}
function getCC(ccCode, windData){
var condition = {"20011d":"Light Thunderstorm","20011n":"Light Thunderstorm","20111d":"Thunderstorm","20111n":"Thunderstorm","20211d":"Heavy Thunderstorm","20211n":"Heavy Thunderstorm","21011d":"Thunder","21011n":"Thunder","21111d":"Thunder","21111n":"Thunder","21211d":"Thunder","21211n":"Thunder","22111d":"Scattered Thunderstorm","22111n":"Scattered Thunderstorm","23011d":"Light Thunderstorm","23011n":"Light Thunderstorm","23111d":"Light Thunderstorm","23111n":"Light Thunderstorm","23211d":"Light Thunderstorm","23211n":"Light Thunderstorm","30009d":"Drizzle","30009n":"Drizzle","30109d":"Drizzle","30109n":"Drizzle","30209d":"Drizzle","30209n":"Drizzle","31009d":"Drizzle","31009n":"Drizzle","31109d":"Drizzle","31109n":"Drizzle","31209d":"Drizzle","31209n":"Drizzle","31309d":"Drizzle","31309n":"Drizzle","31409d":"Drizzle","31409n":"Drizzle","32109d":"Drizzle","32109n":"Drizzle","50010d":"Light Rain","50010n":"Light Rain","50110d":"Rain","50110n":"Rain","50210d":"Heavy Rain","50210n":"Heavy Rain","50310d":"Heavy Rain","50310n":"Heavy Rain","50410d":"Heavy Rain","50410d":"Heavy Rain","51110d":"Freezing Rain","51110n":"Freezing Rain","52010d":"Light Rain Shower","52010n":"Light Rain Shower","52110d":"Rain Shower","52110n":"Rain Shower","52210d":"Heavy Rain Shower","52210n":"Heavy Rain Shower","53110d":"Scattered Rain Showers","53110n":"Scattered Rain Showers","60013d":"Light Snow","60013n":"Light snow","60113d":"Snow","60113n":"Snow","60213d":"Heavy Snow","60213n":"Heavy Snow","61113d":"Sleet","61113n":"Sleet","61213d":"Sleet","61213n":"Sleet","61313d":"Sleet","61313n":"Sleet","61513d":"Light Rain and Snow","61513n":"Light Rain and Snow","61613d":"Rain and Snow","61613n":"Rain and Snow","62013d":"Light Snow Shower","62013n":"Light Snow Shower","62113d":"Snow Shower","62113n":"Snow Shower","62213d":"Heavy Snow Shower","62213n":"Heavy Snow Shower","70150d":"Mist","70150n":"Mist","71150d":"Smoke","71150n":"Smoke","72150d":"Haze","72150n":"Haze","73150d":"Blowing Dust","73150n":"Blowing Dust","74150d":"Fog","74150n":"Fog","75150d":"Blowing Dust","75150n":"Blowing Dust","76150d":"Blowing Dust","76150n":"Blowing Dust","76250d":"Ash","76250n":"Ash","77150d":"Squalls","77150n":"Squalls","78150d":"Tornado","78150n":"Tornado","80001d":"Sunny","80001n":"Clear","80102d":"Fair","80102n":"Fair","80203d":"Partly Cloudy","80203n":"Partly Cloudy","80304d":"Mostly Cloudy","80304n":"Mostly Cloudy","80404d":"Cloudy","80404n":"Cloudy"}[ccCode]
if (parseInt(windData) >= 20) {
condition = condition + ", windy"
function getWarningPosition(warning) {
var warnpos = { "Tsunami Warning": 1,
"Tornado Warning": 2,
"Extreme Wind Warning": 3,
"Severe Thunderstorm Warning": 4,
"Flash Flood Warning": 5,
"Flash Flood Statement": 6,
"Severe Weather Statement": 7,
"Fire Warning": 14,
"Storm Surge Warning": 17,
"Hurricane Force Wind Warning": 18,
"Hurricane Warning": 19,
"Typhoon Warning": 20,
"Special Marine Warning": 21,
"Blizzard Warning": 22,
"Snow Squall Warning": 23,
"Ice Storm Warning": 24,
"Winter Storm Warning": 25,
"High Wind Warning": 26,
"Tropical Storm Warning": 27,
"Storm Warning": 28,
"Tsunami Advisory": 29,
"Tsunami Watch": 30,
"Avalanche Warning": 31,
"Earthquake Warning": 32,
"Volcano Warning": 33,
"Ashfall Warning": 34,
"Coastal Flood Warning": 35,
"Lakeshore Flood Warning": 36,
"Flood Warning": 37,
"River Flood Warning": 37.5,
"High Surf Warning": 38,
"Dust Storm Warning": 39,
"Blowing Dust Warning": 40,
"Lake Effect Snow Warning": 41,
"Excessive Heat Warning": 42,
"Tornado Watch": 43,
"Severe Thunderstorm Watch": 44,
"Flash Flood Watch": 45,
"Gale Warning": 46,
"Flood Statement": 47,
"Wind Chill Warning": 48,
"Extreme Cold Warning": 49,
"Hard Freeze Warning": 50,
"Freeze Warning": 51,
"Red Flag Warning": 52,
"Storm Surge Watch": 53,
"Hurricane Watch": 54,
"Hurricane Force Wind Watch": 55,
"Typhoon Watch": 56,
"Tropical Storm Watch": 57,
"Storm Watch": 58,
"Hurricane Local Statement": 59,
"Typhoon Local Statement": 60,
"Tropical Storm Local Statement": 61,
"Tropical Depression Local Statement": 62,
"Avalanche Advisory": 63,
"Winter Weather Advisory": 64,
"Wind Chill Advisory": 65,
"Heat Advisory": 66,
"Urban and Small Stream Flood Advisory": 67,
"Small Stream Flood Advisory": 68,
"Arroyo and Small Stream Flood Advisory": 69,
"Flood Advisory": 70,
"Hydrologic Advisory": 71,
"Lakeshore Flood Advisory": 72,
"Coastal Flood Advisory": 73,
"High Surf Advisory": 74,
"Heavy Freezing Spray Warning": 75,
"Dense Fog Advisory": 76,
"Dense Smoke Advisory": 77,
"Small Craft Advisory For Hazardous Seas": 78,
"Small Craft Advisory for Rough Bar": 79,
"Small Craft Advisory for Winds": 80,
"Small Craft Advisory": 81,
"Brisk Wind Advisory": 82,
"Hazardous Seas Warning": 83,
"Dust Advisory": 84,
"Blowing Dust Advisory": 85,
"Lake Wind Advisory": 86,
"Wind Advisory": 87,
"Frost Advisory": 88,
"Ashfall Advisory": 89,
"Freezing Fog Advisory": 90,
"Freezing Spray Advisory": 91,
"Low Water Advisory": 92,
"Avalanche Watch": 94,
"Blizzard Watch": 95,
"Rip Current Statement": 96,
"Beach Hazards Statement": 97,
"Gale Watch": 98,
"Winter Storm Watch": 99,
"Hazardous Seas Watch": 100,
"Heavy Freezing Spray Watch": 101,
"Coastal Flood Watch": 102,
"Lakeshore Flood Watch": 103,
"Flood Watch": 104,
"High Wind Watch": 105,
"Excessive Heat Watch": 106,
"Extreme Cold Watch": 107,
"Wind Chill Watch": 108,
"Lake Effect Snow Watch": 109,
"Hard Freeze Watch": 110,
"Freeze Watch": 111,
"Fire Weather Watch": 112,
"Extreme Fire Danger": 113,
"Coastal Flood Statement": 115,
"Lakeshore Flood Statement": 116,
"Special Weather Statement": 117,
"Marine Weather Statement": 118,
"Air Quality Alert": 119,
"Air Stagnation Advisory": 120,
"Hazardous Weather Outlook": 121,
}[warning]
if (warnpos !== undefined) {
return warnpos;
} else {
return 140;
}
return condition
}
// https://date-fns.org/docs/Getting-Started
}// https://date-fns.org/docs/Getting-Started

View File

@ -3,14 +3,13 @@ function WeatherManager() {
var mainloc
var mainMap, miniMap, slides,
dataMan, loops, // weatherAudio,
dataMan, loops, //weatherAudio,
that = this;
$(function(){
// init marquees
function refreshMarquee () {
$('#marquee-container')
.marquee('destroy')
.marquee({speed: 200, pauseOnHover:true, delayBeforeStart:3000})
@ -53,7 +52,10 @@ function WeatherManager() {
var queryString = window.location.search;
if (queryString) {
dataMan = createDataManager( queryString.split("?")[1] );
$.getJSON("https://api.weather.com/v3/location/search?query="+queryString.split("?")[1]+"&language=en-US&format=json&apiKey=e1f10a1e78da46f5b10a1e78da96f525", function(data) {
dataMan = createDataManager( data.location.latitude[0]+','+data.location.longitude[0] );
mainloc = data.location.city[0]
});
} else {
// get lat lon from user's ip
@ -89,19 +91,17 @@ function WeatherManager() {
function refreshObservationDisplay() {
var data = dataMan.locations[0].observations(0),
cond = data.current.weather[0];
cond = data.wxPhraseLong;
if (mainMap===undefined) {
mainMap = that.mainMap = new Radar("radar-1", 3, 8, data.lat, data.lon, false);
miniMap = new Radar("minimap", 3, 5, data.lat, data.lon);
mainMap = that.mainMap = new Radar("radar-1", 3, 8, data.latitude, data.longitude, false);
miniMap = new Radar("minimap", 3, 6, data.latitude, data.longitude);
}
$('#city').text(mainloc);
$('#forecast-city').text(mainloc + ':');
$('#current-temp').text( dataMan.locations[0].temperature() ) ;
$('#conditions-icon').css('background-image', 'url("' + getCCicon(cond.id + cond.icon) + '")');
//weatherAudio.playCurrentConditions(cond);
$('#conditions-icon').css('background-image', 'url("' + getCCicon(+data.iconCode, data.windSpeed) + '")');
}