Recode fixes stuff plus no report and severe update bugs likely
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 543 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 2.5 MiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" preserveAspectRatio="none" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1024 768" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#545456;}
|
||||
</style>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st0" d="M117.9,384C117.9,171.9,294,0,511.2,0H0v768h511.2C294,768,117.9,596.1,117.9,384z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path class="st0" d="M511.2,0c217.2,0,393.3,171.9,393.3,384S728.4,768,511.2,768H1024V0H511.2z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 599 KiB After Width: | Height: | Size: 599 KiB |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 3.5 KiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" preserveAspectRatio="none" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1024 768" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#b45548;}
|
||||
</style>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st0" d="M117.9,384C117.9,171.9,294,0,511.2,0H0v768h511.2C294,768,117.9,596.1,117.9,384z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path class="st0" d="M511.2,0c217.2,0,393.3,171.9,393.3,384S728.4,768,511.2,768H1024V0H511.2z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 2.1 MiB |
After Width: | Height: | Size: 741 KiB |
After Width: | Height: | Size: 695 KiB |
After Width: | Height: | Size: 61 KiB |
|
@ -35,23 +35,460 @@
|
|||
<script type="text/javascript" src="js/radar.js"></script>
|
||||
<script type="text/javascript" src="js/audio.js"></script>
|
||||
<script type="text/javascript" src="js/groupull.js"></script>
|
||||
<script type="text/javascript" src="js/data-manager.js"></script>
|
||||
<script type="text/javascript" src="js/location.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/loops.js"></script>
|
||||
<script type="text/javascript" src="js/slides-loop.js"></script>
|
||||
<script type="text/javascript" src="js/weather.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
<script type="text/javascript" src="js/settings.js"></script>
|
||||
<script type="text/javascript" src="js/newweathermanager.js"></script>
|
||||
<div id="startup" class="settings">
|
||||
<div class="blackbar">
|
||||
<div class="introtext" style="display: ">
|
||||
<div id="headendid" class="introtext">headend id:</div>
|
||||
<div id="serialnumber" class="introtext">serial number:</div>
|
||||
<div id="locationname" class="introtext">location name:</div>
|
||||
<div id="affilatename" class="introtext">affiliate name:</div>
|
||||
</div>
|
||||
<div id="settings" class="introtext" style="display: none">
|
||||
<div id="apperancesettings" class="introtext">▶ appearance settings</div>
|
||||
<div id="locationsettings" class="introtext">location settings</div>
|
||||
<div id="weathersettings" class="introtext">weather settings</div>
|
||||
<div id="other" class="introtext">other settings</div>
|
||||
<div id="savebutton" class="introtext">Save</div>
|
||||
</div>
|
||||
<img class="twclogo" src="images/weatherlogos.png"/>
|
||||
</div>
|
||||
<div id="appearancesettingspane" class="settingspane" style="display: none">
|
||||
<select name="background" id="background">
|
||||
<option value="oldnologo">old background no nogo</option>
|
||||
<option value="oldnormal">old background twc logo</option>
|
||||
<option value="oldearthday">old background earthday twc logo</option>
|
||||
<option value="nologo">no nogo</option>
|
||||
<option value="normal">twc logo</option>
|
||||
<option value="earthday">earthday twc logo</option>
|
||||
<option value="custom">custom background</option>
|
||||
</select>
|
||||
<select name="sidebar" id="sidebar">
|
||||
<option value="normalsidebar">normal sidebar</option>
|
||||
<option value="2005sidebar">2005 sidebar</option>
|
||||
</select>
|
||||
<select name="citybackground" id="citybackground">
|
||||
<option value="city">city</option>
|
||||
<option value="beach">beach</option>
|
||||
<option value="fence">fence</option>
|
||||
<option value="custom">custom</option>
|
||||
</select>
|
||||
<select name="iconstheme" id="icons">
|
||||
<option value="city">2006-2010</option>
|
||||
<option value="beach">2010-2013</option>
|
||||
<option value="fence">XL Icons</option>
|
||||
<option value="custom">something different</option>
|
||||
</select>
|
||||
<button name= "slide" id="slide"></button>
|
||||
</div>
|
||||
<div id="locationsettingspane" class="settingspane" style="display: none">
|
||||
<div id="weathertitle" class="settingspanetitle">Location Settings</div>
|
||||
<div id="locsearch">
|
||||
<div id="searchbar">
|
||||
<label for="location">location search</label>
|
||||
<input autocomplete="false"type="text" id="locsearch"><br><br>
|
||||
</div>
|
||||
<div id="searchoption">
|
||||
<select name="iconstheme" id="locsearchoption">
|
||||
<option value="city">City</option>
|
||||
<option value="address">Address</option>
|
||||
<option value="zipcode">Zipcode</option>
|
||||
<option value="coords">Coordinates</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="displayname">
|
||||
<label for="location">display name</label>
|
||||
<input type="text" id="locdisplayname"><br><br>
|
||||
</div>
|
||||
<div id="addlocationbuttons">
|
||||
<button id="setmainloc">Set Main Location</button>
|
||||
<button id="addlocbutton">Add Location</button>
|
||||
<button id="addloc8slide">Add to 8 City Slide</button>
|
||||
<button id="addlocticker">Add to CC Ticker</button>
|
||||
</div>
|
||||
<div id="extralocheader" class="locationheader">Locations
|
||||
<button id="extralocsdata" class="clearalllocs">Clear Extra Locations</button>
|
||||
<button id="resetmainloc">Reset Main Location</button>
|
||||
<button id="extralocation" class="resetotherlocs">Reset Extra Locations</button>
|
||||
</div>
|
||||
<div id="mainlocation">Main Location
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
</div>
|
||||
<div id="extralocations">
|
||||
<div id="extralocation1" class="extralocation">Extra Location 1
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton" name="fname">Remove Location</button>
|
||||
</div>
|
||||
<div id="extralocation2" class="extralocation">Extra Location 1
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="extralocation3" class="extralocation">Extra Location 1
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="city8slide" class="locationheader">8 City Slide Locations
|
||||
<button id="city8slidedata" class="clearalllocs">Clear Extra Locations</button>
|
||||
<button id="8slide" class="resetotherlocs">Reset Extra Locations</button>
|
||||
</div>
|
||||
<div id="City8SlideLocations">
|
||||
<div id="eightslideloc1" class="eightslideloc">Eight City Slide Location 1
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc2" class="eightslideloc">Eight City Slide Location 2
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc3" class="eightslideloc">Eight City Slide Location 3
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc4" class="eightslideloc">Eight City Slide Location 4
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc5" class="eightslideloc">Eight City Slide Location 5
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc6" class="eightslideloc">Eight City Slide Location 6
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc7" class="eightslideloc">Eight City Slide Location 7
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="eightslideloc8" class="eightslideloc">Eight City Slide Location 8
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cctickerheader" class="locationheader">CCTicker Locations
|
||||
<button id="cctickerdata" class="clearalllocs">Clear CCticker Locations</button>
|
||||
<button id="resetcctickerlocs">Reset CCTicker Locations</button>
|
||||
</div>
|
||||
<div id="cctickerlocations">
|
||||
<div id="cctickerloc1" class="cctickerloc">CCTicker Location 1
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc2" class="cctickerloc">CCTicker Location 2
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc3" class="cctickerloc">CCTicker Location 3
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc4" class="cctickerloc">CCTicker Location 4
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc5" class="cctickerloc">CCTicker Location 5
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc6" class="cctickerloc">CCTicker Location 6
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc7" class="cctickerloc">CCTicker Location 7
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc8" class="cctickerloc">CCTicker Location 8
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc9" class="cctickerloc">CCTicker Location 9
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
<div id="cctickerloc10" class="cctickerloc" style="display:;">CCTicker Location 10
|
||||
<div id="locationname">name: </div>
|
||||
<div id="locationdisplayname">display name: </div>
|
||||
<div id="coords">coordinates: </div>
|
||||
<button class="removelocbutton">Remove Location</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="weathersettingspane" class="settingspane" style="display: none">
|
||||
<div id="pageleft" class="pagearrow">‹</div>
|
||||
<div id="pageright" class="pagearrow">›</div>
|
||||
<div id="weathertitle" class="settingspanetitle">Weather Data Settings</div>
|
||||
|
||||
<div id="currentconditionspage" class="weathersettingspage" style="display: ">
|
||||
<div id="currenttile" class="weathersettingspagetitle">Current Conditions Slide</div>
|
||||
<div class=setlocname>
|
||||
<label for="8 cities">Current Location Name</label>
|
||||
<input type="text" id="currentlocname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=selectloc>
|
||||
<label for="8 cities">Selected Location</label>
|
||||
<select name="citybackground" id="citybackground">
|
||||
<option value="city">city</option>
|
||||
</select>
|
||||
</div>
|
||||
<form action="/action_page.php">
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Temperature</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Conditions</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Icons</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Humidity</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Dew Point</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Pressure</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Pressure Rising/Falling</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="cc">Current Wind</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="daypartpage" class="settingspage" style="display: none">
|
||||
<div id="currenttile" class="weathersettingspagetitle">Daypart Slide</div>
|
||||
<div class=setlocname>
|
||||
<label for="8 cities">Hour Location Name</label>
|
||||
<input type="text" id="hourlocnamei" name="fname"><br><br>
|
||||
</div>
|
||||
<div id="hour1" class="hour"> <div class="sethourtitle">Hour 1</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Time</label>
|
||||
<input type="text" id="hourtimei" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Condition</label>
|
||||
<input type="text" id="hourcondi" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Icon</label>
|
||||
<input type="text" id="houriconi" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Temperatue</label>
|
||||
<input type="text" id="hourtempi" name="fname"><br><br>
|
||||
</div>
|
||||
</div>
|
||||
<div id="hour2" class="hour"> <div class="sethourtitle">Hour 2</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Time</label>
|
||||
<input type="text" id="hourtimeii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Condition</label>
|
||||
<input type="text" id="hourcondii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Icon</label>
|
||||
<input type="text" id="houriconii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Temperatue</label>
|
||||
<input type="text" id="hourtempii" name="fname"><br><br>
|
||||
</div>
|
||||
</div>
|
||||
<div id="hour3" class="hour"> <div class="sethourtitle">Hour 3</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Time</label>
|
||||
<input type="text" id="hourtimeiii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Condition</label>
|
||||
<input type="text" id="hourcondiii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Icon</label>
|
||||
<input type="text" id="houriconiii" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Temperatue</label>
|
||||
<input type="text" id="hourtempiii" name="fname"><br><br>
|
||||
</div>
|
||||
</div>
|
||||
<div id="hour4" class="hour"> <div class="sethourtitle">Hour 4</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Time</label>
|
||||
<input type="text" id="hourtimeiv" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Condition</label>
|
||||
<input type="text" id="hourcondiv" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Icon</label>
|
||||
<input type="text" id="houriconiv" name="fname"><br><br>
|
||||
</div>
|
||||
<div class=textfield>
|
||||
<label for="8 cities">Hour Temperatue</label>
|
||||
<input type="text" id="hourtempiv" name="fname"><br><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="daypartpage" class="settingspage" style="display: none">
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">36-Hour Day</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">36-Hour Forecast</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">36-Hour Location Name</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
</div>
|
||||
<div id="5day" class="settingspage" style="display: none">
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day Location Name</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day Name</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day Condition</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day Icon</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day High</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">5-Day Low</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
</div>
|
||||
<div id="alamanac" class="settingspage" style="display: none">
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Date</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Average High</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Average Low</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Record High</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Record Low</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Sunrise</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac Sunset</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac MoonPhase</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac MoonPhase Icon</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
<form action="/action_page.php">
|
||||
<label for="8 cities">Almanac MoonPhase Date</label>
|
||||
<input type="text" id="fname" name="fname"><br><br>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<img class="intellistarlogo" src="images/intellistarlogo.png"/>
|
||||
</div>
|
||||
|
||||
<div id="main" class="container">
|
||||
|
||||
<img id="template" src="images/template-4k.jpg"/>
|
||||
<img id="template" src="images/template-4k.png"/>
|
||||
<div id="info-slides-bg"></div>
|
||||
<div id="info-slides-container">
|
||||
|
||||
<div id="info-slides-header">
|
||||
<div class="hscroller">
|
||||
<span class="city radar current">LOCAL RADAR</span>
|
||||
</div>
|
||||
<div class="hscroller"></div><!--<span class="city radar current">LOCAL RADAR</span> -->
|
||||
<div class="gradientthing"></div>
|
||||
</div>
|
||||
|
||||
|
@ -79,7 +516,7 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div class="info-slide city-info-slide" style="display:none">
|
||||
<div class="info-slide severe-city-info-slide" style="display:none">
|
||||
<div class="info-subheader">
|
||||
<span id="subhead-titlei"></span><span id="subhead-city"></span>
|
||||
</div>
|
||||
|
@ -93,6 +530,217 @@
|
|||
<div class='yellow curve right2'></div>
|
||||
<div class='white curve right'></div>
|
||||
<div class='white curve bottom'></div>
|
||||
<div class='noreport' style="display: none">No Report</div>
|
||||
<div class='tempunavailable' style="display: none">Temporarily Unavailable</div>
|
||||
|
||||
<div class='info-slide-content severe-forecast' style="display:none">
|
||||
<div class='frost-pane'>
|
||||
<div class='title'></div>
|
||||
<div class='content'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='info-slide-content severe-city-info' style="display:none">
|
||||
<div class='frost-pane left'>
|
||||
<div class='labels'></div>
|
||||
<div class='data'></div>
|
||||
</div>
|
||||
<div class='frost-pane right'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temp'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='info-slide-content severe-daypart' style="display:none">
|
||||
<div class='frost-pane'>
|
||||
<div class='hour i'>
|
||||
<div class='thing'>
|
||||
<div class='thingtext'>2pm</div>
|
||||
</div>
|
||||
<div class='icon'></div>
|
||||
<div class='condition'>rain</div>
|
||||
<div class='tempbar'>
|
||||
<div class='temp'>79</div>
|
||||
<div class='wind'>NNE 12</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='hour ii'>
|
||||
<div class='thing'>
|
||||
<div class='thingtext'>2pm</div>
|
||||
</div>
|
||||
<div class='icon'></div>
|
||||
<div class='condition'></div>
|
||||
<div class='tempbar'>
|
||||
<div class='temp'></div>
|
||||
<div class='wind'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='hour iii'>
|
||||
<div class='thing'>
|
||||
<div class='thingtext'>2pm</div>
|
||||
</div>
|
||||
<div class='icon'></div>
|
||||
<div class='condition'></div>
|
||||
<div class='tempbar'>
|
||||
<div class='temp'></div>
|
||||
<div class='wind'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='hour iv'>
|
||||
<div class='thing'>
|
||||
<div class='thingtext'>2pm</div>
|
||||
</div>
|
||||
<div class='icon'></div>
|
||||
<div class='condition'></div>
|
||||
<div class='tempbar'>
|
||||
<div class='temp'></div>
|
||||
<div class='wind'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='info-slide-content severe-extended-forecast' style="display:none">
|
||||
<div class='thingg'>
|
||||
<div class='thingday iw'>Mon</div>
|
||||
<div class='thingday iiw'>Tue</div>
|
||||
<div class='thingday iiiw'>Wed</div>
|
||||
<div class='thingday ivw'>Thu</div>
|
||||
<div class='thingday vw'>Fri</div>
|
||||
</div>
|
||||
<div class='frost-pane iw'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'>Sct'd<br> T'storms</div>
|
||||
<div class='temphigh'>87</div>
|
||||
<div class='templow'>74</div>
|
||||
</div>
|
||||
<div class='linebreak i'>
|
||||
</div>
|
||||
<div class='frost-pane iiw'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
<div class='linebreak ii'>
|
||||
</div>
|
||||
<div class='frost-pane iiiw'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
<div class='linebreak iii'>
|
||||
<div class='thing'></div>
|
||||
</div>
|
||||
<div class='frost-pane ivw'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
<div class='linebreak iv'>
|
||||
</div>
|
||||
<div class='lfrost-pane vw'>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'>
|
||||
<div class='temphightext'></div>
|
||||
</div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='info-slide-content severe-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 severe-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>
|
||||
<div class="info-slide city-info-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"></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='yellow curve right2'></div>
|
||||
<div class='white curve right'></div>
|
||||
<div class='white curve bottom'></div>
|
||||
<div class='noreport' style="display: none">No Report</div>
|
||||
<div class='tempunavailable' style="display: none">Temporarily Unavailable</div>
|
||||
|
||||
<div class='info-slide-content forecast' style="display:none">
|
||||
<div class='frost-pane'>
|
||||
|
@ -163,28 +811,30 @@
|
|||
</div>
|
||||
|
||||
<div class='info-slide-content extended-forecast' style="display:none">
|
||||
<div class='thingg'>
|
||||
<div class='thingday iw'>Mon</div>
|
||||
<div class='thingday iiw'>Tue</div>
|
||||
<div class='thingday iiiw'>Wed</div>
|
||||
<div class='thingday ivw'>Thu</div>
|
||||
<div class='thingday vw'>Fri</div>
|
||||
</div>
|
||||
<div class='frost-pane iw'>
|
||||
<div class='thing'><span class="textmove"></span></div>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'>Sct'd<br> T'storms</div>
|
||||
<div class='temphigh'>87</div>
|
||||
<div class='templow'>74</div>
|
||||
</div>
|
||||
<div class='linebreak i'>
|
||||
<div class='thing'></div>
|
||||
</div>
|
||||
<div class='frost-pane iiw'>
|
||||
<div class='thing'></div>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
<div class='linebreak ii'>
|
||||
<div class='thing'></div>
|
||||
</div>
|
||||
<div class='frost-pane iiiw'>
|
||||
<div class='thing'></div>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
|
@ -194,19 +844,14 @@
|
|||
<div class='thing'></div>
|
||||
</div>
|
||||
<div class='frost-pane ivw'>
|
||||
<div class='thing'></div>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'></div>
|
||||
<div class='templow'></div>
|
||||
</div>
|
||||
<div class='linebreak iv'>
|
||||
<div class='thing'></div>
|
||||
</div>
|
||||
<div class='lfrost-pane vw'>
|
||||
<div class='thing'>
|
||||
<div class='thingtext'></div>
|
||||
</div>
|
||||
<div class='icon'></div>
|
||||
<div class='conditions'></div>
|
||||
<div class='temphigh'>
|
||||
|
@ -291,12 +936,13 @@
|
|||
</div>
|
||||
|
||||
<!-- DOPPLER RADAR -->
|
||||
<div class="info-slide radar-slide" style="display: ">
|
||||
<div class="info-slide radar-slide" style="display: none">
|
||||
<div class="info-subheader">
|
||||
<span>Local Doppler Radar</span>
|
||||
<span class="radar-color-legend" style="display: none">Past 3 Hours<br>Light <img src="images/precip-legend.png" alt="Past 3 Hours"/> Heavy</span>
|
||||
</div>
|
||||
<div id="radar-container" class="info-slide-content radar-content" style="">
|
||||
<div class='tempunavailable' style="display: none">Temporarily Unavailable</div>
|
||||
<div id="radar-1" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -373,7 +1019,7 @@
|
|||
<div class='segment' style="display:none">Weather & Your Health</div>
|
||||
</div>
|
||||
<!-- AIRPORT -->
|
||||
<div class="info-slide airport-slide" style="display:none">
|
||||
<div class="info-slide airport-slide" style="display: none">
|
||||
<div class="info-subheader">
|
||||
<span id="subhead-titlei"></span><span id="subhead-city"></span>
|
||||
</div>
|
||||
|
@ -386,7 +1032,8 @@
|
|||
<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='nodata' style="display: none">Data Not Available</div>
|
||||
<div class='info-slide-content airportpanel' style="display: none">
|
||||
<div class='leftpanel'>
|
||||
<div class='thing'>Gainesvile International Airport</div>
|
||||
<div class='frost-pane top'>
|
||||
|
@ -726,6 +1373,9 @@
|
|||
<div id="now">now</div>
|
||||
<div id="current-temp"></div>
|
||||
<div id="current-info"></div>
|
||||
<div id="current-noreport" style="display: none">no report</div>
|
||||
<div id="current-info-severe" style="display: none"></div>
|
||||
<div id="current-info-details" style="display: none"></div>
|
||||
</div>
|
||||
|
||||
<div id="minimap-cover" style="display:none">
|
||||
|
@ -746,6 +1396,7 @@
|
|||
<div>Retrieving forecast data...</div>
|
||||
</div>
|
||||
<div id="forecast-tiles"></div>
|
||||
<div id="forecast-noreport" style="display:none">Temporarily Unavailable</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
function WeatherAudio() {
|
||||
|
||||
var musicarr = [],
|
||||
|
@ -188,7 +189,6 @@ function WeatherAudio() {
|
|||
|
||||
}
|
||||
var weatherAudio = new WeatherAudio();
|
||||
|
||||
//ID3 Reader
|
||||
//https://github.com/aadsm/JavaScript-ID3-Reader
|
||||
(function(A){if("object"===typeof exports&&"undefined"!==typeof module)module.f=A();else if("function"===typeof define&&define.M)define([],A);else{var g;"undefined"!==typeof window?g=window:"undefined"!==typeof global?g=global:"undefined"!==typeof self?g=self:g=this;g.ID3=A()}})(function(){return function g(l,h,f){function c(b,d){if(!h[b]){if(!l[b]){var e="function"==typeof require&&require;if(!d&&e)return e(b,!0);if(a)return a(b,!0);e=Error("Cannot find module '"+b+"'");throw e.code="MODULE_NOT_FOUND",
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
function DataManager(pointSearch){
|
||||
var $this = $(this),
|
||||
that = this,
|
||||
excludeRadiusMiles=10;
|
||||
includeRadiusMiles=30;
|
||||
|
||||
var _locations = [];
|
||||
|
||||
this.locations = _locations;
|
||||
|
||||
this.location = function(woeid) {
|
||||
return _locations.find(x => x.woeid === woeid);
|
||||
}
|
||||
|
||||
this.init = function (searchString) {
|
||||
_locations[0] = new Location();
|
||||
|
||||
$(_locations[0])
|
||||
|
||||
.on('refresh', function(){ $this.trigger('refresh') })
|
||||
.on('ready', function(){
|
||||
$this.trigger('ready:main');
|
||||
})
|
||||
.on('init', initLocations);
|
||||
_locations[0].first = true;
|
||||
_locations[0].init(searchString);
|
||||
|
||||
};
|
||||
|
||||
// kicks off after main location is returned.
|
||||
// create the list of neighboring cities
|
||||
function initLocations(){
|
||||
|
||||
// find reporting stations
|
||||
var observationData = _locations[0].observations(0),
|
||||
lat = observationData.latitude,
|
||||
lon = observationData.longitude,
|
||||
locList = [];
|
||||
|
||||
// begin the forcast pull
|
||||
_locations[0].initForecasts();
|
||||
|
||||
// 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=' + api_key, function(data) {
|
||||
|
||||
var feature, geo, station, dist;
|
||||
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: latgeo, long:longeo, distance:dist, stationUrl:feature.stationId[i]});
|
||||
}
|
||||
}
|
||||
if (locList.length===0) {
|
||||
$this.trigger('allinit');
|
||||
return
|
||||
}
|
||||
|
||||
// sort list by distance
|
||||
locList.sort(function(a, b) {
|
||||
return parseInt(a.distance) - parseInt(b.distance);
|
||||
});
|
||||
|
||||
// set the station for location 0
|
||||
_locations[0].stationUrl = locList[0].stationUrl
|
||||
|
||||
// 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.stationName);
|
||||
loc.location.stationUrl = loc.stationUrl;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var initCount=0;
|
||||
function onLocationInit() {
|
||||
initCount++;
|
||||
if (initCount===locList.length) {
|
||||
allLocationsInit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function allLocationsInit() {
|
||||
|
||||
var location, cities=[], city;
|
||||
|
||||
// add locations removing any duplicate cities by name
|
||||
for(var loc of locList) {
|
||||
|
||||
if (_locations.filter(e => e.city == loc.location.city).length === 0) {
|
||||
_locations.push(loc.location);
|
||||
//loc.location.initForecasts();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this.trigger('allinit');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +1,121 @@
|
|||
var foreMarqueeDay = ""
|
||||
function GroupDataManager() {
|
||||
var locationx = {};
|
||||
var locations =
|
||||
[
|
||||
{name:'Chicago', n2:'IL'},
|
||||
{name:'Minneapolis', n2:'MN'},
|
||||
{name:'Tempe', n2:'AZ'},
|
||||
{name:'Fargo', n2:'ND'},
|
||||
{name:'North Hollywood', n2:'CA'},
|
||||
{name:'Los Angeles', n2:'CA'},
|
||||
{name:'Huntington Beach'},
|
||||
{name:'Las Vegas', n2:'NV'},
|
||||
{name:'Honolulu', n2:'HI'},
|
||||
{name:'Orlando', n2:'FL'},
|
||||
{name:'New York', n2:'NY'},
|
||||
{name:'Napa', n2:'CA'},
|
||||
{name:'Montego Bay', n2:''},
|
||||
{name:'Kona', n2:'HI'},
|
||||
{name:'Kalipaki Beach', n2:''},
|
||||
{name:'Ixtapa', n2:'MX'}
|
||||
]
|
||||
;
|
||||
var noreportmode = false;
|
||||
var marqueeforecasttype = 'forecast'
|
||||
//do audio thing and second marquee
|
||||
$(function(){
|
||||
weatherAudio.playCallback = function(tags) {
|
||||
$('.track-info').text('playing "' + tags.title + '" by ' + tags.artist);
|
||||
}
|
||||
$('#marquee2').text(weatherInfo.ad)
|
||||
$('#marquee2').marquee({
|
||||
speed: 170, pauseOnHover: true
|
||||
});
|
||||
});
|
||||
function MarqueeMan() {
|
||||
function switchToWarningMarquee(sidx) {
|
||||
if (weatherInfo.bulletin.severewarnings.length != 0) {
|
||||
$('#marqueeSevere').css("background","linear-gradient(to right, #510d08 0, #b41a08 100%)")
|
||||
$('.marqueeheadersevere').css("background","linear-gradient(to right, #d51e08 0, #b41a08 100%)")
|
||||
$('.marqueeheadersevere').css("color","#fff")
|
||||
$('.marqueeheadersevere').css("text-shadow","2px 2px 4px #000")
|
||||
|
||||
checkRefresh();
|
||||
setInterval(checkRefresh, 300000);
|
||||
|
||||
|
||||
// check to see if data needs to be refreshed
|
||||
function checkRefresh() {
|
||||
|
||||
|
||||
|
||||
// check the expiration
|
||||
var url = 'https://api.weather.com/v3/aggcommon/v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-location-point?geocodes='
|
||||
woeid = location.hasOwnProperty('woeid') ? location.woeid : '';
|
||||
$.getJSON("https://examples.opendatasoft.com/api/records/1.0/search/?dataset=largest-us-cities&q=&sort=population&facet=city&facet=state&refine.state=" + mainstate, function(data) {
|
||||
if (data !== undefined && data.records.length != 0) {
|
||||
data.records.forEach((city, i) => {
|
||||
url += (city.fields.coordinates).replace(';',',');
|
||||
url += ';'
|
||||
$('.marqueeheadersevere').text((weatherInfo.bulletin.severewarnings[sidx].name).toUpperCase() + ' ' + weatherInfo.bulletin.severewarnings[sidx].status);
|
||||
$('#arrow-img').fadeOut(0)
|
||||
$('#marqueeSevere').fadeIn(0)
|
||||
$('.marqueeheadersevere').fadeIn(0) //#868686
|
||||
$('#marqueeSevere').text(weatherInfo.bulletin.severewarnings[sidx].desc)
|
||||
$('#marqueeSevere')
|
||||
.marquee('destroy')
|
||||
.marquee({speed: 170, delayBeforeStart: 1000, pauseOnHover: true, pauseOnCycle: true})
|
||||
.on('finished', function(){
|
||||
switchSevereMarquee((sidx < weatherInfo.bulletin.severewarnings.length) ? sdix + 1 : 0)
|
||||
});
|
||||
weatherAudio.playwarningbeep()
|
||||
} else if (weatherInfo.bulletin.marqueewarnings.length != 0){
|
||||
if (weatherInfo.bulletin.marqueewarnings[0].significance == "Y" ||weatherInfo.bulletin.marqueewarnings[0].significance == "S") {
|
||||
$('#marqueeSevere').css('background','linear-gradient(to right, #853302 0, #a84503 100%)')
|
||||
$('.marqueeheadersevere').css("background","linear-gradient(to right, #e86d08 0, #a84403 100%)")
|
||||
$('.marqueeheadersevere').css("color","#000")
|
||||
$('.marqueeheadersevere').css("text-shadow", "0px 0px 0px #000")
|
||||
} else if (weatherInfo.bulletin.marqueewarnings[0].significance == "A") {
|
||||
$('#marqueeSevere').css("background", "linear-gradient(to right, #846811 0, #9b7d0e 100%)");
|
||||
$('.marqueeheadersevere').css('background', 'linear-gradient(to right, #e5dd20 0, #9b7d0e 100%)');
|
||||
$('.marqueeheadersevere').css("color", "#000");
|
||||
$('.marqueeheadersevere').css("text-shadow", "0px 0px 0px #000");
|
||||
} else if (weatherInfo.bulletin.marqueewarnings[0].significance == "W") {
|
||||
$('#marqueeSevere').css("background","linear-gradient(to right, #510d08 0, #b41a08 100%)")
|
||||
$('.marqueeheadersevere').css("background","linear-gradient(to right, #d51e08 0, #b41a08 100%)")
|
||||
$('.marqueeheadersevere').css("color","#fff")
|
||||
$('.marqueeheadersevere').css("text-shadow","2px 2px 4px #000")
|
||||
}
|
||||
$('.marqueeheadersevere').text((weatherInfo.bulletin.marqueewarnings[0].name).toUpperCase() + ' ' + weatherInfo.bulletin.marqueewarnings[0].status)
|
||||
$('#arrow-img').fadeOut(0)
|
||||
$('#marqueeSevere').fadeIn(0)
|
||||
$('.marqueeheadersevere').fadeIn(0)
|
||||
$('#marqueeSevere').text(weatherInfo.bulletin.marqueewarnings[0].desc)
|
||||
$('#marqueeSevere')
|
||||
.marquee({speed: 170, delayBeforeStart: 1000, pauseOnHover: true, pauseOnCycle: true})
|
||||
} else {
|
||||
$('#marqueeSevere')
|
||||
.marquee('destroy')
|
||||
$('#marqueeSevere').fadeOut(0)
|
||||
$('.marqueeheadersevere').fadeOut(0)
|
||||
$('#arrow-img').fadeIn(0)
|
||||
}
|
||||
|
||||
url += '&language=en-US&units=e&format=json&apiKey='+ api_key
|
||||
} else {
|
||||
url = 'https://api.weather.com/v3/aggcommon/v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-location-point?geocodes=41.881832,-87.623177;44.986656,-93.258133;33.427204,-111.939896;46.877186,-96.789803;34.187042,-118.381256;33.660057,-117.998970;36.114647,-115.172813;21.315603,-157.858093;28.538336,-81.379234;43.0,-75.0;&language=en-US&units=e&format=json&apiKey='+ api_key
|
||||
}
|
||||
pullData(url);
|
||||
}
|
||||
// for ccticker
|
||||
function displayCCTickerData() {
|
||||
var $span,$spanfor;
|
||||
// ajax the latest observation
|
||||
$(".marquee-current").remove()
|
||||
$(".marquee-fore").remove()
|
||||
if (weatherInfo.ccticker.noReport == true) {
|
||||
noreportmode = true
|
||||
$('#arrow-img').attr("src",'/images/arrow.png');
|
||||
} else {noreportmode == false}
|
||||
weatherInfo.ccticker.ccLocs.forEach((ccLoc, i) => {
|
||||
$span = $("<span class=marquee-current id='" + "cclocation" + i + "'></span>").appendTo('#marquee-now');
|
||||
$spanfor = $("<span class=marquee-fore id='" + "cclocation" + i + "'></span>").appendTo('#marquee-now');
|
||||
$span.text(ccLoc.displayname + ((noreportmode == true) ? "" : ccLoc.currentCond.temp + ' ' + ccLoc.currentCond.cond));
|
||||
$spanfor.css('display','none')
|
||||
$spanfor.text(ccLoc.displayname + ((noreportmode == true) ? "" : ccLoc.forecast.temp + ' ' + ccLoc.forecast.cond));
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function pullData(url) {
|
||||
var $span;
|
||||
|
||||
// ajax the latest observation
|
||||
$.getJSON(url, function(data) {
|
||||
data.forEach((locationdata, i) => {
|
||||
locationx.data = locationdata;
|
||||
|
||||
if ( !location.hasOwnProperty('woeid') ) {
|
||||
locationx.woeid = locationx.data.id;
|
||||
$span = $("<span class=marquee-now id='" + locationx.woeid + "'></span>").appendTo('#marquee-now');
|
||||
$spanfor = $("<span class=marquee-fore id='" + locationx.woeid + "'></span>").appendTo('#marquee-now');
|
||||
} else {
|
||||
$span = $('#marquee-now>span#' + locationx.woeid);
|
||||
}
|
||||
var marqueeidx = 1;
|
||||
if (locationx.data['v3-wx-forecast-daily-5day'].daypart[0].daypartName[0] == undefined) {marqueeidx = 2;};
|
||||
if (locationx.data['v3-wx-forecast-daily-5day'].daypart[0].daypartName[marqueeidx] == "Tonight") {foreMarqueeDay = 'tonight';} else {foreMarqueeDay = (locationx.data['v3-wx-forecast-daily-5day'].dayOfWeek[1].substring(0,3)).toLowerCase()};
|
||||
// display the current info
|
||||
$span.text(locationx.data['v3-location-point'].location.displayName + ': ' + Math.round(parseInt(locationx.data['v3-wx-observations-current'].temperature)) + ' ' + (locationx.data['v3-wx-observations-current'].wxPhraseLong).toLowerCase());
|
||||
$spanfor.css('display','none')
|
||||
$spanfor.text(locationx.data['v3-location-point'].location.displayName + ': ' + Math.round(parseInt(locationx.data['v3-wx-forecast-daily-5day'].daypart[0].temperature[marqueeidx])) + ' ' + (locationx.data['v3-wx-forecast-daily-5day'].daypart[0].wxPhraseLong[marqueeidx]).toLowerCase());
|
||||
|
||||
|
||||
// set the expiration date/time
|
||||
//location.xdate = dateFns.addMinutes(location.data.lastBuildDate, location.data.ttl);
|
||||
|
||||
function refreshMarquee () {
|
||||
if (marqueeforecasttype == 'now') {
|
||||
marqueeforecasttype = 'forecast'
|
||||
if (noreportmode == false) {
|
||||
$('#arrow-img').attr("src",'/images/' + weatherInfo.ccticker.arrow + 'arrow.png');
|
||||
}
|
||||
$('.marquee-fore').each(function(i, item) {
|
||||
item.style.display = ''
|
||||
});$('.marquee-current').each(function(i, item) {
|
||||
item.style.display = 'none'
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
marqueeforecasttype = 'now'
|
||||
if (noreportmode == false) {
|
||||
$('#arrow-img').attr("src",'/images/now.png');
|
||||
}
|
||||
$('.marquee-fore').each(function(i, item) {
|
||||
item.style.display = 'none'
|
||||
});
|
||||
$('.marquee-current').each(function(i, item) {
|
||||
item.style.display = ''
|
||||
});
|
||||
}
|
||||
$('#marquee-container')
|
||||
.marquee('destroy')
|
||||
.marquee({speed: 200, pauseOnHover:true, delayBeforeStart:3000})
|
||||
.on('finished', refreshMarquee);
|
||||
}
|
||||
//init and loop the things
|
||||
refreshMarquee();
|
||||
switchToWarningMarquee();
|
||||
displayCCTickerData();
|
||||
setInterval(function(){
|
||||
displayCCTickerData();
|
||||
switchToWarningMarquee();
|
||||
}, 300000)
|
||||
}
|
||||
|
|
|
@ -1,179 +0,0 @@
|
|||
function Location() { // onReady, onRefresh, onAllComplete
|
||||
|
||||
var that = this,
|
||||
$this = $(this),
|
||||
_forecastmgr,
|
||||
_observations=[];
|
||||
|
||||
this.temperature = function() {
|
||||
if (_observations[1]!=null && _observations[1].temperature.value) {
|
||||
return C2F(_observations[1].temperature.value);
|
||||
} else {
|
||||
return Math.round( _observations[0].temperature );
|
||||
}
|
||||
}
|
||||
|
||||
this.observations = function(i) {
|
||||
return _observations[i];
|
||||
};
|
||||
|
||||
this.forecasts=function(type){return _forecastmgr.forecast(type)};
|
||||
|
||||
this.init = function(searchString){
|
||||
checkRefresh(searchString);
|
||||
};
|
||||
|
||||
this.initForecasts = function() {
|
||||
// start the forecast data pull
|
||||
if (_observations[0] != undefined){
|
||||
_forecastmgr = new ForecastManager(_observations[0].latitude, _observations[0].longitude, function() {
|
||||
$this.trigger('ready');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// check to see if data needs to be refreshed
|
||||
function checkRefresh(location) {
|
||||
|
||||
// check the expiration
|
||||
if ( _observations[0]!=undefined && dateFns.isFuture( _observations[0].xdate ) ) {
|
||||
setTimeout(checkRefresh, getRandom(5000, 10000));
|
||||
return;
|
||||
}
|
||||
|
||||
// woeid is the id for the location to pull data for
|
||||
console.log(location);
|
||||
if (location != undefined) {
|
||||
var loclat = location.split(",")[0]
|
||||
var loclong = location.split(",")[1]
|
||||
//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=' + api_key
|
||||
|
||||
// ajax the latest observation
|
||||
$.getJSON(url, function(data) {
|
||||
if (data['v3-location-point'] != null) {
|
||||
_observations[0] = json = data['v3-wx-observations-current'];
|
||||
_observations[0].latitude = loclat;
|
||||
_observations[0].longitude = loclong;
|
||||
_observations[0].cityname = data['v3-location-point'].location.displayName;
|
||||
$this.trigger('refresh');
|
||||
|
||||
// the following block only runs on init
|
||||
if (that.woeid===undefined) {
|
||||
|
||||
that.woeid = loclat;
|
||||
|
||||
that.lat = loclat;
|
||||
that.long = loclong;
|
||||
|
||||
that.city = data['v3-location-point'].location.displayName;
|
||||
|
||||
|
||||
$this.trigger('init');
|
||||
}
|
||||
// set the expiration date/time
|
||||
_observations[0].xdate = dateFns.addMinutes(json.lastBuildDate, json.ttl);
|
||||
|
||||
setTimeout(function() {checkRefresh(loclat + "," + loclong)}, 100000);
|
||||
} else {
|
||||
$this.trigger('init');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// pull observations from the location observation station
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function ForecastManager (latitude, longitude, readyCallback) {
|
||||
var _forecasts = {},
|
||||
keys =['alert','daily','hourly','almanac','pollen','achesindex','breathindex','airquality','forecastuvindex', 'uvindex'],
|
||||
key,
|
||||
readycount = 0;
|
||||
|
||||
for(key of keys) {
|
||||
_forecasts[key] = new Forecast(key, latitude, longitude, count);
|
||||
}
|
||||
|
||||
|
||||
function count() {
|
||||
// count up completed forecast pulls
|
||||
readycount++;
|
||||
if (readycount===keys.length) {
|
||||
readyCallback();
|
||||
}
|
||||
}
|
||||
|
||||
this.forecast = function(type) {
|
||||
try{
|
||||
return _forecasts[type].data;
|
||||
} catch(err){}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Forecast(type, lat, lon, readyCallback) {
|
||||
|
||||
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=" + api_key
|
||||
} 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=" + api_key
|
||||
} else if (type == 'alert') {
|
||||
url = 'https://api.weather.com/v3/alerts/headlines?geocode=' + lat + ',' + lon + "&format=json&language=en-US&apiKey=" + api_key
|
||||
} 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=" + api_key
|
||||
} else if (type == 'pollen') {
|
||||
url = 'https://api.weather.com/v1/geocode/'+ lat + '/' + lon + '/observations/pollen.json?language=en-US&apiKey=' + api_key
|
||||
} else if (type == 'achesindex') {
|
||||
url = 'https://api.weather.com/v2/indices/achePain/daypart/3day?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=" + api_key
|
||||
} else if (type == 'breathindex') {
|
||||
url = 'https://api.weather.com/v2/indices/breathing/daypart/3day?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=" + api_key
|
||||
} else if (type == 'airquality') {
|
||||
url = 'https://api.weather.com/v3/wx/globalAirQuality?geocode=' + lat + ',' + lon + "&language=en-US&scale=EPA&format=json&apiKey=" + api_key
|
||||
} else if (type == 'forecastuvindex') {
|
||||
url = 'https://api.weather.com/v2/indices/uv/hourly/48hour?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=" + api_key
|
||||
}else if (type == 'uvindex') {
|
||||
url = 'https://api.weather.com/v2/indices/uv/current?geocode=' + lat + ',' + lon + "&language=en-US&format=json&apiKey=" + api_key
|
||||
}
|
||||
|
||||
this.data = {};
|
||||
|
||||
checkRefresh();
|
||||
|
||||
function checkRefresh() {
|
||||
|
||||
// check the expiration
|
||||
if ( that.data!={} && dateFns.isFuture( that.data.xdate ) ) {
|
||||
setTimeout(function() {checkRefresh}, 100000);
|
||||
return;
|
||||
}
|
||||
|
||||
// ajax the forecast
|
||||
$.getJSON(url, function(data) {
|
||||
|
||||
that.data = data
|
||||
|
||||
// trigger ready callback on first data pull
|
||||
|
||||
// set the expiration date/time
|
||||
})
|
||||
.always(function() {
|
||||
if (readyCallback){
|
||||
readyCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,164 +1,245 @@
|
|||
var severemode
|
||||
function Loops(bindDataManager) {
|
||||
var //dataManager,
|
||||
obsData,
|
||||
foreDataDaily,
|
||||
foreDataHourly;
|
||||
|
||||
obsData = bindDataManager.observations;
|
||||
foreDataDaily = bindDataManager.forecasts('daily');
|
||||
foreDataHourly = bindDataManager.forecasts('hourly');
|
||||
|
||||
var loopssevereweathermode = false;
|
||||
var displayingAtmospheric = false;
|
||||
var miniMap;
|
||||
function Loops() {
|
||||
|
||||
// init the display loops
|
||||
displayAtmospheric(0);
|
||||
|
||||
displayForecast(0);
|
||||
refreshObservationDisplay()
|
||||
setInterval(refreshObservationDisplay,300000);
|
||||
|
||||
}
|
||||
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)
|
||||
if (miniMap===undefined) {
|
||||
miniMap = new Radar("minimap", 3, 7, maincitycoords.lat, maincitycoords.lon);
|
||||
}
|
||||
}
|
||||
} 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) + '")');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function displayAtmospheric(idx) {
|
||||
|
||||
if (weatherInfo.currentCond.sidebar.noReport == false){
|
||||
displayingAtmospheric = true;
|
||||
var displays = {
|
||||
conditions() {
|
||||
return (obsData(0).wxPhraseLong).toLowerCase();
|
||||
return (weatherInfo.currentCond.sidebar.cond).toLowerCase();
|
||||
},
|
||||
|
||||
wind(){ return 'wind ' + ((obsData(0).windDirectionCardinal == "CALM") ? 'calm' : obsData(0).windDirectionCardinal) + ' ' + ((obsData(0).windSpeed === 0) ? '' : obsData(0).windSpeed); },
|
||||
wind(){ return 'wind ' + weatherInfo.currentCond.sidebar.wind; },
|
||||
|
||||
gusts(){
|
||||
if ( obsData(1)!=undefined ) {
|
||||
return obsData(1).windGust.value!=null ? 'gusts ' + obsData(1).windGust.value : '';
|
||||
if ( weatherInfo.currentCond.sidebar.gust!=undefined ) {
|
||||
return (weatherInfo.currentCond.sidebar.gust!="none") ? 'gusts ' + weatherInfo.currentCond.sidebar.gust : '';
|
||||
}
|
||||
},
|
||||
|
||||
humidity(){ return 'humidity ' + obsData(0).relativeHumidity + '%'; },
|
||||
humidity(){ return 'humidity ' + weatherInfo.currentCond.sidebar.humid + '%'; },
|
||||
|
||||
dewpoint(){ return 'dew point ' + obsData(0).temperatureDewPoint + '°'; },
|
||||
dewpoint(){ return 'dew point ' + weatherInfo.currentCond.sidebar.dewpt + '°'; },
|
||||
|
||||
heatindex_windchill(){
|
||||
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 + '°';
|
||||
} else if (parseInt(obsData(0).temperature)>=80 && parseInt(obsData(0).relativeHumidity)>=40 ){
|
||||
return 'heat index ' + heatIndex(obsData(0).temperature, obsData(0).relativeHumidity) + '°';
|
||||
if (weatherInfo.currentCond.sidebar.feelslike.type != "dontdisplay") {
|
||||
return weatherInfo.currentCond.sidebar.feelslike.type + " " + weatherInfo.currentCond.sidebar.feelslike.val + '°'
|
||||
}
|
||||
else return '';
|
||||
},
|
||||
|
||||
pressure(){ return 'pressure ' + obsData(0).pressureAltimeter },
|
||||
//+ ['S','R','F'][obsData(0).current.rising];
|
||||
visibility() { return 'visibility ' + obsData(0).visibility + ' mile' + (obsData(0).visibility != 1 ? 's' : ''); },
|
||||
pressure(){ return 'pressure ' + weatherInfo.currentCond.sidebar.pressure + ' ' + weatherInfo.currentCond.sidebar.pressureTrend},
|
||||
|
||||
uvindex() { return 'UV index ' + obsData(0).uvDescription; },
|
||||
visibility() { return 'visibility ' + weatherInfo.currentCond.sidebar.visibility + ' mile' + (weatherInfo.currentCond.sidebar.visibility != 1 ? 's' : ''); },
|
||||
|
||||
uvindex() { return 'UV index ' + weatherInfo.currentCond.sidebar.uvidx; },
|
||||
|
||||
},
|
||||
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 + '°'
|
||||
$('#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 (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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {displayingAtmospheric = false}
|
||||
} // end function
|
||||
|
||||
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);
|
||||
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
|
||||
|
||||
function displayForecast(idx) {
|
||||
|
||||
var displays = {
|
||||
|
||||
text1() {
|
||||
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] : ''));
|
||||
}
|
||||
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)')
|
||||
$('#forecast-tiles').fadeOut(0)
|
||||
$('#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);
|
||||
}
|
||||
},
|
||||
text2() {
|
||||
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] : ''));
|
||||
}
|
||||
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)
|
||||
$('#forecast-tiles').fadeOut(0)
|
||||
$('#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);
|
||||
}
|
||||
},
|
||||
|
||||
fiveday() {
|
||||
var newtile, weekend, icons,
|
||||
startidx = (foreDataDaily.daypart[0].daypartName[0] != null ? 0 : 2);
|
||||
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)
|
||||
$('#forecast-tiles').fadeOut(0)
|
||||
$('#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;
|
||||
|
||||
$('#forecast-title').text("5 DAY FORECAST");
|
||||
$('#forecast-tiles').empty();
|
||||
|
||||
for (var i=startidx; i<=(startidx + 8); i+=2 ) {
|
||||
for (var i=0; i<5; i++ ) {
|
||||
newtile = $("<div class='forecast-tile daily" + weatherInfo.fiveDay.lowerbar.day[i].weekend + "'></div>");
|
||||
|
||||
weekend = ( dateFns.isWeekend(foreDataDaily.validTimeLocal[i/2]) ? ' weekend' : '');
|
||||
newtile = $("<div class='forecast-tile daily" + weekend + "'></div>");
|
||||
$("<div class='header'></div>") .appendTo(newtile) .text(weatherInfo.fiveDay.lowerbar.day[i].name);
|
||||
|
||||
$("<div class='header'></div>") .appendTo(newtile) .text((foreDataDaily.dayOfWeek[i/2]).substring(0,3));
|
||||
|
||||
icons = getCCicon(+foreDataDaily.daypart[0].iconCode[i], foreDataDaily.daypart[0].windSpeed[i]);
|
||||
icons = getCCicon(+weatherInfo.fiveDay.lowerbar.day[i].icon, weatherInfo.fiveDay.lowerbar.day[i].windspeed);
|
||||
|
||||
$("<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]);
|
||||
$("<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);
|
||||
|
||||
$('#forecast-tiles').append(newtile);
|
||||
}
|
||||
|
||||
$('#forecast-tiles').css('display','flex');
|
||||
}
|
||||
},
|
||||
|
||||
hourly() {
|
||||
var newtile, icons, sizer, highbar,
|
||||
indexes = calcHourlyReport(foreDataHourly),
|
||||
data, label, temps=[];
|
||||
|
||||
$('#forecast-title').text( buildHourlyHeaderTitle(foreDataHourly.validTimeLocal[indexes[0]]) );
|
||||
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)
|
||||
$('#forecast-tiles').fadeOut(0)
|
||||
$('#forecast-noreport').fadeIn(0)
|
||||
} else {
|
||||
$('#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 );
|
||||
$('#forecast-tiles').empty();
|
||||
|
||||
for (var i of indexes) {
|
||||
data = foreDataHourly;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
|
||||
newtile = $("<div class='forecast-tile hourly'></div>");
|
||||
sizer = $("<div class='width-sizer'></div>").appendTo(newtile);
|
||||
|
||||
icons = getCCicon(data.iconCode[i], data.windSpeed[i]);
|
||||
|
||||
icons = getCCicon(weatherInfo.dayPart.lowerbar.hour[i].icon, weatherInfo.dayPart.lowerbar.hour[i].windspeed);
|
||||
$("<img class='icon' src=''/>") .appendTo(sizer) .attr('src', icons);
|
||||
|
||||
|
||||
$("<div class='footer'></div>") .appendTo(newtile) .text(buildHourlyTimeTitle(data.validTimeLocal[i]));
|
||||
$("<div class='footer'></div>") .appendTo(newtile) .text(weatherInfo.dayPart.lowerbar.hour[i].time);
|
||||
|
||||
highbar = $("<div class='hourly-high'></div>") .appendTo(sizer);
|
||||
|
||||
$("<div class='high'></div>") .appendTo(highbar) .text(data.temperature[i]);
|
||||
temps.push(data.temperature[i]);
|
||||
$("<div class='high'></div>") .appendTo(highbar) .text(weatherInfo.dayPart.lowerbar.hour[i].temp);
|
||||
temps.push(weatherInfo.dayPart.lowerbar.hour[i].temp);
|
||||
|
||||
$("<div class='temp-bar'></div>") .appendTo(highbar);
|
||||
|
||||
|
@ -170,7 +251,7 @@ function Loops(bindDataManager) {
|
|||
// animate grow and show temp
|
||||
var min = Math.min(...temps), // 54
|
||||
max = Math.max(...temps), // 73
|
||||
range = (max-min),
|
||||
range = ((max-min) != 0) ? (max-min) : .001,
|
||||
prange = (95-78), // percent range for bar height
|
||||
temp, value;
|
||||
$('.forecast-tile').each(function(){
|
||||
|
@ -180,10 +261,10 @@ function Loops(bindDataManager) {
|
|||
$(this).find('.high').fadeTo('slow', 1);
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
dummy(){}
|
||||
|
||||
},
|
||||
keys = Object.keys(displays);
|
||||
|
||||
|
@ -214,10 +295,10 @@ function Loops(bindDataManager) {
|
|||
|
||||
|
||||
|
||||
} // end Loops class
|
||||
// end Loops class
|
||||
|
||||
|
||||
function buildHourlyHeaderTitle(time) {
|
||||
/*function buildHourlyHeaderTitle(time) {
|
||||
var today = new Date(),
|
||||
tomorrow = dateFns.addDays(today, 1),
|
||||
sforecast = "'s Forecast";
|
||||
|
@ -305,75 +386,7 @@ function calcHourlyReport(data) {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function mapNWSicons(url){
|
||||
var map = {
|
||||
skc:[26,25],
|
||||
few:[28,27],
|
||||
sct:[24,23],
|
||||
bkn:[22,21],
|
||||
ovc:[20,20],
|
||||
wind_skc:[26,25,47],
|
||||
wind_few:[28,27,47],
|
||||
wind_sct:[24,23,47],
|
||||
wind_bkn:[22,21,47],
|
||||
wind_ovc:[20,20,47],
|
||||
snow:[10,10],
|
||||
rain_snow:[2,2],
|
||||
rain_sleet:[38,38],
|
||||
snow_sleet:[3,3],
|
||||
fzra:[6,6],
|
||||
rain_fzra:[6,6],
|
||||
snow_fzra:[44,44],
|
||||
sleet:[13,13],
|
||||
rain:[8,8],
|
||||
rain_showers:[7,7],
|
||||
rain_showers_hi:[5,5],
|
||||
tsra:[1,1],
|
||||
tsra_sct:[29,37],
|
||||
tsra_hi:[29,37],
|
||||
tornado:[46,46],
|
||||
hurr_warn:[45,45],
|
||||
hurr_watch:[45,45],
|
||||
ts_warn:[45,45],
|
||||
ts_watch:[45,45],
|
||||
ts_hurr_warn:[45,45],
|
||||
dust:[14,14],
|
||||
smoke:[16,16],
|
||||
haze:[16,16],
|
||||
hot:[16,16],
|
||||
cold:[42,42],
|
||||
blizzard:[11,11],
|
||||
fog:[15,15]
|
||||
},
|
||||
matches = url.match(/icons\/land\/(day|night)\/([a-z_]*)\/?([a-z_]*)/), // day or night followed by one or more condition codes
|
||||
idx = {day:0, night:1}[matches[1]],
|
||||
ret=[], match;
|
||||
|
||||
for (i=2; i<matches.length; i++){
|
||||
|
||||
if (matches[i]) {
|
||||
match = map[ matches[i] ];
|
||||
|
||||
ret.push( match[idx] );
|
||||
|
||||
// some icons are 2 layered
|
||||
if (match.length>2) {
|
||||
ret.push( match[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// place word icons last so they render on top
|
||||
if (ret.length>1 && [15,47,41,42, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 20, 31, 33, 34, 38, 39, 40, 44].indexOf( ret[1] )>-1) {
|
||||
ret.swap(0,1);
|
||||
}
|
||||
|
||||
return ret.map(function(num){
|
||||
return 'images/icons/' + ('0'+num).slice(-2) + '.png';
|
||||
});
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
@ -388,156 +401,3 @@ uv index High
|
|||
partly cloudy
|
||||
|
||||
*/
|
||||
|
||||
// sample data
|
||||
/*
|
||||
|
||||
https://query.yahooapis.com/v1/public/yql?format=json&q=select * from weather.forecast where woeid=2402292
|
||||
|
||||
"units":{
|
||||
"distance":"mi",
|
||||
"pressure":"in",
|
||||
"speed":"mph",
|
||||
"temperature":"F"
|
||||
},
|
||||
"title":"Yahoo! Weather - Fargo, ND, US",
|
||||
"link":"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2402292/",
|
||||
"description":"Yahoo! Weather for Fargo, ND, US",
|
||||
"language":"en-us",
|
||||
"lastBuildDate":"Thu, 12 Oct 2017 10:10 PM CDT",
|
||||
"ttl":"60",
|
||||
"location":{
|
||||
"city":"Fargo",
|
||||
"country":"United States",
|
||||
"region":" ND"
|
||||
},
|
||||
"wind":{
|
||||
"chill":"52",
|
||||
"direction":"295",
|
||||
"speed":"18"
|
||||
},
|
||||
"atmosphere":{
|
||||
"humidity":"54",
|
||||
"pressure":"978.0",
|
||||
"rising":"0",
|
||||
"visibility":"16.1"
|
||||
},
|
||||
"astronomy":{
|
||||
"sunrise":"7:41 am",
|
||||
"sunset":"6:46 pm"
|
||||
},
|
||||
"image":{
|
||||
"title":"Yahoo! Weather",
|
||||
"width":"142",
|
||||
"height":"18",
|
||||
"link":"http://weather.yahoo.com",
|
||||
"url":"http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"
|
||||
},
|
||||
"item":{
|
||||
"title":"Conditions for Fargo, ND, US at 09:00 PM CDT",
|
||||
"lat":"46.865089",
|
||||
"long":"-96.829224",
|
||||
"link":"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2402292/",
|
||||
"pubDate":"Thu, 12 Oct 2017 09:00 PM CDT",
|
||||
"condition":{
|
||||
"code":"27",
|
||||
"date":"Thu, 12 Oct 2017 09:00 PM CDT",
|
||||
"temp":"55",
|
||||
"text":"Mostly Cloudy"
|
||||
},
|
||||
"forecast":[
|
||||
{
|
||||
"code":"30",
|
||||
"date":"12 Oct 2017",
|
||||
"day":"Thu",
|
||||
"high":"70",
|
||||
"low":"48",
|
||||
"text":"Partly Cloudy"
|
||||
},
|
||||
{
|
||||
"code":"32",
|
||||
"date":"13 Oct 2017",
|
||||
"day":"Fri",
|
||||
"high":"58",
|
||||
"low":"37",
|
||||
"text":"Sunny"
|
||||
},
|
||||
{
|
||||
"code":"39",
|
||||
"date":"14 Oct 2017",
|
||||
"day":"Sat",
|
||||
"high":"49",
|
||||
"low":"38",
|
||||
"text":"Scattered Showers"
|
||||
},
|
||||
{
|
||||
"code":"34",
|
||||
"date":"15 Oct 2017",
|
||||
"day":"Sun",
|
||||
"high":"56",
|
||||
"low":"31",
|
||||
"text":"Mostly Sunny"
|
||||
},
|
||||
{
|
||||
"code":"34",
|
||||
"date":"16 Oct 2017",
|
||||
"day":"Mon",
|
||||
"high":"65",
|
||||
"low":"35",
|
||||
"text":"Mostly Sunny"
|
||||
},
|
||||
{
|
||||
"code":"34",
|
||||
"date":"17 Oct 2017",
|
||||
"day":"Tue",
|
||||
"high":"65",
|
||||
"low":"39",
|
||||
"text":"Mostly Sunny"
|
||||
},
|
||||
{
|
||||
"code":"30",
|
||||
"date":"18 Oct 2017",
|
||||
"day":"Wed",
|
||||
"high":"64",
|
||||
"low":"48",
|
||||
"text":"Partly Cloudy"
|
||||
},
|
||||
{
|
||||
"code":"30",
|
||||
"date":"19 Oct 2017",
|
||||
"day":"Thu",
|
||||
"high":"65",
|
||||
"low":"44",
|
||||
"text":"Partly Cloudy"
|
||||
},
|
||||
{
|
||||
"code":"30",
|
||||
"date":"20 Oct 2017",
|
||||
"day":"Fri",
|
||||
"high":"66",
|
||||
"low":"49",
|
||||
"text":"Partly Cloudy"
|
||||
},
|
||||
{
|
||||
"code":"28",
|
||||
"date":"21 Oct 2017",
|
||||
"day":"Sat",
|
||||
"high":"61",
|
||||
"low":"49",
|
||||
"text":"Mostly Cloudy"
|
||||
}
|
||||
],
|
||||
"description":"<![CDATA[<img src=\"http://l.yimg.com/a/i/us/we/52/27.gif\"/>\n<BR />\n<b>Current Conditions:</b>\n<BR />Mostly Cloudy\n<BR />\n<BR />\n<b>Forecast:</b>\n<BR /> Thu - Partly Cloudy. High: 70Low: 48\n<BR /> Fri - Sunny. High: 58Low: 37\n<BR /> Sat - Scattered Showers. High: 49Low: 38\n<BR /> Sun - Mostly Sunny. High: 56Low: 31\n<BR /> Mon - Mostly Sunny. High: 65Low: 35\n<BR />\n<BR />\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2402292/\">Full Forecast at Yahoo! Weather</a>\n<BR />\n<BR />\n<BR />\n]]>",
|
||||
"guid":{
|
||||
"isPermaLink":"false"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Current Conditions:</b>\n<BR />Mostly Cloudy\n<BR />\n<BR />\n<b>
|
||||
Forecast:</b>\n<BR /> Thu - Partly Cloudy. High: 70Low: 48\n<BR /> Fri - Sunny. High: 58Low: 37\n<BR /> Sat - Scattered Showers. High: 49Low: 38\n<BR /> Sun - Mostly Sunny. High: 56Low: 31\n<BR />
|
||||
Mon - Mostly Sunny. High: 65Low: 35\n<BR />\n<BR />\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2402292/\">Full Forecast at Yahoo! Weather</a>\n<BR />\n<BR />\n<BR />\n]]>",
|
||||
"guid":{
|
||||
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@ $(function(){
|
|||
mainAspect = 4/3,
|
||||
resizeTimer;
|
||||
|
||||
|
||||
//calls rescale when window resizes
|
||||
$(window).resize( function(e) {
|
||||
clearTimeout(resizeTimer);
|
||||
resizeTimer = setTimeout(scaleWindow, 100);
|
||||
|
@ -26,6 +26,9 @@ $(function(){
|
|||
$main.css({
|
||||
transform: "translate(-50%, -50%) " + "scale(" + scale + ")"
|
||||
});
|
||||
$("#startup").css({
|
||||
transform: "translate(-50%, -50%) " + "scale(" + scale + ")"
|
||||
});
|
||||
}
|
||||
scaleWindow(); // init
|
||||
|
||||
|
|
|
@ -0,0 +1,873 @@
|
|||
function Intro() {
|
||||
let animationtime, rotatex, rotatey, rotatez;
|
||||
function spinything() {
|
||||
animationtime = Math.floor(Math.random() * (12 - 3 + 1)) + 3
|
||||
rotatex = (Math.floor(-100 + Math.random()*(100 + 1 - -100)))/100
|
||||
rotatey = (Math.floor(-100 + Math.random()*(100 + 1 - -100)))/100
|
||||
rotatez = (Math.floor(-100 + Math.random()*(100 + 1 - -100)))/100
|
||||
$("#headendid").text("headend id: 0"+Math.round(Math.random()*100000))
|
||||
$("#serialnumber").text("serial number: TWCS"+"0"+Math.round(Math.random()*100000000))
|
||||
$("#affilatename").text("affiliatename: Midco")
|
||||
$(".intellistarlogo").css( { transition: `transform 5s linear`,
|
||||
transform: `rotate3d(${rotatex}, ${rotatey}, ${rotatez}, ${.25 + Math.random()}turn)` } );
|
||||
setTimeout(function () {
|
||||
$("#startup").fadeOut(0);
|
||||
}, 5000)
|
||||
|
||||
};
|
||||
spinything()
|
||||
};
|
||||
$(function(){
|
||||
Intro()
|
||||
})
|
||||
|
||||
//time manager
|
||||
setInterval(
|
||||
function () {
|
||||
var today = new Date();
|
||||
|
||||
$('#date').text( today.toString().slice(4,10).trimRight() );
|
||||
$('#time').text( today.toLocaleTimeString('en-US', { hour: 'numeric', hour12: true, minute: 'numeric', second: 'numeric' }).replace(/ /g,'') );
|
||||
}
|
||||
, 1000);
|
||||
//location pull
|
||||
var maincitycoords = {name:"",lat:"",lon:""}, marinelocation,
|
||||
locList = [], citySlideList = [], state, ccTickerCitiesList = [];
|
||||
|
||||
|
||||
//If there is a location inputted, use that.
|
||||
|
||||
queryString = window.location.search;
|
||||
|
||||
function getMainLoc(onInit) {
|
||||
if (queryString) {
|
||||
$.getJSON("https://api.weather.com/v3/location/search?query="+queryString.split("?")[1]+"&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
if (onInit==true){
|
||||
getExtraLocs(data.location.latitude[0],data.location.longitude[0],true);
|
||||
maincitycoords.lat = data.location.latitude[0]
|
||||
maincitycoords.lon = data.location.longitude[0]
|
||||
maincitycoords.name = data.location.displayName[0]
|
||||
$("#locationname").text("location name: "+data.location.displayName[0])
|
||||
maincitycoords.displayname = data.location.displayName[0]
|
||||
state = data.location.adminDistrict[0];
|
||||
//init data
|
||||
getStatePopularCities(state, true)
|
||||
grabAlamanacSlidesData()
|
||||
grabHealthData()
|
||||
grabSideandLowerBarData()
|
||||
} else {
|
||||
//for settings
|
||||
mainlocationdata = {name:data.location[0].displayName,displayname:data.location[0].displayName,lat:data.location[0].latitude,lon:data.location[0].longitude,state:data.location.adminDistrict[0]};
|
||||
updateonResetMainLoc()
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// get lat lon from user's ip
|
||||
$.getJSON("http://ip-api.com/json/?callback=?", function(data) {
|
||||
if (onInit==true){
|
||||
getExtraLocs(data.lat,data.lon,true);
|
||||
maincitycoords.name = data.city
|
||||
$("#locationname").text("location name: "+data.city)
|
||||
maincitycoords.displayname = data.city
|
||||
maincitycoords.lat = data.lat
|
||||
maincitycoords.lon = data.lon
|
||||
state = data.regionName
|
||||
//init data
|
||||
getStatePopularCities(state, true)
|
||||
grabAlamanacSlidesData()
|
||||
grabHealthData()
|
||||
grabSideandLowerBarData()
|
||||
} else {
|
||||
//for settings
|
||||
mainlocationdata = {name:data.city,displayname:data.city,lat:data.lat,lon:data.lon,state:data.regionName};
|
||||
updateonResetMainLoc()
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
getMainLoc(true);
|
||||
|
||||
function getExtraLocs(lat,lon, onInit, whichReset) {
|
||||
$.getJSON('https://api.weather.com/v3/location/near?geocode=' + lat + ',' + lon + '&product=observation&format=json&apiKey=' + api_key, function(data) {
|
||||
|
||||
var feature = data.location, geo, station, dist, ti=0;
|
||||
var minRadiusMiles = 0, maxRadiusMiles = 45;
|
||||
getLocLoop(0);
|
||||
function getLocLoop(i) {
|
||||
$.getJSON("https://api.weather.com/v3/location/point?geocode="+ feature.latitude[i] + "," + feature.longitude[i] + "&language=en-US&format=json&apiKey=" + api_key, function(dataii){
|
||||
latgeo = feature.latitude[i];
|
||||
longeo = feature.longitude[i];
|
||||
dist = feature.distanceMi[i];
|
||||
displayname = dataii.location.displayName
|
||||
if (displayname == maincitycoords.displayname || displayname == state) {
|
||||
if ((dataii.location.locale.locale3 != maincitycoords.displayname && dataii.location.locale.locale3) || (dataii.location.locale.locale4 != maincitycoords.displayname && dataii.location.locale.locale4)) {
|
||||
displayname = (dataii.location.locale.locale3 != maincitycoords.displayname && dataii.location.locale.locale3) ? dataii.location.locale.locale3 : dataii.location.locale.locale4
|
||||
} else {
|
||||
if (feature.latitude.length == (i + 1)) {onExtraAjaxFinish()} else {getLocLoop(i + 1)}
|
||||
return
|
||||
}
|
||||
}
|
||||
for (var li = 0; li < citySlideList.length; li++) {
|
||||
if (displayname == citySlideList[li].displayname) {
|
||||
if ((dataii.location.locale.locale3 != citySlideList[li].displayname && dataii.location.locale.locale3) || (dataii.location.locale.locale4 != citySlideList[li].displayname && dataii.location.locale.locale4)) {
|
||||
displayname = (dataii.location.locale.locale3 != citySlideList[li].displayname && dataii.location.locale.locale3) ? dataii.location.locale.locale3 : dataii.location.locale.locale4
|
||||
} else {
|
||||
if (feature.latitude.length == (i + 1)) {onExtraAjaxFinish()} else {getLocLoop(i + 1)}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i!=0) {
|
||||
if (onInit==true) {
|
||||
citySlideList.push({lat: latgeo, lon:longeo, distance:dist, stationUrl:feature.stationId[i], name:displayname, displayname:displayname});
|
||||
} else {
|
||||
//for settings
|
||||
if (whichReset=="8slide"){
|
||||
city8slidedata.push({lat: latgeo, lon:longeo, distance:dist, stationUrl:feature.stationId[i], name:displayname, displayname:displayname});
|
||||
}
|
||||
}
|
||||
};
|
||||
displayname = dataii.location.displayName
|
||||
if (displayname == maincitycoords.displayname || displayname == state) {
|
||||
if (feature.latitude.length == (i + 1)) {onExtraAjaxFinish()} else {getLocLoop(i + 1)}
|
||||
return
|
||||
}
|
||||
for (var li = 0; li < locList.length; li++) {
|
||||
if (displayname == locList[li].displayname) {
|
||||
if (feature.latitude.length == (i + 1)) {onExtraAjaxFinish()} else {getLocLoop(i + 1)}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (dist >= minRadiusMiles && dist <= maxRadiusMiles) {
|
||||
if (ti < 3) {
|
||||
if (onInit==true) {
|
||||
locList.push({lat: latgeo, lon:longeo, distance:dist, stationUrl:feature.stationId[i], name:displayname, displayname:displayname});
|
||||
} else {
|
||||
//for settinngs
|
||||
if (whichReset=="extralocation") {
|
||||
extralocsdata.push({lat: latgeo, lon:longeo, distance:dist, stationUrl:feature.stationId[i], name:displayname, displayname:displayname});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ti = ti - 1
|
||||
}
|
||||
//for the 8 city slide
|
||||
if (i < data.location.stationName.length && (citySlideList.length < 8 || locList.length < 3)) {
|
||||
ti = ti + 1
|
||||
i = i + 1
|
||||
getLocLoop(i)
|
||||
} else {onExtraAjaxFinish()};
|
||||
|
||||
}).fail(function(){
|
||||
if (feature.latitude.length >= (i + 1) || i >= 9) {onExtraAjaxFinish()} else {getLocLoop(i + 1)}
|
||||
})
|
||||
}
|
||||
|
||||
// sort list by distance
|
||||
function onExtraAjaxFinish () {
|
||||
if (onInit==true) {
|
||||
locList.sort(function(a, b) {
|
||||
return parseInt(a.distance) - parseInt(b.distance);
|
||||
});
|
||||
grabCitySlidesData()
|
||||
} else {
|
||||
//for settings
|
||||
if (whichReset=="extralocation") {
|
||||
extralocsdata.sort(function(a, b) {
|
||||
return parseInt(a.distance) - parseInt(b.distance);
|
||||
});
|
||||
}
|
||||
updateLocs(whichReset)
|
||||
}
|
||||
// set the station for location 0
|
||||
//_locations[0].stationUrl = locList[0].stationUrl
|
||||
//start datapull
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getStatePopularCities(state, onInit) {
|
||||
$.getJSON("https://examples.opendatasoft.com/api/records/1.0/search/?dataset=largest-us-cities&q=&sort=population&facet=city&facet=state&refine.state=" + state, function(data) {
|
||||
if (data !== undefined && data.records.length != 0) {
|
||||
data.records.forEach((city, i) => {
|
||||
if (onInit==true) {
|
||||
ccTickerCitiesList.push({name:city.fields.city,displayname:city.fields.city,lat:(city.fields.coordinates).split(';')[0],lon:(city.fields.coordinates).split(';')[1]})
|
||||
} else {
|
||||
cctickerdata.push({name:city.fields.city,displayname:city.fields.city,lat:(city.fields.coordinates).split(';')[0],lon:(city.fields.coordinates).split(';')[1]})
|
||||
updateLocs("cctickerloc")
|
||||
};
|
||||
if (i == (data.records.length - 1)) {pullCCTickerData()};
|
||||
});
|
||||
} else {
|
||||
//if nothing just run the function and use placeholder locs
|
||||
pullCCTickerData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var weatherInfo = { currentCond: {
|
||||
sidebar: {noReport:false,displayname:"",temp:"",cond:"",icon:"",humid:"",dewpt:"",pressure:"",wind:"",windspeed:"",gust:"",feelslike:{type:"",val:""},visibility:"",uvidx:"",ceiling:""},
|
||||
//loc:{noReport:"",displayname:"",temp:"",cond:"",icon:"",humid:"",dewpt:"",pressure:"",pressureTrend:"",wind:"",windspeed:"",gust:"",feelslike:{type:"",val:""},},
|
||||
weatherLocs:[],
|
||||
}, dayPart: {
|
||||
lowerbar:{noReport:false,displayname:"",daytitle:"",hour:[{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},]},
|
||||
/*loc:{noReport:"",displayname:"",daytitle:"",hour:[
|
||||
{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},
|
||||
{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},
|
||||
{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},
|
||||
{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},
|
||||
]},*/
|
||||
weatherLocs:[],
|
||||
}, dayDesc: {
|
||||
lowerbar: {noReport:false,displayname:"",day:[{name:"",desc:""},{name:"",desc:""},{name:"",desc:""},{name:"",desc:""}]},
|
||||
/*loc:{noReport:"",displayname:"",day:[
|
||||
{name:"",desc:""},
|
||||
{name:"",desc:""},
|
||||
{name:"",desc:""},
|
||||
{name:"",desc:""}
|
||||
]},*/
|
||||
weatherLocs:[]
|
||||
}, fiveDay: {
|
||||
lowerbar: {noReport:false,displayname:"",day:[{name:"",cond:"",icon:"",high:"",low:"",windspeed:"",weekend:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:"",weekend:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:"",weekend:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:"",weekend:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:"",weekend:""}]},
|
||||
/*loc:{noReport:"",displayname:"",day:[
|
||||
{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},
|
||||
{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},
|
||||
{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},
|
||||
{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},
|
||||
{name:"",cond:"",icon:"",high:"",low:"",windspeed:""}
|
||||
]},*/
|
||||
weatherLocs:[]
|
||||
}, alamanac: {displayname:"",date:"",avghigh:"",avglow:"",rechigh:"",reclow:"",rechighyear:"",reclowyear:"",sunrise:"",sunset:"",moonphases:[
|
||||
{name:"NEW",date:"Feb 10"},
|
||||
{name:"FIRST",date:"Feb 16"},
|
||||
{name:"FULL",date:"Feb 21"},
|
||||
{name:"LAST",date:"Feb 27"},
|
||||
]}, bulletin: {
|
||||
//loc:{displayname:"",pages:[]},
|
||||
weatherLocs:[],
|
||||
severewarnings:[],
|
||||
//{name:"", desc:"", status:""}
|
||||
marqueewarnings:[],
|
||||
severeweathermode: false
|
||||
//{name:"", desc:"", status:"", significance:""}
|
||||
}, healthforecast: { displayname:"",dayidx:0, day:"", high:"", low:"", precipChance:"", humid:"", wind:"",windspeed:"", icon:""
|
||||
}, healthPollen: {displayname:"", total:"", totalcat:"", date:"", types:[
|
||||
{type:"tree", treetype:"", pollenidx:""},
|
||||
{type:"grass", pollenidx:""},
|
||||
{type:"weed", pollenidx:""},
|
||||
{type:"mold", pollenidx:""},
|
||||
]}, healthAcheBreath: {date:"",achesindex:"",achescat:"",breathindex:"",breathcat:""
|
||||
}, airquality: {date:"",ozoneactin: false, primarypolute:"", airqualityindex:""
|
||||
}, uvindex: {currentuv:{index:"",desc:""},forecast:[
|
||||
{day:"",time:"",index:"",desc:""},
|
||||
{day:"",time:"",index:"",desc:""},
|
||||
{day:"",time:"",index:"",desc:""}
|
||||
]},
|
||||
ccticker: {noReport:false,arrow:"",ccLocs:[]},
|
||||
radarTempUnavialable: false,
|
||||
ad: "You are watching an emulation of the Weatherscan IntelliStar system. Weatherscan is a digital cable and satellite television network that is owned by a consortium owned in turn by NBCUniversal and investment firms The Blackstone Group and Bain Capital. A spinoff of The Weather Channel, Weatherscan features uninterrupted local weather 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."
|
||||
}
|
||||
|
||||
//start data functions. these are run after their respective location functions finish
|
||||
function grabCitySlidesData() {
|
||||
console.log("grabbed city data")
|
||||
var url = "https://api.weather.com/v3/aggcommon/v3alertsHeadlines;v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-wx-forecast-hourly-2day?geocodes="
|
||||
url += `${maincitycoords.lat},${maincitycoords.lon};`
|
||||
locList.forEach((loc, i) => {
|
||||
url += `${loc.lat},${loc.lon};`
|
||||
});
|
||||
url += "&language=en-US&units=e&format=json&apiKey=" + api_key
|
||||
|
||||
$.getJSON(url, function(data) {
|
||||
data.forEach((ajaxedLoc, i) => {
|
||||
//Extra locations
|
||||
|
||||
var weatherLocscc = {noReport:false,displayname:"",temp:"",cond:"",icon:"",humid:"",dewpt:"",pressure:"",pressureTrend:"",wind:"",windspeed:"",gust:"",feelslike:{type:"",val:""}}
|
||||
weatherLocscc.temp = ajaxedLoc["v3-wx-observations-current"].temperature
|
||||
weatherLocscc.cond = ajaxedLoc["v3-wx-observations-current"].wxPhraseLong
|
||||
weatherLocscc.icon = ajaxedLoc["v3-wx-observations-current"].iconCode
|
||||
weatherLocscc.humid = ajaxedLoc["v3-wx-observations-current"].relativeHumidity
|
||||
weatherLocscc.dewpt = ajaxedLoc["v3-wx-observations-current"].temperatureDewPoint
|
||||
weatherLocscc.pressure = ajaxedLoc["v3-wx-observations-current"].pressureAltimeter
|
||||
weatherLocscc.pressureTrend = ((ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 1 || ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 3) ? '↑' : (ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 2 || ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 4) ? '↓' : ' S')
|
||||
weatherLocscc.wind = ((ajaxedLoc["v3-wx-observations-current"].windDirectionCardinal == "CALM" || ajaxedLoc["v3-wx-observations-current"].windSpeed == 0) ? 'calm' : ajaxedLoc["v3-wx-observations-current"].windDirectionCardinal) + ' ' + ((ajaxedLoc["v3-wx-observations-current"].windSpeed === 0) ? '' : ajaxedLoc["v3-wx-observations-current"].windSpeed)
|
||||
weatherLocscc.windspeed = ajaxedLoc["v3-wx-observations-current"].windSpeed
|
||||
weatherLocscc.gust = ((ajaxedLoc["v3-wx-observations-current"].windGust!=undefined) ? ajaxedLoc["v3-wx-observations-current"].windGust + " mph": "none")
|
||||
weatherLocscc.feelslike.type = ((ajaxedLoc["v3-wx-observations-current"].temperature != ajaxedLoc["v3-wx-observations-current"].temperatureHeatIndex) ? "Heat Index" : ((ajaxedLoc["v3-wx-observations-current"].temperatureWindChill != ajaxedLoc["v3-wx-observations-current"].temperature) ? "Wind Chill" : "dontdisplay"))
|
||||
weatherLocscc.feelslike.val = ajaxedLoc["v3-wx-observations-current"].temperatureFeelsLike
|
||||
weatherLocscc.displayname = ((i ==0 ) ? maincitycoords.displayname : locList[i-1].displayname)
|
||||
weatherInfo.currentCond.weatherLocs.push(weatherLocscc)
|
||||
//day part
|
||||
//functions converting hourly data into daypart
|
||||
var indexes = calcHourlyReport(ajaxedLoc["v3-wx-forecast-hourly-2day"]);
|
||||
function buildHourlyTimeTitle(time){
|
||||
var hour=dateFns.getHours(time);
|
||||
if (hour===0) {
|
||||
return 'Midnight';
|
||||
} else if (hour===12){
|
||||
return 'Noon';
|
||||
}
|
||||
return (dateFns.format(time,'h a')).replace(" ", "");
|
||||
}
|
||||
//get reporting hours: 12am, 6am, 12pm, 3pm, 5pm, 8pm...
|
||||
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, hi=0;
|
||||
|
||||
switch (true) {
|
||||
case (current < 3):
|
||||
start = 6; //before 3:00
|
||||
case (current < 9):
|
||||
start = 12; break; //before 9:00 after 3:00
|
||||
case (current < 12):
|
||||
start = 15; break; //before 12:00 after 9:00
|
||||
case (current < 14):
|
||||
start = 17; break; //before 2:00 after 12:00
|
||||
case (current < 17):
|
||||
start = 6; break; //before 5:00 after 2:00
|
||||
case (current < 20):
|
||||
start = 6; break; //before 8:00 after 5:00
|
||||
default:
|
||||
start = 6;
|
||||
}
|
||||
while(ret.length<4){
|
||||
// hour must be equal or greater than current
|
||||
hour = dateFns.getHours(data.validTimeLocal[hi] );
|
||||
if ( dateFns.isAfter(data.validTimeLocal[hi], now) && (hour==start || ret.length>0) ) {
|
||||
if ( targets.indexOf(hour)>=0 ) { // it is in our target list so record its index
|
||||
ret.push(hi);
|
||||
}
|
||||
}
|
||||
hi++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function buildHourlyHeaderTitle(time) {
|
||||
var today = new Date(),
|
||||
tomorrow = dateFns.addDays(today, 1);
|
||||
|
||||
// title based on the first hour reported
|
||||
switch (dateFns.getHours(time)) {
|
||||
|
||||
case 6: // 6 - Nextday's Forecast / Today's Forecast
|
||||
// if 6am today
|
||||
if (dateFns.isToday(time)) {
|
||||
return "Today's Forecast";
|
||||
}
|
||||
case 0: // 0 - Nextday's Forecast
|
||||
return "Tomorrow's Forecast";
|
||||
|
||||
case 12:
|
||||
return "Today's Forecast";
|
||||
|
||||
case 15:
|
||||
return "Today's Forecast";
|
||||
|
||||
case 17:
|
||||
return "Tonight's Forecast";
|
||||
|
||||
case 20:
|
||||
return "Tonight's Forecast"
|
||||
}
|
||||
}
|
||||
|
||||
var weatherLocsDP = {noReport:false,displayname:"",daytitle:"",hour:[{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},{time:"",cond:"",icon:"",temp:"",wind:"",windspeed:""},]};
|
||||
weatherLocsDP.daytitle = buildHourlyHeaderTitle(ajaxedLoc["v3-wx-forecast-hourly-2day"].validTimeLocal[indexes[0]])
|
||||
for (var hi = 0; hi < 4; hi++) {
|
||||
weatherLocsDP.hour[hi].time = buildHourlyTimeTitle(ajaxedLoc["v3-wx-forecast-hourly-2day"].validTimeLocal[indexes[hi]])
|
||||
weatherLocsDP.hour[hi].cond = ajaxedLoc["v3-wx-forecast-hourly-2day"].wxPhraseShort[indexes[hi]].replace('M ', 'Mostly ').replace('P ','Partly ').replace('PMostly ', 'PM').replace('AMostly ', 'AM')
|
||||
weatherLocsDP.hour[hi].icon = ajaxedLoc["v3-wx-forecast-hourly-2day"].iconCode[indexes[hi]]
|
||||
weatherLocsDP.hour[hi].temp = ajaxedLoc["v3-wx-forecast-hourly-2day"].temperature[indexes[hi]]
|
||||
weatherLocsDP.hour[hi].wind = ajaxedLoc["v3-wx-forecast-hourly-2day"].windDirectionCardinal[indexes[hi]] + ' ' + ajaxedLoc["v3-wx-forecast-hourly-2day"].windSpeed[indexes[hi]]
|
||||
weatherLocsDP.hour[hi].windspeed= ajaxedLoc["v3-wx-forecast-hourly-2day"].windSpeed[indexes[hi]]
|
||||
}
|
||||
weatherLocsDP.displayname = ((i ==0 ) ? maincitycoords.displayname : locList[i-1].displayname)
|
||||
weatherInfo.dayPart.weatherLocs.push(weatherLocsDP)
|
||||
//daydesc
|
||||
var weatherLocsDD = {noReport:false,displayname:"",day:[{name:"",desc:""},{name:"",desc:""},{name:"",desc:""},{name:"",desc:""}]}
|
||||
var daycorrection = 0;
|
||||
if (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) {
|
||||
daycorrection = 1;
|
||||
}
|
||||
for (var hi = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 1 : 0; hi < 4 + daycorrection; hi++) {
|
||||
weatherLocsDD.day[hi - daycorrection].name = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[hi].replace('Tomorrow', ajaxedLoc["v3-wx-forecast-daily-5day"].dayOfWeek[1]))
|
||||
weatherLocsDD.day[hi - daycorrection].desc = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi] + ((ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi] != null && ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi].includes(ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi]) === false) ? ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi] : '') + ((ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi - daycorrection] != null && ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi].includes(ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi]) === false) ? ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi] : '')
|
||||
}
|
||||
weatherLocsDD.displayname = ((i ==0 ) ? maincitycoords.displayname : locList[i-1].displayname)
|
||||
weatherInfo.dayDesc.weatherLocs.push(weatherLocsDD)
|
||||
//fiveday
|
||||
var weatherLocsFD = {noReport:false,displayname:"",day:[{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:""},{name:"",cond:"",icon:"",high:"",low:"",windspeed:""}]};
|
||||
for (var hi = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 1 : 0, hidp = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 2 : 0; hi < 5 + daycorrection; hi++, hidp = hidp + 2) {
|
||||
weatherLocsFD.day[hi - daycorrection].name = ajaxedLoc["v3-wx-forecast-daily-5day"].dayOfWeek[hi].substring(0,3)
|
||||
weatherLocsFD.day[hi - daycorrection].icon = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].iconCode[hidp]
|
||||
weatherLocsFD.day[hi - daycorrection].cond = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].wxPhraseShort[hidp].replace('M ', 'Mostly ').replace('P ','Partly ').replace('M ', 'Mostly ').replace('P ','Partly ').replace('PMostly ', 'PM').replace('AMostly ', 'AM');
|
||||
weatherLocsFD.day[hi - daycorrection].high = ajaxedLoc["v3-wx-forecast-daily-5day"].temperatureMax[hi]
|
||||
weatherLocsFD.day[hi - daycorrection].windspeed = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windSpeed[hidp]
|
||||
weatherLocsFD.day[hi - daycorrection].low = ajaxedLoc["v3-wx-forecast-daily-5day"].temperatureMin[hi]
|
||||
}
|
||||
weatherLocsFD.displayname = ((i ==0 ) ? maincitycoords.displayname : locList[i-1].displayname)
|
||||
weatherInfo.fiveDay.weatherLocs.push(weatherLocsFD)
|
||||
//bulletin
|
||||
var weatherLocsWA = {displayname:"",pages:[]};
|
||||
weatherLocsWA.displayname = ((i ==0 ) ? maincitycoords.displayname : locList[i-1].displayname)
|
||||
if (ajaxedLoc["v3alertsHeadlines"] != undefined){
|
||||
var displayday;
|
||||
var bulletintext = "";
|
||||
var ret = [];
|
||||
var ai=0;
|
||||
//info
|
||||
//get only weather alers
|
||||
for (ai=0; ai<=ajaxedLoc["v3alertsHeadlines"].alerts.length - 1; ai++) {
|
||||
warning = ajaxedLoc["v3alertsHeadlines"].alerts[ai].categories[0].category;
|
||||
if (warning == "Met") {
|
||||
ret.push({idx:ai, priority: getWarningPosition(ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription)})
|
||||
}
|
||||
};
|
||||
if (ret.length != 0) {
|
||||
ret.sort(function(a,b) {return a.priority - b.priority;});
|
||||
|
||||
for (ai of ret) {
|
||||
var icount = 0;
|
||||
getexpiredate = function(expiretime) {
|
||||
dateFns.format(new Date(expiretime), "h:mm");
|
||||
if (dateFns.isToday(expiretime) != true) {
|
||||
var numday = dateFns.getDay(expiretime);
|
||||
displayday = {"0":"SUN","1":"MON","2":"TUE","3":"WED","4":"THU","5":"FRI","6":"SAT"}[numday] + ".";
|
||||
} else {
|
||||
displayday = "Today."
|
||||
}
|
||||
return dateFns.format(new Date(expiretime), "h:mm A ") + displayday
|
||||
}
|
||||
if (icount != ret.length - 1) {
|
||||
bulletintext += ajaxedLoc["v3alertsHeadlines"].alerts[ai.idx].eventDescription + " in effect until " + (getexpiredate(ajaxedLoc["v3alertsHeadlines"].alerts[ai.idx].expireTimeLocal) + "\n \n")
|
||||
} else {
|
||||
bulletintext += ajaxedLoc["v3alertsHeadlines"].alerts[ai.idx].eventDescription + " in effect until " + (getexpiredate(ajaxedLoc["v3alertsHeadlines"].alerts[ai.idx].expireTimeLocal) + "\n \n")
|
||||
}
|
||||
var icount = icount + 1;
|
||||
}
|
||||
|
||||
function splitLines() {
|
||||
|
||||
var warningsplitstr = bulletintext.split(/(?![^\n]{1,40}$)([^\n]{1,40})\s/g)
|
||||
warningsplitstr.pop()
|
||||
warningsplitstr.pop()
|
||||
var warningpageidx = 0;
|
||||
var warninglineidx = 0;
|
||||
warningsplitstr.forEach(warningline => {
|
||||
if (warningline != "") {
|
||||
if (warninglineidx == 0) {
|
||||
weatherLocsWA.pages[warningpageidx] = ""
|
||||
}
|
||||
weatherLocsWA.pages[warningpageidx] += (warningline + '<br>')
|
||||
warninglineidx += 1;
|
||||
if (warninglineidx == 7) {
|
||||
warningpageidx += 1
|
||||
warninglineidx = 0
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
splitLines()
|
||||
weatherInfo.bulletin.weatherLocs.push(weatherLocsWA)
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function grabSideandLowerBarData() {
|
||||
var url = "https://api.weather.com/v3/aggcommon/v3alertsHeadlines;v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-wx-forecast-hourly-2day?geocodes="
|
||||
url += `${maincitycoords.lat},${maincitycoords.lon};`
|
||||
url += "&language=en-US&units=e&format=json&apiKey=" + api_key
|
||||
|
||||
$.getJSON(url, function(data) {
|
||||
//Extra locations
|
||||
var ajaxedLoc = data[0]
|
||||
weatherInfo.currentCond.sidebar.temp = ajaxedLoc["v3-wx-observations-current"].temperature
|
||||
weatherInfo.currentCond.sidebar.cond = ajaxedLoc["v3-wx-observations-current"].wxPhraseLong
|
||||
weatherInfo.currentCond.sidebar.icon = ajaxedLoc["v3-wx-observations-current"].iconCode
|
||||
weatherInfo.currentCond.sidebar.humid = ajaxedLoc["v3-wx-observations-current"].relativeHumidity
|
||||
weatherInfo.currentCond.sidebar.dewpt = ajaxedLoc["v3-wx-observations-current"].temperatureDewPoint
|
||||
weatherInfo.currentCond.sidebar.pressure = ajaxedLoc["v3-wx-observations-current"].pressureAltimeter
|
||||
weatherInfo.currentCond.sidebar.pressureTrend = ((ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 1 || ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 3) ? '↑' : (ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 2 || ajaxedLoc["v3-wx-observations-current"].pressureTendencyCode === 4) ? '↓' : ' S')
|
||||
weatherInfo.currentCond.sidebar.wind = ((ajaxedLoc["v3-wx-observations-current"].windDirectionCardinal == "CALM" || ajaxedLoc["v3-wx-observations-current"].windSpeed == 0) ? 'calm' : ajaxedLoc["v3-wx-observations-current"].windDirectionCardinal) + ' ' + ((ajaxedLoc["v3-wx-observations-current"].windSpeed === 0) ? '' : ajaxedLoc["v3-wx-observations-current"].windSpeed)
|
||||
weatherInfo.currentCond.sidebar.windspeed = ajaxedLoc["v3-wx-observations-current"].windSpeed
|
||||
weatherInfo.currentCond.sidebar.gust = ((ajaxedLoc["v3-wx-observations-current"].windGust!=undefined) ? ajaxedLoc["v3-wx-observations-current"].windGust + " mph" : "none")
|
||||
weatherInfo.currentCond.sidebar.visibility = ajaxedLoc["v3-wx-observations-current"].visibility
|
||||
weatherInfo.currentCond.sidebar.uvidx = ajaxedLoc["v3-wx-observations-current"].uvDescription
|
||||
weatherInfo.currentCond.sidebar.ceiling = ajaxedLoc["v3-wx-observations-current"].cloudCeiling
|
||||
weatherInfo.currentCond.sidebar.feelslike.type = ((ajaxedLoc["v3-wx-observations-current"].temperature != ajaxedLoc["v3-wx-observations-current"].temperatureHeatIndex) ? "heat index" : ((ajaxedLoc["v3-wx-observations-current"].temperatureWindChill != ajaxedLoc["v3-wx-observations-current"].temperature) ? "wind chill" : "dontdisplay"))
|
||||
weatherInfo.currentCond.sidebar.feelslike.val = ajaxedLoc["v3-wx-observations-current"].temperatureFeelsLike
|
||||
weatherInfo.currentCond.sidebar.displayname = maincitycoords.displayname
|
||||
//day part
|
||||
//functions converting hourly data into daypart
|
||||
var indexes = calcHourlyReport(ajaxedLoc["v3-wx-forecast-hourly-2day"]);
|
||||
function buildHourlyTimeTitle(time){
|
||||
var hour=dateFns.getHours(time);
|
||||
if (hour===0) {
|
||||
return 'Midnight';
|
||||
} else if (hour===12){
|
||||
return 'Noon';
|
||||
}
|
||||
return (dateFns.format(time,'h a')).replace(" ", "");
|
||||
}
|
||||
//get reporting hours: 12am, 6am, 12pm, 3pm, 5pm, 8pm...
|
||||
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, hi=0;
|
||||
|
||||
switch (true) {
|
||||
case (current < 3):
|
||||
start = 6; //before 3:00
|
||||
case (current < 9):
|
||||
start = 12; break; //before 9:00 after 3:00
|
||||
case (current < 12):
|
||||
start = 15; break; //before 12:00 after 9:00
|
||||
case (current < 14):
|
||||
start = 17; break; //before 2:00 after 12:00
|
||||
case (current < 17):
|
||||
start = 20; break; //before 5:00 after 2:00
|
||||
case (current < 20):
|
||||
start = 0; break; //before 8:00 after 5:00
|
||||
default:
|
||||
start = 6;
|
||||
}
|
||||
while(ret.length<4){
|
||||
// hour must be equal or greater than current
|
||||
hour = dateFns.getHours(data.validTimeLocal[hi] );
|
||||
if ( dateFns.isAfter(data.validTimeLocal[hi], now) && (hour==start || ret.length>0) ) {
|
||||
if ( targets.indexOf(hour)>=0 ) { // it is in our target list so record its index
|
||||
ret.push(hi);
|
||||
}
|
||||
}
|
||||
hi++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function buildHourlyHeaderTitle(time) {
|
||||
var today = new Date(),
|
||||
tomorrow = dateFns.addDays(today, 1);
|
||||
sforecast = "'s Forecast";
|
||||
|
||||
// title based on the first hour reported
|
||||
switch (dateFns.getHours(time)) {
|
||||
|
||||
case 6: // 6 - Nextday's Forecast / Today's Forecast
|
||||
// if 6am today
|
||||
if (dateFns.isToday(time)) {
|
||||
return dateFns.format(today, 'dddd') + sforecast;
|
||||
}
|
||||
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');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
weatherInfo.dayPart.lowerbar.daytitle = buildHourlyHeaderTitle(ajaxedLoc["v3-wx-forecast-hourly-2day"].validTimeLocal[indexes[0]])
|
||||
for (var hi = 0; hi < 4; hi++) {
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].time = buildHourlyTimeTitle(ajaxedLoc["v3-wx-forecast-hourly-2day"].validTimeLocal[indexes[hi]])
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].cond = ajaxedLoc["v3-wx-forecast-hourly-2day"].wxPhraseShort[indexes[hi]].replace('M ', 'Mostly ').replace('P ','Partly ').replace('PMostly ', 'PM').replace('AMostly ', 'AM')
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].icon = ajaxedLoc["v3-wx-forecast-hourly-2day"].iconCode[indexes[hi]]
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].temp = ajaxedLoc["v3-wx-forecast-hourly-2day"].temperature[indexes[hi]]
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].wind = ajaxedLoc["v3-wx-forecast-hourly-2day"].windDirectionCardinal[indexes[hi]] + ' ' + ajaxedLoc["v3-wx-forecast-hourly-2day"].windSpeed[indexes[hi]]
|
||||
weatherInfo.dayPart.lowerbar.hour[hi].windspeed= ajaxedLoc["v3-wx-forecast-hourly-2day"].windSpeed[indexes[hi]]
|
||||
}
|
||||
weatherInfo.dayPart.lowerbar.displayname = maincitycoords.displayname
|
||||
//daydesc
|
||||
var daycorrection = 0;
|
||||
if (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) {
|
||||
daycorrection = 1;
|
||||
}
|
||||
for (var hi = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 1 : 0; hi < 4 + daycorrection; hi++) {
|
||||
weatherInfo.dayDesc.lowerbar.day[hi - daycorrection].name = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[hi].replace('Tomorrow', ajaxedLoc["v3-wx-forecast-daily-5day"].dayOfWeek[1]))
|
||||
weatherInfo.dayDesc.lowerbar.day[hi - daycorrection].desc = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi] + ((ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi] != null && ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi].includes(ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi]) === false) ? ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].qualifierPhrase[hi] : '') + ((ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi - daycorrection] != null && ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].narrative[hi].includes(ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi]) === false) ? ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windPhrase[hi] : '')
|
||||
}
|
||||
weatherInfo.dayDesc.lowerbar.displayname = maincitycoords.displayname
|
||||
//fiveday
|
||||
var weatherLocsFD = {displayname:"",day:[{name:"",cond:"",icon:"",high:"",low:""},{name:"",cond:"",icon:"",high:"",low:""},{name:"",cond:"",icon:"",high:"",low:""},{name:"",cond:"",icon:"",high:"",low:""},{name:"",cond:"",icon:"",high:"",low:""}]};
|
||||
for (var hi = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 1 : 0, hidp = (ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].daypartName[0] == null) ? 2 : 0; hi < 5 + daycorrection; hi++, hidp = hidp + 2) {
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].name = ajaxedLoc["v3-wx-forecast-daily-5day"].dayOfWeek[hi].substring(0,3)
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].windspeed = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].windSpeed[hidp]
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].icon = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].iconCode[hidp]
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].cond = ajaxedLoc["v3-wx-forecast-daily-5day"].daypart[0].wxPhraseShort[hidp].replace('M ', 'Mostly ').replace('P ','Partly ').replace('M ', 'Mostly ').replace('P ','Partly ').replace('PMostly ', 'PM').replace('AMostly ', 'AM');
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].high = ajaxedLoc["v3-wx-forecast-daily-5day"].temperatureMax[hi]
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].low = ajaxedLoc["v3-wx-forecast-daily-5day"].temperatureMin[hi]
|
||||
weatherInfo.fiveDay.lowerbar.day[hi - daycorrection].weekend = ((dateFns.isWeekend(ajaxedLoc["v3-wx-forecast-daily-5day"].validTimeLocal[hi])) ? ' weekend' : '')
|
||||
}
|
||||
weatherInfo.fiveDay.lowerbar.displayname = maincitycoords.displayname
|
||||
|
||||
//bulletin
|
||||
if (ajaxedLoc["v3alertsHeadlines"] != undefined){
|
||||
var displayday;
|
||||
var bulletintext = "";
|
||||
var ret = [], sret = [];
|
||||
var ai=0;
|
||||
//info
|
||||
//get only weather alers
|
||||
for (ai=0; ai<=ajaxedLoc["v3alertsHeadlines"].alerts.length - 1; ai++) {
|
||||
warning = ajaxedLoc["v3alertsHeadlines"].alerts[ai].categories[0].category;
|
||||
if (warning == "Met") {
|
||||
ret.push({idx:ai, priority: getWarningPosition(ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription)})
|
||||
if (ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription == "Severe Thunderstorm Warning" || ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription == "Flash Flood Warning" || ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription == "Tornado Warning") {
|
||||
sret.push({idx:ai, priority:ajaxedLoc["v3alertsHeadlines"].alerts[ai].eventDescription})
|
||||
}
|
||||
}
|
||||
};
|
||||
if (ret.length != 0) {
|
||||
ret.sort(function(a,b) {return a.priority - b.priority;});
|
||||
function pushAlert(aai) {
|
||||
$.getJSON('https://api.weather.com/v3/alerts/detail?alertId='+ ajaxedLoc["v3alertsHeadlines"].alerts[ret[aai].idx].detailKey +'&format=json&language=en-US&apiKey=' + api_key, function(adata) {
|
||||
var alertt = {name:"", desc:"", status:"", significance:""}
|
||||
alertt.name = ajaxedLoc["v3alertsHeadlines"].alerts[ret[aai].idx].eventDescription
|
||||
alertt.significance = ajaxedLoc["v3alertsHeadlines"].alerts[ret[aai].idx].significance
|
||||
alertt.status = ((ajaxedLoc["v3alertsHeadlines"].alerts[ret[aai].idx].messageType == " Update") ? 'UPDATE' : (ajaxedLoc["v3alertsHeadlines"].alerts[ret[aai].idx].messageType == "Cancel") ? " CANCELLATION" : "")
|
||||
alertt.desc = adata.alertDetail.texts[0].description
|
||||
weatherInfo.bulletin.marqueewarnings.push(alertt)
|
||||
if (aai < (ret.length - 1)) {pushAlert(aai = aai + 1)};
|
||||
});
|
||||
};
|
||||
pushAlert(0)
|
||||
}
|
||||
|
||||
if (sret.length != 0) {
|
||||
weatherInfo.bulletin.severeweathermode = true;
|
||||
sret.sort(function(a,b) {return a.priority - b.priority;});
|
||||
function pushSevereAlert(aai) {
|
||||
$.getJSON('https://api.weather.com/v3/alerts/detail?alertId='+ ajaxedLoc["v3alertsHeadlines"].alerts[sret[i]].detailKey +'&format=json&language=en-US&apiKey=' + api_key, function(sdata) {
|
||||
var severewarn = {warningname:"", warningdesc:"", warningstatus:""}
|
||||
severewarn.warningname = ajaxedLoc["v3alertsHeadlines"].alerts[sret[aai].idx].eventDescription
|
||||
severewarn.warningstatus = ((ajaxedLoc["v3alertsHeadlines"].alerts[sret[aai].idx].messageType == " Update") ? 'UPDATE' : (ajaxedLoc["v3alertsHeadlines"].alerts[sret[aii].idx].messageType == "Cancel") ? " CANCELLATION" : "")
|
||||
severewarn.warningdesc = sdata.alertDetail.texts[0].description
|
||||
weatherInfo.bulletin.severewarnings.push(severewarn)
|
||||
if (aai < (sret.length - 1)) {pushAlert(aai = aai + 1)};
|
||||
});
|
||||
};
|
||||
pushSevereAlert(0)
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
function grabAlamanacSlidesData() {
|
||||
url = 'https://api.weather.com/v3/aggcommon/v3-wx-almanac-daily-1day;v3-wx-observations-current?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&format=json&language=en-US&units=e" + "&day=" + dateFns.format(new Date(), "D") + "&month=" + dateFns.format(new Date(),"M") + "&apiKey=" + api_key
|
||||
$.getJSON(url, function(data) {
|
||||
weatherInfo.alamanac.displayname = maincitycoords.displayname
|
||||
weatherInfo.alamanac.date = dateFns.format(new Date(),"MMMM D")
|
||||
weatherInfo.alamanac.avghigh = data["v3-wx-almanac-daily-1day"].temperatureAverageMax[0]
|
||||
weatherInfo.alamanac.avglow = data["v3-wx-almanac-daily-1day"].temperatureAverageMin[0]
|
||||
weatherInfo.alamanac.rechigh = data["v3-wx-almanac-daily-1day"].temperatureRecordMax[0]
|
||||
weatherInfo.alamanac.reclow = data["v3-wx-almanac-daily-1day"].temperatureRecordMin[0]
|
||||
weatherInfo.alamanac.rechighyear = data["v3-wx-almanac-daily-1day"].almanacRecordYearMax[0]
|
||||
weatherInfo.alamanac.reclowyear = data["v3-wx-almanac-daily-1day"].almanacRecordYearMin[0]
|
||||
weatherInfo.alamanac.sunset = dateFns.format(new Date(data["v3-wx-observations-current"].sunsetTimeLocal),"h:mm a")
|
||||
weatherInfo.alamanac.sunrise = dateFns.format(new Date(data["v3-wx-observations-current"].sunriseTimeLocal),"h:mm a")
|
||||
});
|
||||
}
|
||||
function grabHealthData() {
|
||||
$.getJSON('https://api.weather.com/v3/wx/forecast/daily/5day?geocode='+ maincitycoords.lat + ',' + maincitycoords.lon +"&format=json&language=en-US&units=e&apiKey=" + api_key, function(data) {
|
||||
var healthforecastdata = data
|
||||
var starthidx = 0;
|
||||
var starthidxdayonly = 0;
|
||||
if (healthforecastdata.daypart[0].daypartName[0] == undefined) {
|
||||
starthidx = 2;
|
||||
starthidxdayonly = 1;
|
||||
weatherInfo.healthforecast.dayidx = 2;
|
||||
}
|
||||
weatherInfo.healthforecast.displayname = maincitycoords.displayname
|
||||
weatherInfo.healthforecast.day = healthforecastdata.dayOfWeek[starthidxdayonly];
|
||||
weatherInfo.healthforecast.icon = healthforecastdata.daypart[0].iconCode[starthidx]
|
||||
weatherInfo.healthforecast.high = healthforecastdata.temperatureMax[starthidxdayonly]
|
||||
weatherInfo.healthforecast.low = healthforecastdata.temperatureMin[starthidxdayonly]
|
||||
weatherInfo.healthforecast.precipChance = healthforecastdata.daypart[0].precipChance[starthidx] + '%'
|
||||
weatherInfo.healthforecast.humid = healthforecastdata.daypart[0].relativeHumidity[starthidx] + '%'
|
||||
weatherInfo.healthforecast.wind = (((healthforecastdata.daypart[0].windDirectionCardinal[starthidx] == "CALM") ? 'calm' : healthforecastdata.daypart[0].windDirectionCardinal[starthidx]) + ' ' + ((healthforecastdata.daypart[0].windSpeed[starthidx] === 0) ? '' : healthforecastdata.daypart[0].windSpeed[starthidx]))
|
||||
weatherInfo.healthforecast.windspeed = healthforecastdata.daypart[0].windSpeed[starthidx]
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v1/geocode/'+ maincitycoords.lat + '/' + maincitycoords.lon + '/observations/pollen.json?language=en-US&apiKey=' + api_key, function(pollendata) {
|
||||
if (pollendata.pollenobservations !== undefined) {
|
||||
if (pollendata.pollenobservations[0].stn_cmnt != "No Report" && pollendata.pollenobservations[0].stn_cmnt != "Equipment Failure" && pollendata.pollenobservations[0].stn_cmnt != "Reports only during weed pollen season" && pollendata.pollenobservations[0].stn_cmnt != "Does not report year round" && pollendata.pollenobservations[0].stn_cmnt != "Reports Suspended") {
|
||||
if (pollendata.pollenobservations[0].total_pollen_cnt <= 9) {
|
||||
weatherInfo.healthPollen.totalcat = 'Low'
|
||||
} else if (pollendata.pollenobservations[0].total_pollen_cnt >= 10 && pollendata.pollenobservations[0].total_pollen_cnt <= 49) {
|
||||
weatherInfo.healthPollen.totalcat = 'Moderate'
|
||||
} else if (pollendata.pollenobservations[0].total_pollen_cnt >= 50 && pollendata.pollenobservations[0].total_pollen_cnt <= 499) {
|
||||
weatherInfo.healthPollen.totalcat = 'High'
|
||||
} else if (pollendata.pollenobservations[0].total_pollen_cnt >= 500) {
|
||||
weatherInfo.healthPollen.totalcat = 'Very High'
|
||||
};
|
||||
weatherInfo.healthPollen.total = pollendata.pollenobservations[0].total_pollen_cnt
|
||||
weatherInfo.healthPollen.types[0].treetype = 'Tree Pollen <br>' + ((pollendata.pollenobservations[0].treenames[0].tree_nm != "No Report") ? pollendata.pollenobservations[0].treenames[0].tree_nm : "")
|
||||
weatherInfo.healthPollen.date = dateFns.format(new Date(pollendata.pollenobservations[0].rpt_dt), "MMMM D")
|
||||
var pollentypes = ['tree', 'grass', 'weed', 'mold'];
|
||||
pollentypes.forEach((pollentype, i) => {
|
||||
weatherInfo.healthPollen.types[i].pollenidx = pollendata.pollenobservations[0].pollenobservation[i].pollen_idx
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v2/indices/achePain/daypart/3day?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
var achesindexdata = data
|
||||
var startidx = 0;
|
||||
if (achesindexdata.achesPainsIndex12hour.dayInd[0] == 'N') {
|
||||
startidx = 1;
|
||||
}
|
||||
weatherInfo.healthAcheBreath.achesindex = achesindexdata.achesPainsIndex12hour.achesPainsIndex[startidx]
|
||||
weatherInfo.healthAcheBreath.achescat = achesindexdata.achesPainsIndex12hour.achesPainsCategory[startidx]
|
||||
weatherInfo.healthAcheBreath.date = dateFns.format(new Date(achesindexdata.achesPainsIndex12hour.fcstValidLocal[0]), "dddd")
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v2/indices/breathing/daypart/3day?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
var breathindexdata = data
|
||||
var startidx = 0;
|
||||
if (breathindexdata.breathingIndex12hour.dayInd[0] == 'N') {
|
||||
startidx = 1;
|
||||
}
|
||||
weatherInfo.healthAcheBreath.breathindex = breathindexdata.breathingIndex12hour.breathingIndex[startidx]
|
||||
weatherInfo.healthAcheBreath.breathcat = breathindexdata.breathingIndex12hour.breathingCategory[startidx]
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v3/wx/globalAirQuality?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&language=en-US&scale=EPA&format=json&apiKey=" + api_key, function(data) {
|
||||
var airqualitydata = data
|
||||
weatherInfo.airquality.airqualityindex = airqualitydata.globalairquality.airQualityCategoryIndex
|
||||
if (airqualitydata.globalairquality.primaryPollutant == "PM2.5" || airqualitydata.globalairquality.primaryPollutant == "PM10") {
|
||||
weatherInfo.airquality.primarypolute = 'Fine Particulate'
|
||||
} else {weatherInfo.airquality.primarypolute = airqualitydata.globalairquality.primaryPollutant};
|
||||
weatherInfo.airquality.date = dateFns.format(new Date(airqualitydata.globalairquality.expireTimeGmt * 1000), "dddd")
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v2/indices/uv/current?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
var uvData = data
|
||||
weatherInfo.uvindex.currentuv.index = uvData.uvIndexCurrent.uvIndex
|
||||
weatherInfo.uvindex.currentuv.desc = uvData.uvIndexCurrent.uvDesc
|
||||
});
|
||||
$.getJSON('https://api.weather.com/v2/indices/uv/hourly/48hour?geocode=' + maincitycoords.lat + ',' + maincitycoords.lon + "&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
var uvData = data
|
||||
var indexes = calcHourlyReport(uvData.uvIndex1hour);
|
||||
var i;
|
||||
for (var i = 0; i < 3; i++) {
|
||||
weatherInfo.uvindex.forecast[i].day = dateFns.format(new Date(uvData.uvIndex1hour.fcstValidLocal[indexes[i]]), 'ddd')
|
||||
weatherInfo.uvindex.forecast[i].time = buildHourlyTimeTitle(uvData.uvIndex1hour.fcstValidLocal[indexes[i]])
|
||||
weatherInfo.uvindex.forecast[i].index = uvData.uvIndex1hour.uvIndex[indexes[i]]
|
||||
weatherInfo.uvindex.forecast[i].desc = uvData.uvIndex1hour.uvDesc[indexes[i]]
|
||||
}
|
||||
|
||||
//get reporting hours: 6am, 12pm, 3pm
|
||||
function buildHourlyTimeTitle(time){
|
||||
var hour=dateFns.getHours(time);
|
||||
return (dateFns.format(time,'h a')).replace(" ", "");
|
||||
}
|
||||
function calcHourlyReport(data) {
|
||||
var hret = [],
|
||||
targets = [9, 12, 15], // hours that we report
|
||||
current = dateFns.getHours(new Date()),
|
||||
now = new Date(),
|
||||
//firsthour = targets[ getNextHighestIndex(targets, current) ],
|
||||
start,
|
||||
hour, i=0;
|
||||
switch (true) {
|
||||
case (current < 6):
|
||||
start = 9;
|
||||
case (current < 9):
|
||||
start = 12; break;
|
||||
case (current < 12):
|
||||
start = 15; break;
|
||||
case (current < 13):
|
||||
start = 9; break;
|
||||
default:
|
||||
start = 9;
|
||||
}
|
||||
while(hret.length<3){
|
||||
|
||||
// hour must be equal or greater than current
|
||||
hour = dateFns.getHours(data.fcstValidLocal[i] );
|
||||
if ( dateFns.isAfter(data.fcstValidLocal[i], now) && (hour==start || hret.length>0) ) {
|
||||
|
||||
if ( targets.indexOf(hour)>=0 ) { // it is in our target list so record its index
|
||||
hret.push(i);
|
||||
}
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return hret;
|
||||
}
|
||||
})
|
||||
}
|
||||
function pullCCTickerData() {
|
||||
var ccurl = 'https://api.weather.com/v3/aggcommon/v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-location-point?geocodes=';
|
||||
// ajax the latest observation
|
||||
if (ccTickerCitiesList.length != 0) {
|
||||
ccTickerCitiesList.forEach((loc, i) => {
|
||||
ccurl += `${loc.lat},${loc.lon};`
|
||||
});
|
||||
ccurl += '&language=en-US&units=e&format=json&apiKey='+ api_key
|
||||
} else {
|
||||
ccurl = 'https://api.weather.com/v3/aggcommon/v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-location-point?geocodes=41.881832,-87.623177;44.986656,-93.258133;33.427204,-111.939896;46.877186,-96.789803;34.187042,-118.381256;33.660057,-117.998970;36.114647,-115.172813;21.315603,-157.858093;28.538336,-81.379234;43.0,-75.0;&language=en-US&units=e&format=json&apiKey='+ api_key
|
||||
}
|
||||
$.getJSON(ccurl, function(data) {
|
||||
data.forEach((locationdata, i) => {
|
||||
var ccLoc = {displayname:"",currentCond:{cond:"",temp:""},forecast:{cond:"",temp:""}}
|
||||
var marqueeidx = 1;
|
||||
if (locationdata['v3-wx-forecast-daily-5day'].daypart[0].daypartName[0] == undefined) {marqueeidx = 2;};
|
||||
if (locationdata['v3-wx-forecast-daily-5day'].daypart[0].daypartName[marqueeidx] == "Tonight") {weatherInfo.ccticker.arrow = 'tonight';} else {weatherInfo.ccticker.arrow = (locationdata['v3-wx-forecast-daily-5day'].dayOfWeek[1].substring(0,3)).toLowerCase()};
|
||||
ccLoc.displayname = locationdata['v3-location-point'].location.displayName + ': '
|
||||
ccLoc.currentCond.temp = locationdata['v3-wx-observations-current'].temperature
|
||||
ccLoc.currentCond.cond = (locationdata['v3-wx-observations-current'].wxPhraseLong).toLowerCase()
|
||||
ccLoc.forecast.temp = locationdata['v3-wx-forecast-daily-5day'].daypart[0].temperature[marqueeidx]
|
||||
ccLoc.forecast.cond = (locationdata['v3-wx-forecast-daily-5day'].daypart[0].wxPhraseLong[marqueeidx]).toLowerCase()
|
||||
weatherInfo.ccticker.ccLocs.push(ccLoc)
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
//loop data collection, slide loops data functions is done based on full cycle
|
||||
setInterval(function(){
|
||||
grabSideandLowerBarData();
|
||||
pullCCTickerData();
|
||||
}, 300000)
|
||||
|
||||
//init 1 second before intro stops
|
||||
setTimeout(function() {
|
||||
Loops();
|
||||
Slides();
|
||||
MarqueeMan();
|
||||
}, 4000)
|
||||
/*var weatherlinks;
|
||||
function grabData() {
|
||||
var citySlidesUrl = "&language=en-US&units=e&format=json&apiKey='+ api_key"
|
||||
locList.forEach((item, i) => {
|
||||
"https://api.weather.com/v3/aggcommon/v3-wx-forecast-daily-5day;v3-wx-observations-current;v3-location-point?geocodes=41.881832,-87.623177;44.986656,-93.258133;33.427204,-111.939896;46.877186,-96.789803;34.187042,-118.381256;33.660057,-117.998970;36.114647,-115.172813;21.315603,-157.858093;28.538336,-81.379234;43.0,-75.0;&language=en-US&units=e&format=json&apiKey='+ api_key
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
function updateData() {
|
||||
|
||||
};
|
||||
|
||||
function InitLoops() {
|
||||
|
||||
};*/
|
|
@ -46,6 +46,9 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
|
|||
tileSize: 512,
|
||||
zoomOffset: -1
|
||||
}).addTo(map);
|
||||
if (weatherInfo.radarTempUnavialable == true) {
|
||||
|
||||
} else {
|
||||
if (withSat == true) {
|
||||
$.getJSON("https://api.weather.com/v3/TileServer/series/productSet/PPAcore?filter=satrad&apiKey=" + api_key, function(data) {
|
||||
for (var i = 0; i < data.seriesInfo.satrad.series.length; i++) {
|
||||
|
@ -93,7 +96,7 @@ function Radar(divIDin, intervalHoursIn, zoomIn, latitudeIn, longitudeIn, withSa
|
|||
animationLoop()
|
||||
}, 1000);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,39 @@ function heatIndex(T, R) { // T = temp, R = relative humidity
|
|||
return Math.round(c1 + c2*T + c3 *R + c4*T*R + c5*T2 + c6*R2 + c7*T2*R + c8*T*R2 + c9*T2*R2);
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// Calculate new Lat/Lng from original points
|
||||
// on a distance and bearing (angle)
|
||||
// ----------------------------------------
|
||||
let llFromDistance = function(latitude, longitude, distance, bearing) {
|
||||
// taken from: https://stackoverflow.com/a/46410871/13549
|
||||
// distance in KM, bearing in degrees
|
||||
|
||||
const R = 6378.1; // Radius of the Earth
|
||||
const brng = bearing * Math.PI / 180; // Convert bearing to radian
|
||||
let lat = latitude * Math.PI / 180; // Current coords to radians
|
||||
let lon = longitude * Math.PI / 180;
|
||||
|
||||
// Do the math magic
|
||||
lat = Math.asin(Math.sin(lat) * Math.cos(distance / R) + Math.cos(lat) * Math.sin(distance / R) * Math.cos(brng));
|
||||
lon += Math.atan2(Math.sin(brng) * Math.sin(distance / R) * Math.cos(lat), Math.cos(distance/R)-Math.sin(lat)*Math.sin(lat));
|
||||
|
||||
// Coords back to degrees and return
|
||||
return [ (lat * 180 / Math.PI), (lon * 180 / Math.PI) ];
|
||||
|
||||
}
|
||||
|
||||
let pointsOnMapCircle = function(latitude, longitude, distance, numPoints) {
|
||||
const points = [];
|
||||
for (let i=0; i <= numPoints - 1; i++) {
|
||||
const bearing = Math.round((360 / numPoints) * i);
|
||||
console.log(bearing, i);
|
||||
const newPoints = llFromDistance(latitude, longitude, distance, bearing);
|
||||
points.push(newPoints);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
|
||||
// maps current condition code to icon
|
||||
function getCCicon(ccCode, windData){
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
var mainstate
|
||||
function WeatherManager() {
|
||||
|
||||
var mainloc;
|
||||
var mainMap, miniMap, slides,
|
||||
dataMan, loops, //weatherAudio,
|
||||
that = this;
|
||||
var marqueeforecasttype = 'now';
|
||||
$(function(){
|
||||
|
||||
// init marquees
|
||||
|
||||
function refreshMarquee () {
|
||||
if (marqueeforecasttype == 'now') {
|
||||
marqueeforecasttype = 'forecast'
|
||||
$('#arrow-img').attr("src",'/images/' + foreMarqueeDay + 'arrow.png');
|
||||
$('.marquee-fore').each(function(i, item) {
|
||||
item.style.display = ''
|
||||
});$('.marquee-now').each(function(i, item) {
|
||||
item.style.display = 'none'
|
||||
});
|
||||
} else {
|
||||
marqueeforecasttype = 'now'
|
||||
$('#arrow-img').attr("src",'/images/now.png');
|
||||
$('.marquee-fore').each(function(i, item) {
|
||||
item.style.display = 'none'
|
||||
});
|
||||
$('.marquee-now').each(function(i, item) {
|
||||
item.style.display = ''
|
||||
});
|
||||
}
|
||||
$('#marquee-container')
|
||||
.marquee('destroy')
|
||||
.marquee({speed: 200, pauseOnHover:true, delayBeforeStart:3000})
|
||||
.on('finished', refreshMarquee);
|
||||
}
|
||||
refreshMarquee();
|
||||
|
||||
|
||||
$('#marquee2').marquee({
|
||||
speed: 170, pauseOnHover: true
|
||||
});
|
||||
|
||||
|
||||
weatherAudio.playCallback = function(tags) {
|
||||
$('.track-info').text('playing "' + tags.title + '" by ' + tags.artist);
|
||||
}
|
||||
|
||||
// this little guy runs the date and time
|
||||
setInterval(
|
||||
function () {
|
||||
var today = new Date();
|
||||
|
||||
$('#date').text( today.toString().slice(4,10).trimRight() );
|
||||
$('#time').text( today.toLocaleTimeString('en-US', { hour: 'numeric', hour12: true, minute: 'numeric', second: 'numeric' }).replace(/ /g,'') );
|
||||
}
|
||||
, 1000);
|
||||
|
||||
initDataPull();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function initDataPull() {
|
||||
// get the main location data
|
||||
// on initialization ready, init local forecast loop
|
||||
// on return of fully ready, begin display loops
|
||||
|
||||
// check the url for a specific location
|
||||
var queryString = window.location.search;
|
||||
|
||||
if (queryString) {
|
||||
$.getJSON("https://api.weather.com/v3/location/search?query="+queryString.split("?")[1]+"&language=en-US&format=json&apiKey=" + api_key, function(data) {
|
||||
dataMan = createDataManager( data.location.latitude[0]+','+data.location.longitude[0] );
|
||||
mainloc = data.location.city[0]
|
||||
mainstate = data.location.adminDistrict[0]
|
||||
groupDataManager = new GroupDataManager;
|
||||
});
|
||||
} else {
|
||||
|
||||
// get lat lon from user's ip
|
||||
$.getJSON("http://ip-api.com/json/?callback=?", function(data) {
|
||||
dataMan = createDataManager( data.lat+','+data.lon );
|
||||
mainloc = data.city
|
||||
mainstate = data.regionName
|
||||
groupDataManager = new GroupDataManager;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function initDisplayLoops(){
|
||||
loops = new Loops(dataMan.locations[0]);
|
||||
}
|
||||
function initSlidesLoop() {
|
||||
slides = new Slides(dataMan);
|
||||
}
|
||||
function createDataManager(searchString) {
|
||||
var dataManager = new DataManager();
|
||||
|
||||
$(dataManager)
|
||||
.on('refresh', refreshObservationDisplay)
|
||||
.on('ready:main', initDisplayLoops)
|
||||
.on('allinit', initSlidesLoop);
|
||||
|
||||
dataManager.init(searchString);
|
||||
|
||||
return dataManager;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function refreshObservationDisplay() {
|
||||
var data = dataMan.locations[0].observations(0),
|
||||
cond = data.wxPhraseLong;
|
||||
|
||||
if (mainMap===undefined) {
|
||||
miniMap = new Radar("minimap", 3, 6, data.latitude, data.longitude);
|
||||
mainMap = that.mainMap = new Radar("radar-1", 3, 8, data.latitude, data.longitude, true);
|
||||
}
|
||||
|
||||
$('#city').text(mainloc);
|
||||
$('#forecast-city').text(mainloc + ':');
|
||||
$('#current-temp').text( dataMan.locations[0].temperature() ) ;
|
||||
$('#conditions-icon').css('background-image', 'url("' + getCCicon(+data.iconCode, data.windSpeed) + '")');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
var weatherMan = new WeatherManager();
|