!function(e,t,s,a){var i="flatWeatherPlugin",n={location:"Boston, MA",country:"USA",zmw:"02108.1.99999",displayCityNameOnly:!1,api:"darksky",forecast:5,apikey:"",latitude:"",longitude:"",view:"full",render:!1,loadingAnimation:!0,strings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],min:"Min",max:"Max",direction:["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"]},timeformat:"12",lang:"EN"},o={openweathermap:["https://api.openweathermap.org/data/2.5/weather","https://api.openweathermap.org/data/2.5/forecast/daily"],wunderground:["https://api.wunderground.com/api/apikey/conditions/forecast/astronomy/"],darksky:["https://api.darksky.net/forecast/apikey/"]};function r(t,s){this.element=t,this.settings=e.extend({},n,s),this.settings.units&&"auto"!=this.settings.units||(this.settings.units=-1==["united states","usa","united states of america","us"].indexOf(this.settings.country.toLowerCase())?"metric":"imperial"),this.settings.forecast=Math.min(this.settings.forecast,5),"wunderground"==this.settings.api&&(this.settings.forecast=Math.min(this.settings.forecast,3)),this._name=i,this.once=!1,this.init()}function d(e,t){return t[e.getDay()]}function l(e,t){var s=(e=new Date(1e3*e)).getHours(),a=e.getMinutes(),i=s>=12?"PM":"AM";return"24"==t&&(i="",s=s<10?"0"+s:s),"12"==t&&(s%=12),(s=s||12)+":"+(a=a<10?"0"+a:a)+" "+i}e.extend(r.prototype,{init:function(){this.settings.render&&(this.settings.loadingAnimation&&!this.once&&(this.loading=e("
",{id:"flatWeatherLoading",class:"wi loading"}),this.loading.appendTo(this.element)),this.fetchWeather().then(this.render,this.error)),this.once=!0},fetchWeather:function(){var t=this,s=new e.Deferred,a=[],i=this.settings.location+" "+this.settings.country;if("openweathermap"==this.settings.api){var n={};this.settings.lat&&this.settings.lon?(n.lat=this.settings.lat,n.lon=this.settings.lon):n.q=i,n.units=this.settings.units,this.settings.apikey&&(n.appid=this.settings.apikey),this.settings.lang&&(n.lang=this.settings.lang),a.push(n),n.cnt=this.settings.forecast+1,a.push(n)}else("wunderground"==this.settings.api||"darksky"==this.settings.api)&&(o[this.settings.api][0]=o[this.settings.api][0].replace(/apikey/,this.settings.apikey));for(var r=[],u=0;u1?a.map((function(e){return e[0]})):a[0],"openweathermap"!=t.settings.api||"200"==a[0].cod&&"200"==a[1].cod)if("wunderground"==t.settings.api&&a.response&&a.response.error)console.log("Error interacting with the wunderground api see error object below for details:"),console.log(a),s.reject(a,t);else if("darksky"==t.settings.api&&403==a.status)console.log("Error authenticating with the darkmap api see error object below for details:"),console.log(a),s.reject(a,t);else{var i=function(e,t){var s={};if("openweathermap"==t.api){""!=e[0].name?(s.location=e[0].name+", "+e[0].sys.country,s.city=e[0].name):""!=e[1].city.name?(s.location=e[1].city.name+", "+e[1].city.country,s.city=e[1].city.name):(s.location=t.location+", "+t.country,s.city=t.location),s.today={},s.today.temp={},s.today.temp.now=Math.round(e[0].main.temp),s.today.temp.min=Math.round(e[0].main.temp_min),s.today.temp.max=Math.round(e[0].main.temp_max),s.today.desc=e[0].weather[0].description.capitalize(),s.today.code=e[0].weather[0].id,s.today.wind=e[0].wind,s.today.humidity=e[0].main.humidity,s.today.pressure=e[0].main.pressure,s.today.sunrise=l(e[0].sys.sunrise,t.timeformat),s.today.sunset=l(e[0].sys.sunset,t.timeformat),s.today.day=d(new Date,t.strings.days),s.forecast=[];for(var a=0;a",{class:"flatWeatherPlugin "+s.settings.view});return e("").text("Error").appendTo(a),e("").text(t).appendTo(a),e(s.element).html(a),e(s.element)},render:function(t,s){s||(s=this,t=this._weather);var a="metric"==s.settings.units?"°C":"°F";s.settings.loadingAnimation&&s.settings.render&&s.loading.remove();var i=e("",{class:"flatWeatherPlugin "+s.settings.view});if(s.settings.displayCityNameOnly?e("").text(t.city).appendTo(i):e("").text(t.location).appendTo(i),"forecast"!=s.settings.view){var n=e("",{class:"wiToday"}),o=e("",{class:"wiIconGroup"});e("",{class:"wi wi"+t.today.code}).appendTo(o),e("",{class:"wiText"}).text(t.today.desc).appendTo(o),o.appendTo(n),e("",{class:"wiTemperature"}).html(t.today.temp.now+""+a+"").appendTo(n),n.appendTo(i)}if("simple"!=s.settings.view){var r=e("",{class:"wiDetail"});if("partial"==s.settings.view&&e("",{class:"wiDay"}).text(t.today.day).appendTo(n),"partial"!=s.settings.view){"today"!=s.settings.view&&e("",{class:"wiDay"}).text(t.today.day).appendTo(r);var d=e("",{class:"astronomy"}).appendTo(r);e("",{class:"wi sunrise"}).text(t.today.sunrise).appendTo(d),e("",{class:"wi sunset"}).text(t.today.sunset).appendTo(d);var l=e("",{class:"temp"}).appendTo(r);e("").html(s.settings.strings.max+": "+t.today.temp.max+""+a+"").appendTo(l),e("").html(s.settings.strings.min+": "+t.today.temp.min+""+a+"").appendTo(l);var u=e("",{class:"atmosphere"}).appendTo(r);e("",{class:"wi humidity"}).text(t.today.humidity).appendTo(u),e("",{class:"wi pressure"}).text(t.today.pressure).appendTo(u),e("",{class:"wi wind"}).text(function(e,t,s,a){var i=t;i>=0&&i<=11.25||i>348.75&&i<=360?i=a[0]:i>11.25&&i<=33.75?i=a[1]:i>33.75&&i<=56.25?i=a[2]:i>56.25&&i<=78.75?i=a[3]:i>78.75&&i<=101.25?i=a[4]:i>101.25&&i<=123.75?i=a[5]:i>123.75&&i<=146.25?i=a[6]:i>146.25&&i<=168.75?i=a[7]:i>168.75&&i<=191.25?i=a[8]:i>191.25&&i<=213.75?i=a[9]:i>213.75&&i<=236.25?i=a[10]:i>236.25&&i<=258.75?i=a[11]:i>258.75&&i<=281.25?i=a[12]:i>281.25&&i<=303.75?i=a[13]:i>303.75&&i<=326.25?i=a[14]:i>326.25&&i<=348.75&&(i=a[15]);i||(i="");return i+" "+e+" "+("metric"==s?"km/h":"mph")}(t.today.wind.speed,t.today.wind.deg,s.settings.units,s.settings.strings.direction)).appendTo(u),r.appendTo(n)}if("today"!=s.settings.view||"forecast"==s.settings.view){for(var c=e("",{class:"wiForecasts"}),p="forecast"==s.settings.view?0:1;p",{class:"wiDay"}).html(""+t.forecast[p].day+"").appendTo(c),y=e("",{class:"wiForecast"}).appendTo(h);e("",{class:"wi wi"+t.forecast[p].code}).appendTo(y),e("",{class:"wiMax"}).html(t.forecast[p].temp.max+""+a+"").appendTo(y),e("",{class:"wiMin"}).html(t.forecast[p].temp.min+""+a+"").appendTo(y)}c.appendTo(i)}}return e(s.element).html(i),e(s.element)}}),e.fn[i]=function(t,s){return e.isFunction(r.prototype[t])?this.data("plugin_"+i)[t](s):this.each((function(){if(!e.data(this,"plugin_"+i)){var s=new r(this,t);return e.data(this,"plugin_"+i,s)}}))},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)}}(jQuery,window,document),
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}((function(e){var t,s,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],n=Array.prototype.slice;if(e.event.fixHooks)for(var o=a.length;o;)e.event.fixHooks[a[--o]]=e.event.mouseHooks;var r=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=i.length;t;)this.addEventListener(i[--t],d,!1);else this.onmousewheel=d;e.data(this,"mousewheel-line-height",r.getLineHeight(this)),e.data(this,"mousewheel-page-height",r.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=i.length;t;)this.removeEventListener(i[--t],d,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var s=e(t),a=s["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(s.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function d(a){var i,o=a||window.event,d=n.call(arguments,1),c=0,p=0,h=0,y=0,m=0;if((a=e.event.fix(o)).type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(p=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(p=-1*h,h=0),c=0===h?p:h,"deltaY"in o&&(c=h=-1*o.deltaY),"deltaX"in o&&(p=o.deltaX,0===h&&(c=-1*p)),0!==h||0!==p){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,p*=g}else if(2===o.deltaMode){var f=e.data(this,"mousewheel-page-height");c*=f,h*=f,p*=f}if(i=Math.max(Math.abs(h),Math.abs(p)),(!s||i=1?"floor":"ceil"](c/s),p=Math[p>=1?"floor":"ceil"](p/s),h=Math[h>=1?"floor":"ceil"](h/s),r.settings.normalizeOffset&&this.getBoundingClientRect){var w=this.getBoundingClientRect();y=a.clientX-w.left,m=a.clientY-w.top}return a.deltaX=p,a.deltaY=h,a.deltaFactor=s,a.offsetX=y,a.offsetY=m,a.deltaMode=0,d.unshift(a,c,p,h),t&&clearTimeout(t),t=setTimeout(l,200),(e.event.dispatch||e.event.handle).apply(this,d)}}function l(){s=null}function u(e,t){return r.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}));