jQuery(document).ready(function($){
$('#pw-weak').remove();
$('.pw-weak').remove();
});
jQuery(document).ready(function($){
$.fn.evosl_shortcode_data=function(){
var ev_cal=$(this);
return ev_cal.find('.evo_cal_data').data('sc');
};
function debounce(func, wait){
let timeout;
return function executedFunction(...args){
const later=()=> {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout=setTimeout(later, wait);
};}
sliderfy_events();
$(window).resize(debounce(sliderfy_events, 250));
function sliderfy_events(){
const $calendars=$('body').find('.evoslider');
if(!$calendars.length) return;
$calendars.each(function(){
var CAL=$(this);
var SC=CAL.evosl_shortcode_data();
var OUTTER=CAL.find('.evo_slider_slide_out');
var slides=CAL.find('.eventon_list_event').length;
var EL=CAL.find('.eventon_events_list');
const sl_on=CAL.hasClass('evoslON') ? true: false;
let all_slides_count=0;
var slider_move_distance=0;
var all_slides_w=0;
var slider_h=0;
var cal_width=CAL.width();
slides_visible=('slides_visible' in SC)? SC.slides_visible: 1;
if(cal_width < 800&&slides_visible > 2) slides_visible=2;
if(cal_width < 600&&slides_visible > 1) slides_visible=1;
if(sl_on) slides=CAL.find('.sl.slide').length;
var __all_slides=slides +(slides_visible * 2);
if(SC.control_style=='tb'||SC.control_style=='lr'||SC.control_style=='lrc'){
if(CAL.find('.evoslider_dots').length==0){
var html="<span class='evoslider_nav nav prev'><i class='fa fa-angle-left'></i></span>";
CAL.find('.evo_slider_outter').prepend(html);
var html="<span class='evoslider_nav nav next'><i class='fa fa-angle-right'></i></span>";
CAL.find('.evo_slider_outter').append(html);
CAL.find('.evosl_footer').append("<span class='evoslider_dots none'></span>");
}}else{
var html='';
html +="<div class='evosl_footer_in'>";
html +="<span class='evoslider_nav nav prev'><i class='fa fa-angle-left'></i></span>";
html +="<span class='evoslider_dots none'></span>";
html +="<span class='evoslider_nav nav next'><i class='fa fa-angle-right'></i></span>";
html +="</div>";
CAL.find('.evosl_footer').html(html);
}
slider_w=OUTTER.width();
slider_w=cal_width;
if(!sl_on){
EL.find('.eventon_list_event').each(function(index){
var el=$(this);
const hasImg=el.find('.desc_trig').hasClass('hasFtIMG');
var c=el.data('colr');
el.css('background-color', c);
if(!el.parent().hasClass('slide'))
el.wrap('<div class="slide sl '+(hasImg ? ' hasIMG':'') +'" data-index="' +(index + 1) +'"></div>');
if(!_hex_is_light(c)) el.addClass('sldark');
});
}
all_slides_count=CAL.find('.sl').length;
var cur_slide_index=parseInt(EL.data('slideindex'));
if(cur_slide_index===undefined||!cur_slide_index) cur_slide_index=1;
if(SC.slider_type=='vertical'){
EL.fadeIn().data('slideindex',1);
var on_slide_h=0;
OUTTER.height(0);
var max_height=0;
EL.find('.slide').each(function(){
const hh=$(this).outerHeight(true);
if(max_height < hh) max_height=hh;
});
EL.find('.sl').each(function(){
$(this).height(max_height);
});
var visible_height=max_height * slides_visible;
OUTTER.height(visible_height);
}else{
var one_slide_w=0;
var slider_move_distance=slider_w;
if(SC.slider_type=='micro'){
slv=parseInt(slider_w/ 125);
slides_visible=slv;
}else if(SC.slider_type=='mini'){
slv=parseInt(slider_w/ 200);
if(SC.slide_style=='imgleft') slv=parseInt(slider_w/ 300);
slides_visible=slv;
}else if(SC.slider_type=='multi'){
if(SC.slides_visible==1) SC.slides_visible=slides_visible=4;
if(slider_w < 550&&SC.slides_visible > 1)
slides_visible=1;
if(slider_w > 551&&slider_w < 800&&SC.slides_visible > 2)
slides_visible=2;
if(slider_w > 801&&slider_w < 900&&SC.slides_visible > 3)
slides_visible=3;
if(slider_w > 901&&slider_w < 1000&&SC.slides_visible > 4)
slides_visible=4;
}
one_slide_w=parseInt(slider_w/ slides_visible);
if(SC.control_style=='lr') one_slide_w -=50;
slider_move_distance=one_slide_w;
all_slides_w=all_slides_count * one_slide_w;
visible_width=one_slide_w * slides_visible;
EL.width(all_slides_w).fadeIn().data('slideindex', cur_slide_index);
CAL.find('.sl').width(one_slide_w);
OUTTER.width(visible_width);
}
CAL.find('.evo_loading_bar_holder').remove();
var dots_html='';
if(SC.slide_nav_dots=='yes'){
dot_max=slides - 0 ;
for(var dc=1; dc <=dot_max; dc++){
dots_html +="<span class='evosl_dot "+ (dc==cur_slide_index? 'f':'') +"' data-index='"+ dc+"'><em></em></span>";
}
var extra_class=dot_max <1 ? 'none':'';
CAL.find('.evoslider_dots').html(dots_html).addClass(extra_class);
}
let _create_duplicates=false;
if(EL.find('.dup').length==0&&slides > 1) _create_duplicates=true;
if(slides_visible < slides) _create_duplicates=true;
if(_create_duplicates){
let duplicate_count=0;
for(y=0; y <(slides_visible); y++){
var z=EL.find('.slide').clone().eq(slides - y -1);
let newIndex=0 - y;
if(EL.find('.slide.prev_'+ newIndex).length==0){
z.addClass('dup sl prev_'+ newIndex).removeClass('slide').data('index', newIndex).attr('data-index', newIndex);
EL.prepend(z); duplicate_count++;
}
var v=EL.find('.slide').clone().eq(y);
let postIndex=slides + 1+y;
if(EL.find('.slide.post_'+ postIndex).length==0){
v.addClass('dup sl post_'+ postIndex).removeClass('slide').data('index', postIndex).attr('data-index', postIndex);
EL.append(v); duplicate_count++;
}}
EL.data({'slides_visible': slides_visible});
all_slides_w=(all_slides_count + duplicate_count)  * one_slide_w;
EL.width(all_slides_w);
}
go_to_slide_index(cur_slide_index , CAL, true, false, false);
EL.data({
'slider_move_distance':slider_move_distance,
'all_slides_w':all_slides_w,
'slides_visible':slides_visible
});
CAL.addClass('evoslON');
if(SC.slide_hide_control=='yes')	CAL.find('.evosl_footer').hide();
if(CAL.find('.no_events').length > 0){
CAL.addClass('no_slides');
}
if(CAL.find('.slide.sl').length==1&&SC.slides_visible > 1){
CAL.find('.sl').width(cal_width);
}});
}
$.fn.slider_work=function (options){
var slide={},
interval=null,
$el=this;
slide.$el=this;
var SC=$el.evosl_shortcode_data();
var EL=$el.find('.eventon_events_list');
const slider_outter=$el.find('.evo_slider_outter');
var all_slides=EL.find('.slide').length;
slide={
iv: SC.slider_pause,
running: false,
init: function(){
if(SC.slide_auto=='yes'){
slide.auto();
if(SC.slide_pause_hover=='yes'){
slider_outter.on('mouseover', function(e){
e.stopPropagation();
slider_outter.addClass('pause');
}).on('mouseout',function(){
slider_outter.removeClass('pause');
});
}}
all_slides -=1;
},
auto: function (){
if(SC.slide_auto=='yes'){
clearInterval(interval);
interval=setInterval(function(){
if(!slider_outter.hasClass('pause')) slide.gotoNextSlides();
}, this.iv);
}},
resetInterval: function(){
slide.auto();
},
pause: function(){
clearInterval(interval);
},
gotoNextSlides: function(){
go_to_slide_index('next' , $el);
slide.resetInterval();
},
interaction: function(){
var slider_inter_area=$el.find('.evo_slider_slide_out');
slider_inter_area.swipe({
swipeLeft: function(event){
if(!$(event.target).closest('.evcal_list_a').length) return;
go_to_slide_index('next', $el);
},
swipeRight: function(event){
if(!$(event.target).closest('.evcal_list_a').length) return;
go_to_slide_index('prev', $el);
},
threshold: 75,
allowPageScroll: 'vertical'
});
$el.on('click','.evoslider_nav',function(){
var direction=$(this).hasClass('next')? 'next':'prev';
go_to_slide_index(direction, $el);
});
$el.on('click','.evosl_dot', function(){
go_to_slide_index($(this).data('index') , $el);
});
},
};
slide.init();
slide.interaction();
};
$('body').find('.evoslider').each(function(){
$(this).slider_work();
});
$('.ajde_evcal_calendar.microSlider').on('mouseover','.eventon_list_event', function(){
O=$(this);
OUT=O.closest('.evo_slider_outter');
title=O.find('.evcal_event_title').html();
p=O.position();
OUT.append('<span class="evo_bub_box" style="">'+ title +"</span>");
B=OUT.find('.evo_bub_box');
l=p.left;
t=p.top- B.height() -30;
LM=OUT.width();
tl=p.left + B.width() + O.width();
if(tl > LM){
l=l - B.width() +O.width()-20;
}
B.css({'top':t, 'left':l});
OUT.find('.evo_bub_box').addClass('show');
}).on('mouseout',function(){
B=$(this).find('.evo_bub_box').remove();
});
function go_to_slide_index(new_slide_index, CAL, instant=false, move_dots=true, initial_call=false){
var slider=CAL.find('.evo_slider_slide_out');
var SC=CAL.evosl_shortcode_data();
var EL=CAL.find('.eventon_events_list');
var all_slides=CAL.find('.slide').length;
var slides_visible=parseInt(EL.data('slides_visible')) ;
var __all_slides=CAL.find('.sl').length;
var slider_move_distance=EL.data('slider_move_distance');
var _do_merge=false;
var cur_slide_index=parseInt(EL.data('slideindex'));
var cur_mart=parseFloat(EL.css('margin-top'));
var cur_slider_height=slider.height();
const current_first_visible_slide_elm=CAL.find('.slide[data-index="'+ cur_slide_index +'"]');
var cur_marl=parseFloat(EL.css('margin-left'));
var new_marL=new_marT=0;
if(new_slide_index=='next'||new_slide_index=='prev'){
if(new_slide_index=='next'){
var new_slide_index=cur_slide_index + 1;
if(new_slide_index >(all_slides +1) ) new_slide_index=1;
}else{
var new_slide_index=cur_slide_index - 1;
if(new_slide_index < 0) new_slide_index=all_slides;
}}
const new_first_visible_slide_elm=CAL.find('.sl[data-index="'+ new_slide_index +'"]');
var _prev_slides_count=new_first_visible_slide_elm.prevAll('.sl').length;
if(SC.slider_type=='vertical'){
for (var i=0; i < (_prev_slides_count); i++){
new_marT +=CAL.find('.sl').eq(i).outerHeight(true);
}
new_marT=-1 * new_marT;
}else{
for (var i=0; i < _prev_slides_count; i++){
var ww=CAL.find('.sl').eq(i).width();
new_marL +=ww;
}
new_marL=-1 * new_marL;
}
EL.data('slideindex', new_slide_index);
if(instant){
EL.css({
marginLeft: new_marL,
marginTop: new_marT,
});
}else{
EL.animate({
marginLeft: new_marL,
marginTop: new_marT,
}, parseInt(SC.slider_speed) , 'easeOutCirc');
}
setTimeout(function(){
new_marL=new_marT=0;
const new_first_visible_slide_elm=CAL.find('.sl[data-index="'+ new_slide_index +'"]');
var _prev_slides_count=new_first_visible_slide_elm.prevAll('.sl').length  -(slides_visible - 1);
var _next_slides_count=new_first_visible_slide_elm.nextAll('.sl').length -(slides_visible - 1);
if(cur_slide_index==all_slides&&new_slide_index==(all_slides + 1)){
const new_first_visible_slide_elm=CAL.find('.sl[data-index="'+ 1 +'"]');
var _prev_slides_count=new_first_visible_slide_elm.prevAll('.sl').length;
for (var i=0; i < _prev_slides_count; i++){
var ww=CAL.find('.sl').eq(i).width();
var hh=CAL.find('.sl').eq(i).outerHeight(true);
new_marL +=ww;
new_marT +=hh;
}
if(SC.slider_type=='vertical'){
new_marL=0;
}else{
new_marT=0;
}
EL.css({
marginLeft: new_marL  * -1,
marginTop: new_marT  * -1,
});
EL.data('slideindex', 1);
new_slide_index=1;
}
if(new_slide_index==0){
const new_first_visible_slide_elm=CAL.find('.sl[data-index="'+ all_slides +'"]');
var _prev_slides_count=new_first_visible_slide_elm.prevAll('.sl').length;
for (var i=0; i < _prev_slides_count; i++){
var ww=CAL.find('.sl').eq(i).width();
var hh=CAL.find('.sl').eq(i).outerHeight(true);
new_marL +=ww;
new_marT +=hh;
}
if(SC.slider_type=='vertical'){
new_marL=0;
}else{
new_marT=0;
}
EL.css({
marginLeft: new_marL * -1,
marginTop: new_marT  * -1,
});
EL.data('slideindex',(all_slides) );
new_slide_index=all_slides;
}}, parseInt(SC.slider_speed) + 100);
setTimeout(function(){
if(move_dots){
CAL.find('.evosl_footer .evosl_dot').removeClass('f');
CAL.find('.evosl_footer .evosl_dot').eq(new_slide_index -1).addClass('f');
}}, parseInt(SC.slider_speed) + 101);
}
function _hex_is_light(color){
if(color===undefined) return false;
const hex=color.replace('#', '');
const c_r=parseInt(hex.substr(0, 2), 16);
const c_g=parseInt(hex.substr(2, 2), 16);
const c_b=parseInt(hex.substr(4, 2), 16);
const brightness=((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000;
return brightness > 220;
}});