(function($){ "use strict"; $(document).ready(function(){ var aviabodyclasses=AviaBrowserDetection('html'); $.avia_utilities=$.avia_utilities||{}; if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&'ontouchstart' in document.documentElement){ $.avia_utilities.isMobile=true; }else{ $.avia_utilities.isMobile=false; } avia_hamburger_menu(); avia_scroll_top_fade(); aviaCalcContentWidth(); new $.AviaTooltip({"class": 'avia-search-tooltip',data: 'avia-search-tooltip', event:'click', position:'bottom', scope: "body", attach:'element', within_screen: true}); new $.AviaTooltip({"class": 'avia-related-tooltip', data: 'avia-related-tooltip', scope: ".related_posts, .av-share-box", attach:'element', delay:0}); new $.AviaAjaxSearch({scope:'#header, .avia_search_element'}); if($.fn.avia_iso_sort) $('.grid-sort-container').avia_iso_sort(); AviaSidebarShaowHelper(); $.avia_utilities.avia_ajax_call(); }); $.avia_utilities=$.avia_utilities||{}; $.avia_utilities.avia_ajax_call=function(container){ if(typeof container=='undefined'){ container='body';}; $('a.avianolink').on('click', function(e){ e.preventDefault(); }); $('a.aviablank').attr('target', '_blank'); if($.fn.avia_activate_lightbox){ $(container).avia_activate_lightbox(); } if($.fn.avia_scrollspy){ if(container=='body'){ $('body').avia_scrollspy({target:'.main_menu .menu li > a'}); }else{ $('body').avia_scrollspy('refresh'); }} if($.fn.avia_smoothscroll) $('a[href*="#"]', container).avia_smoothscroll(container); avia_small_fixes(container); avia_hover_effect(container); avia_iframe_fix(container); if($.fn.avia_html5_activation&&$.fn.mediaelementplayer) $(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'}); }; $.avia_utilities.log=function(text, type, extra){ if(typeof console=='undefined'){return;} if(typeof type=='undefined'){type="log";} type="AVIA-" + type.toUpperCase(); console.log("["+type+"] "+text); if(typeof extra!='undefined') console.log(extra); }; function aviaCalcContentWidth(){ var win=$(window), width_select=$('html').is('.html_header_sidebar') ? "#main":"#header", outer=$(width_select), outerParent=outer.parents('div:eq(0)'), the_main=$(width_select + ' .container:first'), css_block="", calc_dimensions=function(){ var css="", w_12=Math.round(the_main.width()), w_outer=Math.round(outer.width()), w_inner=Math.round(outerParent.width()); css +=" #header .three.units{width:" +(w_12 * 0.25)+ "px;}"; css +=" #header .six.units{width:" +(w_12 * 0.50)+ "px;}"; css +=" #header .nine.units{width:" +(w_12 * 0.75)+ "px;}"; css +=" #header .twelve.units{width:" +(w_12) + "px;}"; css +=" .av-framed-box .av-layout-tab-inner .container{width:" +(w_inner)+ "px;}"; css +=" .html_header_sidebar .av-layout-tab-inner .container{width:" +(w_outer)+ "px;}"; css +=" .boxed .av-layout-tab-inner .container{width:" +(w_outer)+ "px;}"; css +=" .av-framed-box#top .av-submenu-container{width:" +(w_inner)+ "px;}"; try{ css_block.text(css); } catch(err){ css_block.remove(); css_block=$("").appendTo('head:first'); }}; if($('.avia_mega_div').length > 0||$('.av-layout-tab-inner').length > 0||$('.av-submenu-container').length > 0){ css_block=$("").appendTo('head:first'); win.on('debouncedresize', calc_dimensions); calc_dimensions(); }} function AviaSidebarShaowHelper(){ var $sidebar_container=$('.sidebar_shadow#top #main .sidebar'); var $content_container=$('.sidebar_shadow .content'); if($sidebar_container.height() >=$content_container.height()){ $sidebar_container.addClass('av-enable-shadow'); }else{ $content_container.addClass('av-enable-shadow'); }} function AviaScrollSpy(element, options){ var self=this; var process=$.proxy(self.process, self) , refresh=$.proxy(self.refresh, self) , $element=$(element).is('body') ? $(window):$(element) , href; self.$body=$('body'); self.$win=$(window); self.options=$.extend({}, $.fn.avia_scrollspy.defaults, options); self.selector=(self.options.target || ((href=$(element).attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, '')) || ''); self.activation_true=false; if(self.$body.find(self.selector + "[href*='#']").length){ self.$scrollElement=$element.on('scroll.scroll-spy.data-api', process); self.$win.on('av-height-change', refresh); self.$body.on('av_resize_finished', refresh); self.activation_true=true; self.checkFirst(); setTimeout(function(){ self.refresh(); self.process(); },100); }} AviaScrollSpy.prototype={ constructor: AviaScrollSpy , checkFirst: function (){ var current=window.location.href.split('#')[0], matching_link=this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top'); } , refresh: function (){ if(!this.activation_true) return; var self=this , $targets; this.offsets=$([]); this.targets=$([]); $targets=this.$body .find(this.selector) .map(function (){ var $el=$(this) , href=$el.data('target')||$el.attr('href') , hash=this.hash , hash=hash.replace(/\//g, "") , $href=/^#\w/.test(hash)&&$(hash); return($href && $href.length && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0))&&self.$scrollElement.scrollTop()), href ]])||null; }) .sort(function (a, b){ return a[0] - b[0]; }) .each(function (){ self.offsets.push(this[0]); self.targets.push(this[1]); }); } , process: function (){ if(!this.offsets) return; if(isNaN(this.options.offset)) this.options.offset=0; var scrollTop=this.$scrollElement.scrollTop() + this.options.offset , scrollHeight=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight , maxScroll=scrollHeight - this.$scrollElement.height() , offsets=this.offsets , targets=this.targets , activeTarget=this.activeTarget , i; if(scrollTop >=maxScroll){ return activeTarget!=(i=targets.last()[0]) && this.activate(i); } for (i=offsets.length; i--;){ activeTarget!=targets[i] && scrollTop >=offsets[i] && (!offsets[i + 1]||scrollTop <=offsets[i + 1]) && this.activate(targets[i]); }} , activate: function (target){ var active , selector; this.activeTarget=target; $(this.selector) .parent('.' + this.options.applyClass) .removeClass(this.options.applyClass); selector=this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]'; active=$(selector) .parent('li') .addClass(this.options.applyClass); if(active.parent('.sub-menu').length){ active=active.closest('li.dropdown_ul_available').addClass(this.options.applyClass); } active.trigger('activate'); }}; $.fn.avia_scrollspy=function (option){ return this.each(function (){ var $this=$(this) , data=$this.data('scrollspy') , options=typeof option=='object'&&option; if(!data) $this.data('scrollspy', (data=new AviaScrollSpy(this, options))); if(typeof option=='string') data[option](); }); }; $.fn.avia_scrollspy.Constructor=AviaScrollSpy; $.fn.avia_scrollspy.calc_offset=function(){ var offset_1=(parseInt($('.html_header_sticky #main').data('scroll-offset'), 10))||0, offset_2=($(".html_header_sticky:not(.html_top_nav_header) #header_main_alternate").outerHeight())||0, offset_3=($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight())||0, offset_4=1, offset_5=parseInt($('html').css('margin-top'),10)||0, offset_6=parseInt($('.av-frame-top ').outerHeight(),10)||0; return offset_1 + offset_2 + offset_3 + offset_4 + offset_5 + offset_6; }; $.fn.avia_scrollspy.defaults = { offset: $.fn.avia_scrollspy.calc_offset(), applyClass: 'current-menu-item' }; function AviaBrowserDetection(outputClassElement){ var current_browser={}, uaMatch=function(ua){ ua=ua.toLowerCase(); var match=/(edge)\/([\w.]+)/.exec(ua) || /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(iemobile)[\/]([\w.]+)/.exec(ua) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("trident") >=0&&/(rv)(?::|)([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; return { browser: match[ 5 ]||match[ 3 ]||match[ 1 ]||"", version: match[ 2 ]||match[ 4 ]||"0", versionNumber: match[ 4 ]||match[ 2 ]||"0" };}; var matched=uaMatch(navigator.userAgent); if(matched.browser){ current_browser.browser=matched.browser; current_browser[ matched.browser ]=true; current_browser.version=matched.version; } if(current_browser.chrome){ current_browser.webkit=true; }else if(current_browser.webkit){ current_browser.safari=true; } if(typeof(current_browser)!=='undefined'){ var bodyclass='', version=current_browser.version ? parseInt(current_browser.version):""; if(current_browser.msie||current_browser.rv||current_browser.iemobile){ bodyclass +='avia-msie'; }else if(current_browser.webkit){ bodyclass +='avia-webkit'; }else if(current_browser.mozilla){ bodyclass +='avia-mozilla'; } if(current_browser.version) bodyclass +=' ' + bodyclass + '-' + version + ' '; if(current_browser.browser) bodyclass +=' avia-' + current_browser.browser + ' avia-' +current_browser.browser +'-' + version + ' '; } if(outputClassElement) $(outputClassElement).addClass(bodyclass); return bodyclass; } $.fn.avia_html5_activation=function(options){ var defaults = { ratio: '16:9' }; var options=$.extend(defaults, options), isMobile=$.avia_utilities.isMobile; this.each(function(){ var fv=$(this), id_to_apply='#' + fv.attr('id'), posterImg=fv.attr('poster'); fv.mediaelementplayer({ defaultVideoWidth: 480, defaultVideoHeight: 270, videoWidth: -1, videoHeight: -1, audioWidth: 400, audioHeight: 30, startVolume: 0.8, loop: false, enableAutosize: false, features: ['playpause','progress','current','duration','tracks','volume'], alwaysShowControls: false, iPadUseNativeControls: false, iPhoneUseNativeControls: false, AndroidUseNativeControls: false, alwaysShowHours: false, showTimecodeFrameCount: false, framesPerSecond: 25, enableKeyboard: true, pauseOtherPlayers: false, poster: posterImg, success: function (mediaElement, domObject, instance){ $.AviaVideoAPI.players[ fv.attr('id').replace(/_html5/,'') ]=instance; setTimeout(function(){ if(mediaElement.pluginType=='flash'){ mediaElement.addEventListener('canplay', function(){ fv.trigger('av-mediajs-loaded'); }, false); }else{ fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded'); } mediaElement.addEventListener('ended', function(){ fv.trigger('av-mediajs-ended'); }, false); },10); }, error: function (){ }, keyActions: [] }); }); }; function avia_hover_effect(container){ if($.avia_utilities.isMobile) return; if($('body').hasClass('av-disable-avia-hover-effect')){ return; } var overlay="", cssTrans=$.avia_utilities.supports('transition'); if(container=='body'){ var elements=$('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('#main .avia-hover-fx'); }else{ var elements=$('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('.avia-hover-fx', container); } elements.each(function(e){ var link=$(this), current=link.find('img:first'); if(current.hasClass('alignleft')) link.addClass('alignleft').css({float:'left', margin:0, padding:0}); if(current.hasClass('alignright')) link.addClass('alignright').css({float:'right', margin:0, padding:0}); if(current.hasClass('aligncenter')) link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0}); if(current.hasClass('alignnone')){ link.addClass('alignnone').css({margin:0, padding:0});; if(!link.css('display')||link.css('display')=='inline'){ link.css({display:'inline-block'});}} if(!link.css('position')||link.css('position')=='static'){ link.css({position:'relative', overflow:'hidden'});} var url=link.attr('href'), span_class="overlay-type-video", opa=link.data('opacity')||0.7, overlay_offset=5, overlay=link.find('.image-overlay'); if(url){ if(url.match(/(jpg|gif|jpeg|png|tif)/)) span_class="overlay-type-image"; if(!url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/)) span_class="overlay-type-extern"; } if(!overlay.length){ overlay=$("").appendTo(link); } link.on('mouseenter', function(e){ var current=link.find('img:first'), _self=current.get(0), outerH=current.outerHeight(), outerW=current.outerWidth(), pos=current.position(), linkCss=link.css('display'), overlay=link.find('.image-overlay'); if(outerH > 100){ if(!overlay.length){ overlay=$("").appendTo(link); } if(link.height()==0){ link.addClass(_self.className); _self.className=""; } if(!linkCss||linkCss=='inline'){ link.css({display:'block'});} overlay.css({left:(pos.left - overlay_offset) + parseInt(current.css("margin-left"),10), top:pos.top + parseInt(current.css("margin-top"),10)}) .css({overflow:'hidden',display:'block','height':outerH,'width':(outerW + (2*overlay_offset))}); if(cssTrans===false) overlay.stop().animate({opacity:opa}, 400); }else{ overlay.css({display:"none"}); }}).on('mouseleave', elements, function(){ if(overlay.length){ if(cssTrans===false) overlay.stop().animate({opacity:0}, 400); }}); }); } (function($){ $.fn.avia_smoothscroll=function(apply_to_container){ if(!this.length) return; var the_win=$(window), $header=$('#header'), $main=$('.html_header_top.html_header_sticky #main').not('.page-template-template-blank-php #main'), $meta=$('.html_header_top.html_header_unstick_top_disabled #header_meta'), $alt=$('.html_header_top:not(.html_top_nav_header) #header_main_alternate'), menu_above_logo=$('.html_header_top.html_top_nav_header'), shrink=$('.html_header_top.html_header_shrinking').length, frame=$('.av-frame-top'), fixedMainPadding=0, isMobile=$.avia_utilities.isMobile, sticky_sub=$('.sticky_placeholder:first'), calc_main_padding=function(){ if($header.css('position')=="fixed"){ var tempPadding=parseInt($main.data('scroll-offset'),10)||0, non_shrinking=parseInt($meta.outerHeight(),10)||0, non_shrinking2=parseInt($alt.outerHeight(),10)||0; if(tempPadding > 0&&shrink){ tempPadding=(tempPadding / 2) + non_shrinking + non_shrinking2; }else{ tempPadding=tempPadding + non_shrinking + non_shrinking2; } tempPadding +=parseInt($('html').css('margin-top'),10); fixedMainPadding=tempPadding; }else{ fixedMainPadding=parseInt($('html').css('margin-top'),10); } if(frame.length){ fixedMainPadding +=frame.height(); } if(menu_above_logo.length){ fixedMainPadding=$('.html_header_sticky #header_main_alternate').height() + parseInt($('html').css('margin-top'),10); } if(isMobile){ fixedMainPadding=0; }}; if(isMobile) shrink=false; calc_main_padding(); the_win.on("debouncedresize av-height-change", calc_main_padding); var hash=window.location.hash.replace(/\//g, ""); if(fixedMainPadding > 0&&hash&&apply_to_container=='body'&&hash.charAt(1)!="!"&&hash.indexOf("=")===-1){ var scroll_to_el=$(hash), modifier=0; if(scroll_to_el.length){ the_win.on('scroll.avia_first_scroll', function(){ setTimeout(function(){ if(sticky_sub.length&&scroll_to_el.offset().top > sticky_sub.offset().top){ modifier=sticky_sub.outerHeight() - 3; } the_win.off('scroll.avia_first_scroll').scrollTop(scroll_to_el.offset().top - fixedMainPadding - modifier); },10); }); }} return this.each(function(){ $(this).click(function(e){ var newHash=this.hash.replace(/\//g, ""), clicked=$(this), data=clicked.data(); if(newHash!=''&&newHash!='#'&&newHash!='#prev'&&newHash!='#next'&&!clicked.is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll')){ var container="", originHash=""; if("#next-section"==newHash){ originHash=newHash; container=clicked.parents('.container_wrap:eq(0)').nextAll('.container_wrap:eq(0)'); newHash='#' + container.attr('id') ; }else{ container=$(this.hash.replace(/\//g, "")); } if(container.length){ var cur_offset=the_win.scrollTop(), container_offset=container.offset().top, target=container_offset - fixedMainPadding, hash=window.location.hash, hash=hash.replace(/\//g, ""), oldLocation=window.location.href.replace(hash, ''), newLocation=this, duration=data.duration||1200, easing=data.easing||'easeInOutQuint'; if(sticky_sub.length&&container_offset > sticky_sub.offset().top){ target -=sticky_sub.outerHeight() - 3;} if(oldLocation+newHash==newLocation||originHash){ if(cur_offset!=target){ if(!(cur_offset==0&&target <=0)){ the_win.trigger('avia_smooth_scroll_start'); $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function(){ if(window.history.replaceState) window.history.replaceState("", "", newHash); }); }} e.preventDefault(); }} }}); }); };})(jQuery); function avia_iframe_fix(container){ var iframe=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame)', container), youtubeEmbed=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame) object, iframe[src*="youtube.com"]:not(.av_youtube_frame) embed', container).attr('wmode','opaque'); iframe.each(function(){ var current=jQuery(this), src=current.attr('src'); if(src){ if(src.indexOf('?')!==-1){ src +="&wmode=opaque&rel=0"; }else{ src +="?wmode=opaque&rel=0"; } current.attr('src', src); }}); } function avia_small_fixes(container){ if(!container) container=document; var win=jQuery(window), iframes=jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not(iframe.no_resize):not(.avia-video iframe)', container), adjust_iframes=function(){ iframes.each(function(){ var iframe=jQuery(this), parent=iframe.parent(), proportions=56.25; if(this.width&&this.height){ proportions=(100/ this.width) * this.height; parent.css({"padding-bottom":proportions+"%"}); }}); }; adjust_iframes(); } function avia_scroll_top_fade(){ var win=$(window), timeo=false, scroll_top=$('#scroll-top-link'), set_status=function(){ var st=win.scrollTop(); if(st < 500){ scroll_top.removeClass('avia_pop_class'); } else if(!scroll_top.is('.avia_pop_class')){ scroll_top.addClass('avia_pop_class'); }}; win.on('scroll', function(){ window.requestAnimationFrame(set_status); }); set_status(); } function avia_hamburger_menu(){ var header=$('#header'), header_main=$('#main .av-logo-container'), menu=$('#avia-menu'), burger_wrap=$('.av-burger-menu-main a'), htmlEL=$('html').eq(0), overlay=$('
'), overlay_scroll=$('').appendTo(overlay), inner_overlay=$('').appendTo(overlay_scroll), bgColor=$('').appendTo(overlay), animating=false, first_level={}, logo_container=$('.av-logo-container .inner-container'), menu_in_logo_container=logo_container.find('.main_menu'), cloneFirst=htmlEL.is('.html_av-submenu-display-click.html_av-submenu-clone, .html_av-submenu-display-hover.html_av-submenu-clone'), menu_generated=false, cloned_menu_cnt=0; var alternate=$('#avia_alternate_menu'); if(alternate.length > 0){ menu=alternate; } var set_list_container_height=function(){ if($.avia_utilities.isMobile){ overlay_scroll.outerHeight(window.innerHeight); }}, create_list=function(items , append_to){ if(!items) return; var list, link, current, subitems, megacolumns, sub_current, sub_current_list, new_li, new_ul; items.each(function(){ current=$(this); subitems=current.find(' > .sub-menu > li'); if(subitems.length==0){ subitems=current.find(' > .children > li'); } megacolumns=current.find('.avia_mega_div > .sub-menu > li.menu-item'); var cur_menu=current.find('>a'); var clone_events=true; if(cur_menu.length){ if(cur_menu.get(0).hash=='#'||'undefined'==typeof cur_menu.attr('href')||cur_menu.attr('href')=='#'){ if(subitems.length > 0||megacolumns.length > 0){ clone_events=false; }} } link=cur_menu.clone(clone_events).attr('style',''); if('undefined'==typeof cur_menu.attr('href')){ link.attr('href', '#'); } new_li=$('Please set a mobile device fallback image for this video in your wordpress backend
').appendTo(appendTo); } if(options&&options.bg_slider){ current.data('img-url', fallback); if(fallback_link!=""){ if(appendTo.is('a')){ appendTo.attr('href', fallback_link); }else{ appendTo.find('a').remove(); appendTo.replaceWith(function(){ var cur_slide=$(this); return $("").attr({'data-rel': cur_slide.data('rel'), 'class': cur_slide.attr('class'), 'href': fallback_link}).append($(this).contents()); }); appendTo=current.find('.avia-slide-wrap'); } if($.fn.avia_activate_lightbox){ current.parents('#main').avia_activate_lightbox(); }} }else{ var image=''; var lightbox=false; if('string'==typeof fallback_link&&fallback_link.trim()!=''){ if(appendTo.is('a')){ appendTo.attr('href', fallback_link); }else{ var rel=fallback_link.match(/\.(jpg|jpeg|gif|png)$/i)!=null ? ' rel="lightbox" ':''; image='' + image + ''; } lightbox=true; } current.find('.avia-slide-wrap').append(image); if(lightbox&&$.fn.avia_activate_lightbox){ current.parents('#main').avia_activate_lightbox(); }} }); }}, _bgPreloadImages:function(callback){ this._getImageURLS(); this._preloadSingle(0, function(){ this._kickOff(); this._preloadNext(1); }); }, _getImageURLS: function(){ var _self=this; this.$slides.each(function(i){ _self.imageUrls[i]=[]; _self.imageUrls[i]['url']=$(this).data("img-url"); if(typeof _self.imageUrls[i]['url']=='string'){ _self.imageUrls[i]['status']=false; }else{ _self.imageUrls[i]['status']=true; }}); }, _preloadSingle: function(key, callback){ var _self=this, objImage=new Image(); if(typeof _self.imageUrls[key]['url']=='string'){ $(objImage).on('load error', function(){ _self.imageUrls[key]['status']=true; _self.$slides.eq(key).css('background-image','url(' + _self.imageUrls[key]['url'] + ')'); if(typeof callback=='function') callback.apply(_self, [objImage, key]); }); if(_self.imageUrls[key]['url']!=""){ objImage.src=_self.imageUrls[key]['url']; }else{ $(objImage).trigger('error'); }}else{ if(typeof callback=='function') callback.apply(_self, [objImage, key]); }}, _preloadNext: function(key){ if(typeof this.imageUrls[key]!="undefined"){ this._preloadSingle(key, function(){ this._preloadNext(key + 1); }); }}, _bindEvents: function(){ var self=this, win=$(window); this.$slider.on('click','.next-slide', $.proxy(this.next, this)); this.$slider.on('click','.prev-slide', $.proxy(this.previous, this)); this.$slider.on('click','.goto-slide', $.proxy(this.go2, this)); if(this.options.hoverpause){ this.$slider.on('mouseenter', $.proxy(this.pause, this)); this.$slider.on('mouseleave', $.proxy(this.resume, this)); } if(this.options.stopinfiniteloop&&this.options.autoplay){ if(this.options.stopinfiniteloop=='last'){ this.$slider.on('avia_slider_last_slide', $.proxy(this._stopSlideshow, this)); } else if(this.options.stopinfiniteloop=='first'){ this.$slider.on('avia_slider_first_slide', $.proxy(this._stopSlideshow, this)); }} if(this.options.carousel==='yes'){ if(!this.isMobile){ win.on('debouncedresize', $.proxy(this._buildCarousel, this)); }}else{ win.on('debouncedresize.aviaSlider', $.proxy(this._setSize, this)); } if(!this.isMobile){ this.$slider.avia_keyboard_controls(); }else{ this.$slider.avia_swipe_trigger(); } self._attach_video_events(); }, _kickOff: function(){ var self=this, first_slide=self.$slides.eq(0), video=first_slide.data('video-ratio'); self._bindEvents(); this.$slider.removeClass('av-default-height-applied'); if(video){ self._setSize(true); }else{ if(this.options.keep_pading!=true){ self.$sliderUl.css('padding',0); self.$win.trigger('av-height-change'); }} self._setCenter(); if(this.options.carousel==='no'){ first_slide.css({visibility:'visible', opacity:0}).avia_animate({opacity:1}, function(){ var current=$(this).addClass('active-slide'); if(self.permaCaption.length){ self.permaCaption.addClass('active-slide'); }}); } if(self.options.autoplay){ self._startSlideshow(); } if(self.options.carousel==='yes'){ self._buildCarousel(); } self.$slider.trigger('_kickOff'); }, _buildCarousel:function(){ var self=this, stageWidth=this.$slider.outerWidth(), slidesWidth=parseInt(stageWidth / this.options.carouselSlidesToShow), windowWidth=window.innerWidth||$(window).width(); if(this.options.carouselResponsive && this.options.carouselResponsive.length && this.options.carouselResponsive!==null){ for (var breakpoint in this.options.carouselResponsive){ var breakpointValue=this.options.carouselResponsive[breakpoint]['breakpoint']; var newSlidesToShow=this.options.carouselResponsive[breakpoint]['settings']['carouselSlidesToShow']; if(breakpointValue >=windowWidth){ slidesWidth=parseInt(stageWidth / newSlidesToShow); this.options.carouselSlidesToShow=newSlidesToShow; }} } this.slideWidthCarousel=slidesWidth; this.$slides.each(function(i){ $(this).width(slidesWidth); }); var slideTrackWidth=slidesWidth * this.itemsCount; this.$sliderUl.width(slideTrackWidth).css('transform', 'translateX(0px)'); if(this.options.carouselSlidesToShow >=this.itemsCount){ this.$slider.find('.av-timeline-nav').hide(); }}, _navigate:function(dir, pos){ if(this.isAnimating||this.itemsCount < 2 ||!this.$slider.is(":visible")){ return false; } this.isAnimating=true; this.prev=this.current; if(pos!==undefined){ this.current=pos; dir=this.current > this.prev ? 'next':'prev'; } else if(dir==='next'){ this.current=this.current < this.itemsCount - 1 ? this.current + 1:0; if(this.current===0&&this.options.autoplay_stopper==1&&this.options.autoplay){ this.isAnimating=false; this.current=this.prev; this._stopSlideshow(); return false; }} else if(dir==='prev'){ this.current=this.current > 0 ? this.current - 1:this.itemsCount - 1; } this.gotoButtons.removeClass('active').eq(this.current).addClass('active'); if(this.options.carousel==='no'){ this._setSize(); } if(this.options.bg_slider==true){ if(this.imageUrls[this.current]['status']==true){ this['_' + this.options.animation].call(this, dir); }else{ this.loader.show(); this._preloadSingle(this.current, function(){ this['_' + this.options.animation].call(this, dir); this.loader.hide(); }); }}else{ this['_' + this.options.animation].call(this, dir); } if(this.current==0){ this.loopCount++; this.$slider.trigger('avia_slider_first_slide'); } else if(this.current==this.itemsCount - 1){ this.$slider.trigger('avia_slider_last_slide'); }else{ this.$slider.trigger('avia_slider_navigate_slide'); }}, _setSize: function(instant){ if(this.options.bg_slider==true) return; var self=this, slide=this.$slides.eq(this.current), img=slide.find('img'), current=Math.floor(this.$sliderUl.height()), ratio=slide.data('video-ratio'), setTo=ratio ? this.$sliderUl.width() / ratio:Math.floor(slide.height()), video_height=slide.data('video-height'), video_toppos=slide.data('video-toppos'); this.$sliderUl.height(current).css('padding',0); if(setTo!=current){ if(instant==true){ this.$sliderUl.css({height:setTo}); this.$win.trigger('av-height-change'); }else{ this.$sliderUl.avia_animate({height:setTo}, function(){ self.$win.trigger('av-height-change'); }); }} this._setCenter(); if(video_height&&video_height!="set"){ slide.find('iframe, embed, video, object, .av_youtube_frame').css({height: video_height + '%', top: video_toppos + '%'}); slide.data('video-height','set'); }}, _setCenter: function(){ var slide=this.$slides.eq(this.current), img=slide.find('img'), min_width=parseInt(img.css('min-width'),10), slide_width=slide.width(), caption=slide.find('.av-slideshow-caption'), css_left=((slide_width - min_width) / 2); if(caption.length){ if(caption.is('.caption_left')){ css_left=((slide_width - min_width) / 1.5); } else if(caption.is('.caption_right')){ css_left=((slide_width - min_width) / 2.5); }} if(slide_width >=min_width){ css_left=0; } img.css({left:css_left}); }, _carouselmove:function(){ var offset=this.slideWidthCarousel*this.currentCarousel; this.$sliderUl.css('transform', 'translateX(-'+offset+'px)'); }, _carouselslide: function(dir){ if(dir==='next'){ if(this.options.carouselSlidesToShow + this.currentCarousel < this.itemsCount){ this.currentCarousel++; this._carouselmove(); }} else if(dir==='prev'){ if(this.currentCarousel > 0){ this.currentCarousel--; this._carouselmove(); }} this.isAnimating=false; }, _slide: function(dir){ var dynamic=false, modifier=dynamic==true ? 2:1, sliderWidth=this.$slider.width(), direction=dir==='next' ? -1:1, property=this.browserPrefix + 'transform', reset={}, transition={}, transition2={}, trans_val=(sliderWidth * direction * -1), trans_val2=(sliderWidth * direction) / modifier; if(this.cssActive){ property=this.browserPrefix + 'transform'; if(this.css3DActive){ reset[property]="translate3d(" + trans_val + "px, 0, 0)"; transition[property]="translate3d(" + trans_val2 + "px, 0, 0)"; transition2[property]="translate3d(0,0,0)"; }else{ reset[property]="translate(" + trans_val + "px,0)"; transition[property]="translate(" + trans_val2 + "px,0)"; transition2[property]="translate(0,0)"; }}else{ reset.left=trans_val; transition.left=trans_val2; transition2.left=0; } if(dynamic){ transition['z-index']="1"; transition2['z-index']="2"; } this._slide_animate(reset, transition, transition2); }, _slide_up: function(dir){ var dynamic=true, modifier=dynamic==true ? 2:1, sliderHeight=this.$slider.height(), direction=dir==='next' ? -1:1, property=this.browserPrefix + 'transform', reset={}, transition={}, transition2={}, trans_val=(sliderHeight * direction * -1), trans_val2=(sliderHeight * direction) / modifier; if(this.cssActive){ property=this.browserPrefix + 'transform'; if(this.css3DActive){ reset[property]="translate3d(0," + trans_val + "px, 0)"; transition[property]="translate3d(0," + trans_val2 + "px, 0)"; transition2[property]="translate3d(0,0,0)"; }else{ reset[property]="translate(0," + trans_val + "px)"; transition[property]="translate(0," + trans_val2 + "px)"; transition2[property]="translate(0,0)"; }}else{ reset.top=trans_val; transition.top=trans_val2; transition2.top=0; } if(dynamic){ transition['z-index']="1"; transition2['z-index']="2"; } this._slide_animate(reset, transition, transition2); }, _slide_animate: function(reset , transition , transition2){ var self=this, displaySlide=this.$slides.eq(this.current), hideSlide=this.$slides.eq(this.prev); hideSlide.trigger('pause'); if(!displaySlide.data('disableAutoplay')){ if(displaySlide.hasClass('av-video-lazyload')&&!displaySlide.hasClass('av-video-lazyload-complete')){ displaySlide.find('.av-click-to-play-overlay').trigger('click'); }else{ displaySlide.trigger('play'); }} displaySlide.css({visibility:'visible', zIndex:4, opacity:1, left:0, top:0}); displaySlide.css(reset); hideSlide.avia_animate(transition, this.options.transitionSpeed, this.options.easing); var after_slide=function(){ self.isAnimating=false; displaySlide.addClass('active-slide'); hideSlide.css({visibility:'hidden'}).removeClass('active-slide'); self.$slider.trigger('avia-transition-done'); } if(self.options.show_slide_delay > 0){ setTimeout(function(){ displaySlide.avia_animate(transition2, self.options.transitionSpeed, self.options.easing, after_slide); },self.options.show_slide_delay); }else{ displaySlide.avia_animate(transition2, self.options.transitionSpeed, self.options.easing, after_slide); }}, _fade: function(){ var self=this, displaySlide=this.$slides.eq(this.current), hideSlide=this.$slides.eq(this.prev), properties={visibility:'visible', zIndex:3, opacity:0}, fadeCallback=function(){ self.isAnimating=false; displaySlide.addClass('active-slide'); hideSlide.css({visibility:'hidden', zIndex:2}).removeClass('active-slide'); self.$slider.trigger('avia-transition-done'); }; hideSlide.trigger('pause'); if(!displaySlide.data('disableAutoplay')){ if(displaySlide.hasClass('av-video-lazyload')&&!displaySlide.hasClass('av-video-lazyload-complete')){ displaySlide.find('.av-click-to-play-overlay').trigger('click'); }else{ displaySlide.trigger('play'); }} if(self.options.fullfade==true){ hideSlide.avia_animate({opacity:0}, 200, 'linear', function(){ displaySlide.css(properties).avia_animate({opacity:1}, self.options.transitionSpeed, 'linear',fadeCallback); }); }else{ displaySlide.css(properties).avia_animate({opacity:1}, self.options.transitionSpeed/2, 'linear', function(){ hideSlide.avia_animate({opacity:0}, 200, 'linear', fadeCallback); }); }}, _attach_video_events: function(){ var self=this, $html=$('html'); self.$slides.each(function(i){ var currentSlide=$(this), caption=currentSlide.find('.caption_fullwidth, .av-click-overlay'), mejs=currentSlide.find('.mejs-mediaelement'), lazyload=currentSlide.hasClass('av-video-lazyload') ? true:false; if(currentSlide.data('avia_video_events')!=true){ currentSlide.data('avia_video_events', true); currentSlide.on('av-video-events-bound', { slide: currentSlide, wrap: mejs , iteration: i , self: self, lazyload: lazyload }, onReady); currentSlide.on('av-video-ended', { slide: currentSlide , self: self}, onFinish); currentSlide.on('av-video-play-executed', function(){ setTimeout(function(){ self.pause() }, 100); }); caption.on('click', { slide: currentSlide }, toggle); if(currentSlide.is('.av-video-events-bound')) currentSlide.trigger('av-video-events-bound'); if(lazyload&&i===0&&!currentSlide.data('disableAutoplay')){ currentSlide.find('.av-click-to-play-overlay').trigger('click'); }} }); function onReady(event){ if(event.data.iteration===0){ event.data.wrap.css('opacity',0); if(!event.data.self.isMobile&&!event.data.slide.data('disableAutoplay')){ event.data.slide.trigger('play'); } setTimeout(function(){ event.data.wrap.avia_animate({opacity:1}, 400); }, 50); } else if($html.is('.avia-msie')&&!event.data.slide.is('.av-video-service-html5')){ if(!event.data.slide.data('disableAutoplay')) event.data.slide.trigger('play'); } if(event.data.slide.is('.av-video-service-html5')&&event.data.iteration!==0){ event.data.slide.trigger('pause'); } if(event.data.lazyload){ event.data.slide.addClass('av-video-lazyload-complete'); event.data.slide.trigger('play'); }} function onFinish(event){ if(!event.data.slide.is('.av-single-slide')&&!event.data.slide.is('.av-loop-video')){ event.data.slide.trigger('reset'); self._navigate('next'); self.resume(); } if(event.data.slide.is('.av-loop-video')&&event.data.slide.is('.av-video-service-html5')){ if($html.is('.avia-safari-8')){ setTimeout(function(){ event.data.slide.trigger('play'); },1); }} } function toggle(event){ if(event.target.tagName!="A"){ event.data.slide.trigger('toggle'); }} }, _timer: function(callback, delay, first){ var self=this, start, remaining=delay; self.timerId=0; this.pause=function(){ window.clearTimeout(self.timerId); remaining -=new Date() - start; }; this.resume=function(){ start=new Date(); self.timerId=window.setTimeout(callback, remaining); }; this.destroy=function(){ window.clearTimeout(self.timerId); }; this.resume(true); }, _startSlideshow: function(){ var self=this; this.isPlaying=true; this.slideshow=new this._timer(function(){ self._navigate('next'); if(self.options.autoplay){ self._startSlideshow(); }}, (this.options.interval * 1000)); }, _stopSlideshow: function(){ if(this.options.autoplay){ this.slideshow.destroy(); this.isPlaying=false; this.options.autoplay=false; }}, next:function(e){ e.preventDefault(); this._stopSlideshow(); this._navigate('next'); }, previous:function(e){ e.preventDefault(); this._stopSlideshow(); this._navigate('prev'); }, go2:function(pos){ if(isNaN(pos)){ pos.preventDefault(); pos=pos.currentTarget.hash.replace('#',''); } pos -=1; if(pos===this.current||pos >=this.itemsCount||pos < 0){ return false; } this._stopSlideshow(); this._navigate(false, pos); }, play:function(){ if(!this.isPlaying){ this.isPlaying=true; this._navigate('next'); this.options.autoplay=true; this._startSlideshow(); }}, pause:function(){ if(this.isPlaying){ this.slideshow.pause(); }}, resume:function(){ if(this.isPlaying){ this.slideshow.resume(); }}, destroy:function(callback){ this.slideshow.destroy(callback); }} $.fn.aviaSlider=function(options){ return this.each(function(){ var self=$.data(this, 'aviaSlider'); if(!self){ self=$.data(this, 'aviaSlider', new $.AviaSlider(options, this)); }}); }})(jQuery); (function($){ "use strict"; $(window).on('load', function (e){ if($.AviaSlider){ $('.avia-timeline-container').avia_sc_timeline(); }}); $.fn.avia_sc_timeline=function (options){ return this.each(function (){ var container=this, timeline_id='#' + $(this).attr('id'), timeline=$(timeline_id), methods; methods = { matchHeights: function(){ this.setMinHeight($(timeline_id + ' .av-milestone-placement-top .av-milestone-date'), true); this.setMinHeight($(timeline_id + ' .av-milestone-placement-bottom .av-milestone-content-wrap'), true); this.setMinHeight($(timeline_id + ' .av-milestone-placement-bottom.avia-timeline-boxshadow .av-milestone-contentbox'), false); this.setMinHeight($(timeline_id + ' .av-milestone-placement-top.avia-timeline-boxshadow .av-milestone-contentbox'), false); this.setMinHeight($(timeline_id + ' .avia-timeline-horizontal.av-milestone-placement-alternate li >:first-child'), true); }, setMinHeight: function(els, setNav){ if(els.length < 2) return; var elsHeights=new Array(); els.css('min-height','0').each(function(i){ var current=$(this); var currentHeight=current.outerHeight(true); elsHeights.push(currentHeight); }); var largest=Math.max.apply(null, elsHeights); els.css('min-height', largest); if(setNav){ var $firstElement=els.first(), $parent=$firstElement.closest('.avia-timeline-container'), $pos=$firstElement.height(); $parent.find('.av-timeline-nav').css('top',$pos); }}, createCarousel:function(e){ var self=this, slider=$(timeline_id + '.avia-slideshow-carousel'), slides_num=3, slides_num_small=1; if(timeline.attr('avia-data-slides')){ slides_num=parseInt(timeline.attr('avia-data-slides')); } if(slides_num >=2){ slides_num_small=2; } var sliderOptions={ carousel:'yes', keep_pading:true, carouselSlidesToShow:slides_num, carouselSlidesToScroll:3, carouselResponsive:[ { breakpoint: 989, settings: { carouselSlidesToShow: slides_num_small, carouselSlidesToScroll: slides_num_small, }}, { breakpoint: 767, settings: { carouselSlidesToShow: 1, carouselSlidesToScroll: 1, }} ], } slider.aviaSlider(sliderOptions); slider.on('_kickOff',function(){ self.matchHeights(); }); $(window).on('resize', function(){ self.matchHeights(); }); }, layoutHelpers:function(e){ $(timeline_id + ' .avia-timeline-vertical li').each(function(index, element){ var $length=$(this).parents('ul').find('li').length; var $icon_wrap=$(this).find('.av-milestone-icon-wrap'); var $icon_wrap_height=$icon_wrap.outerHeight(true); var $icon_wrap_height_half=parseInt($icon_wrap_height/2); if(index===($length - 1)){ $icon_wrap.css({ 'height':$icon_wrap_height_half, }); }else{ $icon_wrap.css({ 'height':$icon_wrap_height, }); }}); }, fireAnimations:function(e){ if($(timeline_id + ' > ul').hasClass('avia-timeline-vertical')){ var milestone=timeline.find('.av-milestone'); timeline.on('avia_start_animation', function(){ milestone.each(function(i){ var element=$(this); setTimeout(function(){ element.addClass('avia_start_animation') }, (i * 350)); }); }); }} }; methods.createCarousel(); methods.layoutHelpers(); methods.fireAnimations(); methods.matchHeights(); }); }})(jQuery); (function($){ "use strict"; $.AviaVideoAPI=function(options, video, option_container){ this.videoElement=video; this.$video=$(video); this.$option_container=option_container ? $(option_container):this.$video; this.load_btn=this.$option_container.find('.av-click-to-play-overlay'); this.video_wrapper=this.$video.parents('ul').eq(0); this.lazy_load=this.video_wrapper.hasClass('av-show-video-on-click') ? true:false; this.isMobile=$.avia_utilities.isMobile; this.fallback=this.isMobile ? this.$option_container.is('.av-mobile-fallback-image'):false; if(this.fallback) return; this._init(options); } $.AviaVideoAPI.defaults={ loop: false, mute: false, controls: false, events: 'play pause mute unmute loop toggle reset unload' }; $.AviaVideoAPI.apiFiles = { youtube:{loaded: false, src: 'https://www.youtube.com/iframe_api' }} $.AviaVideoAPI.players = { } $.AviaVideoAPI.prototype = { _init: function(options){ this.options=this._setOptions(options); this.type=this._getPlayerType(); this.player=false; this._bind_player(); this.eventsBound=false; this.playing=false; this.$option_container.addClass('av-video-paused'); this.pp=$.avia_utilities.playpause(this.$option_container); }, _setOptions: function(options){ var newOptions=$.extend(true, {}, $.AviaVideoAPI.defaults, options), htmlData=this.$option_container.data(), i=""; for (i in htmlData){ if(htmlData.hasOwnProperty(i)&&(typeof htmlData[i]==="string"||typeof htmlData[i]==="number"||typeof htmlData[i]==="boolean")){ newOptions[i]=htmlData[i]; }} return newOptions; }, _getPlayerType: function(){ var vid_src=this.$video.get(0).src||this.$video.data('src'); if(this.$video.is('video')) return 'html5'; if(this.$video.is('.av_youtube_frame')) return 'youtube'; if(vid_src.indexOf('vimeo.com')!=-1) return 'vimeo'; if(vid_src.indexOf('youtube.com')!=-1) return 'youtube'; }, _bind_player: function(){ var _self=this; var cookie_check=$('html').hasClass('av-cookies-needs-opt-in')||$('html').hasClass('av-cookies-can-opt-out'); var allow_continue=true; var silent_accept_cookie=document.cookie.match(/aviaCookieSilentConsent/); var self_hosted='html5'==this.type; if(cookie_check&&! silent_accept_cookie&&! self_hosted){ if(! document.cookie.match(/aviaCookieConsent/)||sessionStorage.getItem('aviaCookieRefused')){ allow_continue=false; }else{ if(! document.cookie.match(/aviaPrivacyRefuseCookiesHideBar/)){ allow_continue=false; } else if(! document.cookie.match(/aviaPrivacyEssentialCookiesEnabled/)){ allow_continue=false; } else if(document.cookie.match(/aviaPrivacyVideoEmbedsDisabled/)){ allow_continue=false; }} } if(! allow_continue){ this._use_external_link(); return; } if(this.lazy_load&&this.load_btn.length&&this.type!="html5"){ this.$option_container.addClass('av-video-lazyload'); this.load_btn.on('click', function(){ _self.load_btn.remove(); _self._setPlayer(); }); }else{ this.lazy_load=false; this._setPlayer(); }}, _use_external_link: function(){ this.$option_container.addClass('av-video-lazyload'); this.load_btn.on('click', function(e){ if(e.originalEvent===undefined) return; var src_url=$(this).parents('.avia-slide-wrap').find('div[data-original_url]').data('original_url'); if(src_url) window.open(src_url , '_blank'); }); }, _setPlayer: function(){ var _self=this; switch(this.type){ case "html5": this.player=this.$video.data('mediaelementplayer'); if(!this.player){ this.$video.data('mediaelementplayer', $.AviaVideoAPI.players[ this.$video.attr('id').replace(/_html5/,'') ]); this.player=this.$video.data('mediaelementplayer'); } this._playerReady(); break; case "vimeo": var ifrm=document.createElement("iframe"); var $ifrm=$(ifrm); ifrm.onload=function(){ _self.player=Froogaloop(ifrm); _self._playerReady(); _self.$option_container.trigger('av-video-loaded'); }; ifrm.setAttribute("src", this.$video.data('src')); $ifrm.insertAfter(this.$video); this.$video.remove(); this.$video=ifrm; break; case "youtube": this._getAPI(this.type); $('body').on('av-youtube-iframe-api-loaded', function(){ _self._playerReady(); }); break; }}, _getAPI: function(api){ if($.AviaVideoAPI.apiFiles[api].loaded===false){ $.AviaVideoAPI.apiFiles[api].loaded=true; var tag=document.createElement('script'), first=document.getElementsByTagName('script')[0]; tag.src=$.AviaVideoAPI.apiFiles[api].src; first.parentNode.insertBefore(tag, first); }}, _playerReady: function(){ var _self=this; this.$option_container.on('av-video-loaded', function(){ _self._bindEvents(); }); switch(this.type){ case "html5": this.$video.on('av-mediajs-loaded', function(){ _self.$option_container.trigger('av-video-loaded'); }); this.$video.on('av-mediajs-ended' , function(){ _self.$option_container.trigger('av-video-ended'); }); break; case "vimeo": _self.player.addEvent('ready', function(){ _self.$option_container.trigger('av-video-loaded'); _self.player.addEvent('finish', function(){ _self.$option_container.trigger('av-video-ended'); }); }); break; case "youtube": var params=_self.$video.data(); if(_self._supports_video()) params.html5=1; _self.player=new YT.Player(_self.$video.attr('id'), { videoId: params.videoid, height: _self.$video.attr('height'), width: _self.$video.attr('width'), playerVars: params, events: { 'onReady': function(){ _self.$option_container.trigger('av-video-loaded'); }, 'onError': function(player){ $.avia_utilities.log('YOUTUBE ERROR:', 'error', player); }, 'onStateChange': function(event){ if(event.data===YT.PlayerState.ENDED){ var command=_self.options.loop!=false ? 'loop':'av-video-ended'; _self.$option_container.trigger(command); }} }}); break; } setTimeout(function(){ if(_self.eventsBound==true||typeof _self.eventsBound=='undefined'||_self.type=='youtube'){ return; } $.avia_utilities.log('Fallback Video Trigger "'+_self.type+'":', 'log', _self); _self.$option_container.trigger('av-video-loaded'); },2000); }, _bindEvents: function(){ if(this.eventsBound==true||typeof this.eventsBound=='undefined'){ return; } var _self=this, volume='unmute'; this.eventsBound=true; this.$option_container.on(this.options.events, function(e){ _self.api(e.type); }); if(!_self.isMobile){ if(this.options.mute!=false){ volume="mute"; } if(this.options.loop!=false){ _self.api('loop'); } _self.api(volume); } setTimeout(function(){ _self.$option_container.trigger('av-video-events-bound').addClass('av-video-events-bound'); },50); }, _supports_video: function(){ return !!document.createElement('video').canPlayType; }, api: function(action){ if(this.isMobile&&!this.was_started()) return; if(this.options.events.indexOf(action)===-1) return; this.$option_container.trigger('av-video-'+action+'-executed'); if(typeof this[ '_' + this.type + '_' + action]=='function'){ this[ '_' + this.type + '_' + action].call(this); } if(typeof this[ '_' + action]=='function'){ this[ '_' + action].call(this); }}, was_started: function(){ if(!this.player) return false; switch(this.type){ case "html5": if(this.player.getCurrentTime() > 0) return true; break; case "vimeo": if(this.player.api('getCurrentTime') > 0) return true; break; case "youtube": if(this.player.getPlayerState()!==-1) return true; break; } return false; }, _play: function(){ this.playing=true; this.$option_container.addClass('av-video-playing').removeClass('av-video-paused'); }, _pause: function(){ this.playing=false; this.$option_container.removeClass('av-video-playing').addClass('av-video-paused'); }, _loop: function(){ this.options.loop=true; }, _toggle: function(){ var command=this.playing==true ? 'pause':'play'; this.api(command); this.pp.set(command); }, _vimeo_play: function(){ this.player.api('play'); }, _vimeo_pause: function(){ this.player.api('pause'); }, _vimeo_mute: function(){ this.player.api('setVolume', 0); }, _vimeo_unmute: function(){ this.player.api('setVolume', 0.7); }, _vimeo_loop: function(){ }, _vimeo_reset: function(){ this.player.api('seekTo',0); }, _vimeo_unload: function(){ this.player.api('unload'); }, _youtube_play: function(){ this.player.playVideo(); }, _youtube_pause: function(){ this.player.pauseVideo() }, _youtube_mute: function(){ this.player.mute(); }, _youtube_unmute: function(){ this.player.unMute(); }, _youtube_loop: function(){ if(this.playing==true) this.player.seekTo(0); }, _youtube_reset: function(){ this.player.stopVideo(); }, _youtube_unload: function(){ this.player.clearVideo(); }, _html5_play: function(){ if(this.player){ this.player.options.pauseOtherPlayers=false; this.player.play(); }}, _html5_pause: function(){ if(this.player) this.player.pause(); }, _html5_mute: function(){ if(this.player) this.player.setMuted(true); }, _html5_unmute: function(){ if(this.player) this.player.setVolume(0.7); }, _html5_loop: function(){ if(this.player) this.player.options.loop=true; }, _html5_reset: function(){ if(this.player) this.player.setCurrentTime(0); }, _html5_unload: function(){ this._html5_pause(); this._html5_reset(); }} $.fn.aviaVideoApi=function(options , apply_to_parent){ return this.each(function(){ var applyTo=this; if(apply_to_parent){ applyTo=$(this).parents(apply_to_parent).get(0); } var self=$.data(applyTo, 'aviaVideoApi'); if(!self){ self=$.data(applyTo, 'aviaVideoApi', new $.AviaVideoAPI(options, this, applyTo)); }}); }})(jQuery); window.onYouTubeIframeAPIReady=function(){ jQuery('body').trigger('av-youtube-iframe-api-loaded'); }; var Froogaloop=(function(){ function Froogaloop(iframe){ return new Froogaloop.fn.init(iframe); } var eventCallbacks={}, hasWindowEvent=false, isReady=false, slice=Array.prototype.slice, playerOrigin='*'; Froogaloop.fn=Froogaloop.prototype={ element: null, init: function(iframe){ if(typeof iframe==="string"){ iframe=document.getElementById(iframe); } this.element=iframe; return this; }, api: function(method, valueOrCallback){ if(!this.element||!method){ return false; } var self=this, element=self.element, target_id=element.id!=='' ? element.id:null, params = !isFunction(valueOrCallback) ? valueOrCallback:null, callback=isFunction(valueOrCallback) ? valueOrCallback:null; if(callback){ storeCallback(method, callback, target_id); } postMessage(method, params, element); return self; }, addEvent: function(eventName, callback){ if(!this.element){ return false; } var self=this, element=self.element, target_id=element.id!=='' ? element.id:null; storeCallback(eventName, callback, target_id); if(eventName!='ready'){ postMessage('addEventListener', eventName, element); } else if(eventName=='ready'&&isReady){ callback.call(null, target_id); } return self; }, removeEvent: function(eventName){ if(!this.element){ return false; } var self=this, element=self.element, target_id=element.id!=='' ? element.id:null, removed=removeCallback(eventName, target_id); if(eventName!='ready'&&removed){ postMessage('removeEventListener', eventName, element); }} }; function postMessage(method, params, target){ if(!target.contentWindow.postMessage){ return false; } var data=JSON.stringify({ method: method, value: params }); target.contentWindow.postMessage(data, playerOrigin); } function onMessageReceived(event){ var data, method; try { data=JSON.parse(event.data); method=data.event||data.method; } catch(e){ } if(method=='ready'&&!isReady){ isReady=true; } if(!(/^https?:\/\/player.vimeo.com/).test(event.origin)){ return false; } if(playerOrigin==='*'){ playerOrigin=event.origin; } var value=data.value, eventData=data.data, target_id=target_id==='' ? null:data.player_id, callback=getCallback(method, target_id), params=[]; if(!callback){ return false; } if(value!==undefined){ params.push(value); } if(eventData){ params.push(eventData); } if(target_id){ params.push(target_id); } return params.length > 0 ? callback.apply(null, params):callback.call(); } function storeCallback(eventName, callback, target_id){ if(target_id){ if(!eventCallbacks[target_id]){ eventCallbacks[target_id]={};} eventCallbacks[target_id][eventName]=callback; }else{ eventCallbacks[eventName]=callback; }} function getCallback(eventName, target_id){ if(target_id&&eventCallbacks[target_id]&&eventCallbacks[target_id][eventName]){ return eventCallbacks[target_id][eventName]; }else{ return eventCallbacks[eventName]; }} function removeCallback(eventName, target_id){ if(target_id&&eventCallbacks[target_id]){ if(!eventCallbacks[target_id][eventName]){ return false; } eventCallbacks[target_id][eventName]=null; }else{ if(!eventCallbacks[eventName]){ return false; } eventCallbacks[eventName]=null; } return true; } function isFunction(obj){ return !!(obj&&obj.constructor&&obj.call&&obj.apply); } function isArray(obj){ return toString.call(obj)==='[object Array]'; } Froogaloop.fn.init.prototype=Froogaloop.fn; if(window.addEventListener){ window.addEventListener('message', onMessageReceived, false); }else{ window.attachEvent('onmessage', onMessageReceived); } return (window.Froogaloop=window.$f=Froogaloop); })(); (function($){ "use strict"; $('body').on('click','.av-lazyload-video-embed .av-click-to-play-overlay', function(e){ var clicked=$(this); var cookie_check=$('html').hasClass('av-cookies-needs-opt-in')||$('html').hasClass('av-cookies-can-opt-out'); var allow_continue=true; var silent_accept_cookie=document.cookie.match(/aviaCookieSilentConsent/); if(cookie_check&&! silent_accept_cookie){ if(! document.cookie.match(/aviaCookieConsent/)||sessionStorage.getItem('aviaCookieRefused')){ allow_continue=false; }else{ if(! document.cookie.match(/aviaPrivacyRefuseCookiesHideBar/)){ allow_continue=false; } else if(! document.cookie.match(/aviaPrivacyEssentialCookiesEnabled/)){ allow_continue=false; } else if(document.cookie.match(/aviaPrivacyVideoEmbedsDisabled/)){ allow_continue=false; }} } var container=clicked.parents('.av-lazyload-video-embed'); if(container.hasClass('avia-video-lightbox')&&container.hasClass('avia-video-standard-html')){ allow_continue=true; } if(! allow_continue){ if(typeof e.originalEvent=='undefined'){ return; } var src_url=container.data('original_url'); if(src_url) window.open(src_url , '_blank', 'noreferrer noopener'); return; } var video=container.find('.av-video-tmpl').html(); var link=''; if(container.hasClass('avia-video-lightbox')){ link=container.find('a.lightbox-link'); if(link.length==0){ container.append(video); setTimeout(function(){ link=container.find('a.lightbox-link'); if($('html').hasClass('av-default-lightbox')){ link.addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); link.trigger('click'); }else{ link.trigger('avia-open-video-in-lightbox'); }}, 100); }else{ link.trigger('click'); }}else{ container.html(video); }}); $('.av-lazyload-immediate .av-click-to-play-overlay').trigger('click'); }(jQuery)); !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e