diff --git a/webroot/images/fri.png b/webroot/images/fri.png new file mode 100644 index 0000000..5a2d512 Binary files /dev/null and b/webroot/images/fri.png differ diff --git a/webroot/images/monarrow.png b/webroot/images/monarrow.png new file mode 100644 index 0000000..7190339 Binary files /dev/null and b/webroot/images/monarrow.png differ diff --git a/webroot/images/satarrow.png b/webroot/images/satarrow.png new file mode 100644 index 0000000..d42a080 Binary files /dev/null and b/webroot/images/satarrow.png differ diff --git a/webroot/images/sunarrow.png b/webroot/images/sunarrow.png new file mode 100644 index 0000000..3f6e76a Binary files /dev/null and b/webroot/images/sunarrow.png differ diff --git a/webroot/images/thuarrow.png b/webroot/images/thuarrow.png new file mode 100644 index 0000000..dcaa6c9 Binary files /dev/null and b/webroot/images/thuarrow.png differ diff --git a/webroot/images/tonightarrow.png b/webroot/images/tonightarrow.png new file mode 100644 index 0000000..cce2368 Binary files /dev/null and b/webroot/images/tonightarrow.png differ diff --git a/webroot/images/tuearrow.png b/webroot/images/tuearrow.png new file mode 100644 index 0000000..483ec02 Binary files /dev/null and b/webroot/images/tuearrow.png differ diff --git a/webroot/images/wedarrow.png b/webroot/images/wedarrow.png new file mode 100644 index 0000000..1809174 Binary files /dev/null and b/webroot/images/wedarrow.png differ diff --git a/webroot/js/groupull.js b/webroot/js/groupull.js index da1fc6c..6887e9e 100644 --- a/webroot/js/groupull.js +++ b/webroot/js/groupull.js @@ -1,3 +1,4 @@ +var foreMarqueeDay = "" function GroupDataManager() { var locationx = {}; var locations = @@ -31,14 +32,21 @@ function GroupDataManager() { // 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 += ';' + }); - - // woeid is the id for the location to pull data for - var url = 'https://api.weather.com/v3/aggcommon/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); + 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); + }); } @@ -52,13 +60,18 @@ function GroupDataManager() { if ( !location.hasOwnProperty('woeid') ) { locationx.woeid = locationx.data.id; - $span = $("").appendTo('#marquee-now'); + $span = $("").appendTo('#marquee-now'); + $spanfor = $("").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 @@ -73,4 +86,3 @@ function GroupDataManager() { } -var groupDataManager = new GroupDataManager; diff --git a/webroot/js/weather.js b/webroot/js/weather.js index 5675d0e..475c6f4 100644 --- a/webroot/js/weather.js +++ b/webroot/js/weather.js @@ -1,15 +1,34 @@ - +var mainstate function WeatherManager() { - var mainloc + 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}) @@ -55,6 +74,8 @@ function WeatherManager() { $.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 { @@ -62,6 +83,8 @@ function WeatherManager() { $.getJSON("http://ip-api.com/json/?callback=?", function(data) { dataMan = createDataManager( data.lat+','+data.lon ); mainloc = data.city + mainstate = data.regionName + groupDataManager = new GroupDataManager; }); }