!function(e){"use strict";window.jnews.weather=window.jnews.weather||{},window.jnews.weather={init:function(t){let a=this;a.container=void 0===t?e("body"):t,a.topbarWeather(),a.widgetWeather()},topbarWeather:function(){let e=this;e.container.find(".jeg_top_weather").length&&(e.element=e.container.find(".jeg_top_weather"),e.topbarWeatherHover(),e.topbarWeatherCarousel(),e.topbarTempClick())},topbarTempClick:function(){this.element.on("click",".jeg_weather_temp",(function(){let t=e(this),a=t.find(".jeg_weather_value"),n=t.find(".jeg_weather_unit"),i=n.attr("data-unit");t.find(".jeg_weather_degrees").length&&(n=t.find(".jeg_weather_degrees"),i=n.attr("data-unit")),"f"===i?(a.text(a.attr("data-temp-c")),n.attr("data-unit","c"),t.find(".jeg_weather_unit").text("°c")):(a.text(a.attr("data-temp-f")),n.attr("data-unit","f"),t.find(".jeg_weather_unit").text("°f"))}))},topbarWeatherHover:function(){this.element.hoverIntent({over:function(){e(this).find(".jeg_weather_item").fadeIn()},out:function(){e(this).find(".jeg_weather_item").fadeOut()},timeout:300})},topbarWeatherCarousel:function(){let e=this;if(e.autoplay=e.element.find(".jeg_weather_item_carousel").attr("data-autoplay"),e.autoplayDelay=e.element.find(".jeg_weather_item_carousel").attr("data-auto-delay"),e.autoplayHover=e.element.find(".jeg_weather_item_carousel").attr("data-auto-hover"),e.element.find(".jeg_weather_item_carousel").length){var t=!!("object"==typeof jnews&&"object"==typeof jnews.library)&&jnews.library;t&&"function"==typeof jnews.tns&&t.forEach(e.element.find(".jeg_weather_item_carousel"),(function(a,n){if(!t.hasClass(a,"jeg_tns_active")){var i=jnews.tns({container:a,items:3,rewind:!0,nav:!1,controls:!1,mouseDrag:!0,controlsText:["",""],autoplay:"1"===e.autoplay,autoplayTimeout:parseInt(e.autoplayDelay),autoplayHoverPause:"1"===e.autoplayHover});void 0!==i&&(i.events.on("dragStart",(function(e){e.event.preventDefault(),e.event.stopPropagation()})),t.addClass(a,"jeg_tns_active"),t.dataStorage.put(a,"tiny-slider",i))}}))}},convertTemperature:function(e,t){let a={};return"f"===e?(a.unit="c",a.value=5*(t-32)/9,a.value=Math.floor(a.value)):(a.unit="f",a.value=9*t/5+32,a.value=Math.floor(a.value)),a},widgetWeather:function(){let e=this;e.container.find(".jeg_weather_widget").length&&(e.element=e.container.find(".jeg_weather_widget"),e.widgetTempClick())},widgetTempClick:function(){this.element.on("click",".jeg_weather_temp",(function(){e(this).find(".jeg_weather_value").each((function(){let t=e(this),a=t.parent().find(".jeg_weather_unit");"f"===a.attr("data-unit")?(t.text(t.attr("data-temp-c")),a.attr("data-unit","c"),a.text("c")):(t.text(t.attr("data-temp-f")),a.attr("data-unit","f"),a.text("f"))}))}))}},e(document).on("jnews-ajax-load",(function(){jnews.weather.init()})),"object"==typeof jnews&&"object"==typeof jnews.library&&jnews.library.winLoad((function(){jnews.library.requestAnimationFrame.call(jnews.library.win,(function(){jnews.weather.init()}))}))}(jQuery);