// */
"use strict";
var aurel_kenburns_object={};
var $aurel_css_kenburns=jQuery('.aurel_css_kenburns');
aurel_kenburns_object.id=$aurel_css_kenburns.attr('data-id');
aurel_kenburns_object.obj=$aurel_css_kenburns;
aurel_kenburns_object.active_slide=0;
aurel_kenburns_object.max=$aurel_css_kenburns.find('.aurel_css_kenburns_slide').length;
aurel_kenburns_object.time=$aurel_css_kenburns.attr('data-time');
aurel_kenburns_object.slide_time=parseInt($aurel_css_kenburns.attr('data-time'),10) + parseInt($aurel_css_kenburns.attr('data-fade'),10);
aurel_kenburns_object.zoom=$aurel_css_kenburns.attr('data-zoom');
aurel_kenburns_object.fade=$aurel_css_kenburns.attr('data-fade');
aurel_kenburns_object.interval=setInterval("aurel_kenburns_object.move.call(aurel_kenburns_object,1)", aurel_kenburns_object.time);
aurel_kenburns_object.init=function(){
aurel_kenburns_object.obj.after('\
<style>\
.aurel_css_kenburns'+ this.id +' .aurel_css_kenburns_slide {\
transition: transform '+ aurel_kenburns_object.slide_time +'ms ease-in-out, opacity '+ aurel_kenburns_object.fade +'ms;\
}\
.aurel_css_kenburns'+ this.id +' .slide_zoom_out {\
transform: scale('+ aurel_kenburns_object.zoom +');\
}\
.aurel_css_kenburns'+ this.id +' .aurel_css_kenburns_slide.prev_slide.slide_zoom_in,\
.aurel_css_kenburns'+ this.id +' .aurel_css_kenburns_slide.active.slide_zoom_in {\
transform: scale('+ aurel_kenburns_object.zoom +');\
}\
</style>\
');
this.setup(this,'');
if(this.active_slide==0)
this.goto.call(this,1);
jQuery(window).on('load', function(){
aurel_kenburns_object.obj.removeClass('aurel_module_loading');
aurel_kenburns_object.setup.call(aurel_kenburns_object,'');
});
jQuery(window).on('resize', function(){
aurel_kenburns_object.setup.call(aurel_kenburns_object,'');
});
};
aurel_kenburns_object.setup=function(action){
if(jQuery('.aurel_css_kenburns_single').length){
var setHeight=aurel_window.height(),
setTop=0;
if(this.obj.attr('data-header')=='yes'){
setHeight=setHeight - aurel_header.height();
setTop=setTop + aurel_header.height();
}
if(this.obj.attr('data-footer')=='yes'){
setHeight=setHeight - aurel_footer.height();
}
this.obj.height(setHeight).css('top', setTop+'px');
if(aurel_footer.length){
aurel_footer.css({
'position':'fixed',
'left':'0px',
'bottom':'0px',
'width':'100%',
});
}}else{
if(this.obj.hasClass('auto_height')){
var setHeight=this.obj.parents('section.elementor-element').children('.elementor-container').height() - parseInt(this.obj.parents('.elementor-column-wrap').css('padding-top'),10) - parseInt(this.obj.parents('.elementor-column-wrap').css('padding-bottom'),10);
this.obj.height(setHeight);
}
if(this.obj.hasClass('screen_height')){
var setHeight=jQuery(window).height();
if(jQuery('#wpadminbar').length&&!this.obj.hasClass('aurel_page_kenburns')){
setHeight=setHeight - jQuery('#wpadminbar').height();
}
if(this.obj.attr('data-header')=='yes'){
setHeight=setHeight - jQuery('header').height();
}
if(this.obj.attr('data-footer')=='yes'){
if(jQuery('footer').height()!==undefined){
setHeight=setHeight - jQuery('footer').height();
}}
this.obj.height(setHeight);
}}
};
aurel_kenburns_object.move=function(dir){
if(dir > 0)
this.active_slide++;
if(dir < 0)
this.active_slide--;
this.active_slide=this.check.call(this, this.active_slide);
this.update.call(this,this.active_slide);
};
aurel_kenburns_object.check=function(check_id){
check_id=parseInt(check_id,10);
if(check_id < 1)
check_id=this.max;
if(check_id > this.max)
check_id=1;
return check_id;
};
aurel_kenburns_object.update=function(active){
clearInterval(this.interval);
this.next_slide=this.active_slide + 1;
this.prev_slide=this.active_slide - 1;
this.prev_slide=this.check.call(this, this.prev_slide);
this.next_slide=this.check.call(this, this.next_slide);
var aurel_slides=this.obj.find('.aurel_css_kenburns_slide'),
this_active=this.obj.find('[data-count='+ active +']'),
this_prev=this.obj.find('[data-count='+ this.prev_slide +']'),
this_next=this.obj.find('[data-count='+ this.next_slide +']');
aurel_slides.removeClass('active');
aurel_slides.removeClass('prev_slide');
aurel_slides.removeClass('next_slide');
this_prev.addClass('prev_slide');
this_active.addClass('active');
this_next.addClass('next_slide');
aurel_kenburns_object.interval=setInterval("aurel_kenburns_object.move.call(aurel_kenburns_object,1)", aurel_kenburns_object.time);
};
aurel_kenburns_object.goto=function(slide){
this.active_slide=slide;
if(this.active_slide < 1)
this.active_slide=this.max;
if(this.active_slide > this.max)
this.active_slide=1;
this.update.call(this,this.active_slide);
};
jQuery(window).on('elementor/frontend/init', function (){
elementorFrontend.hooks.addAction('frontend/element_ready/pm-kenburns-gallery.default', function ($scope){
$scope.find('.aurel_gallery_kenburns_container').each(function (){
aurel_kenburns_object.init.apply(aurel_kenburns_object);
});
});
});
jQuery(window).on('load', function (){
if(jQuery('body').is('.single-pm-albums')){
jQuery('.aurel_kenburns_container').each(function (){
aurel_kenburns_object.init.apply(aurel_kenburns_object);
});
}});