PageSourceSearch

https://canadianorchidcongress.ca/wp-content/plugins/eventON/assets/js/eventon_script.js

js canadianorchidcongress.ca collected 2026-10-02 12:04:20 UTC 83,674 bytes, 2,738 lines download raw bytes

1/**
2 * Javascript code that is associated with the front end of the calendar
3 * @version 4.5
4 */
5
6jQuery(document).ready(function($){
7		
8	var BODY = $('body');
9	var BUS = ''; // initial eventon calendar data
10	var ajax_url = '';
11
12	init();
13	
14// EventON calendar main function
15// 2.8.6
16	$.fn.evo_calendar = function (options) {
17
18		el = this;
19		var cal = {};
20		var defaults = {
21			'SC': {},
22			'json':{}
23		};
24		var calO = {};
25
26		var init = function(){
27			calO = el.O = $.extend({},defaults, options);
28
29			// load shortcodes to calendar
30			if( calO.SC !== undefined){
31				el.evo_cal_functions({action:'update_shortcodes',SC: calO.SC});
32			}
33
34			// load events json to calednar
35			if( calO.json !== undefined){
36				el.find('.evo_cal_events').data('events', calO.json);
37			}
38
39			load_maps();
40			interactions();			
41		};
42
43		var load_maps = function(){
44			if(calO.SC.evc_open == 'yes'){
45				el.find('.desc_trig').each(function(index){
46					var self = this;
47					setTimeout(function(){
48						$(self).evoGenmaps({'fnt':2,'cal': el});
49					},index*600);					
50				});
51			}
52		};
53		
54		var interactions = function(){
55			close_eventcard();
56			counters();
57			live_now_cal();
58		}
59
60
61		var live_now_cal = function(){
62			$(el).find('.evo_img_time').each(function(){
63				if( $(this).closest('a.desc_trig').find('em.evcal_time').length ){
64					_html = $(this).closest('a.desc_trig').find('em.evcal_time')[0].outerHTML;
65					$(this).html( _html );
66				}				
67			});
68		}
69
70		var counters = function(){
71			$(el).find('.evo_countdowner').each(function(){
72				$(this).evo_countdown();
73			});
74		}
75
76		var close_eventcard = function(){
77			$(el).on('click','.evcal_close',function(){
78				$(this).closest('.evcal_eventcard').slideUp().removeClass('open');
79			});
80		}	
81
82		init();	
83	};
84
85	/*
86	$('body').bind('touchend',function(event){
87		console.log(event);
88		if( $(event.target).hasClass('evcal_arrows') ){
89			$(event.target).hover();
90		}
91	});
92	*/
93
94// localize event time function
95	$.fn.evo_local_time = function( options){
96		el = this;
97
98		$(el).find('.evo_mytime').each(function(){
99			const obj = $(this);
100			const event_obj = obj.closest('.eventon_list_event');
101			var time  = obj.data('times');
102			var tformat = obj.data('tform');
103
104			new_time = time.split('-');
105			
106			utc_offset = $(this).data('tzo');
107
108			start = parseInt(new_time[0]);
109			end = parseInt(new_time[1]);
110			offset_start = start + utc_offset;
111
112			// end
113			var Me = moment.unix( end + utc_offset ).utc().local();
114			var M1 = moment.unix( offset_start ).utc().local();
115
116			var _html = '';
117
118			if( Me.format('YYYY/M') != M1.format('YYYY/M')){
119				_html = M1.format( tformat ) +' - '+ Me.format( tformat );
120			}else{
121				_html = M1.format( tformat );
122			}
123
124			event_obj.find('.evo_mytime').find('b').html( _html );
125			event_obj.find('.evo_mytime').removeClass('tzo_trig');
126			
127		});
128	};
129	// user local time		
130		BODY.on('click','.tzo_trig',function(event){
131			event.preventDefault();
132			event.stopPropagation();			
133			$(this).parent().evo_local_time();
134			return;
135		});
136
137// RUN on Page load
138	function init(){
139
140		ajax_url = evo_general_params.ajaxurl;
141
142		init_run_gmap_openevc();
143		fullheight_img_reset();	
144
145
146		init_load_cal_data();
147
148		handlebar_additional_arguments();
149
150		// run basic countdown timers
151		BODY.find('.evo_countdowner').each(function(){
152			$(this).evo_countdown();
153		});
154
155
156		jitsi();
157	}
158
159// GENERALIZED functions
160// General AJAX trigger - added 3.1
161	$(document).on('click','.evo_trig_ajax',function(event ){
162		var ajax_data = {};
163		const obj = $(this);
164
165		ajax_data = obj.data();
166		$(document).data( 'evo_data', ajax_data );
167
168		$(document).trigger('evo_before_trig_ajax', [obj]);
169
170		var new_ajax_data = $(document).data( 'evo_data');
171		new_ajax_data['nn'] = the_ajax_script.postnonce;
172
173		$.ajax({
174			beforeSend: function(){
175				$(document).trigger('evo_beforesend_trig_ajax', [obj, new_ajax_data]);
176			},
177			type: 'POST',url: get_ajax_url('eventon_gen_trig_ajax') ,data: new_ajax_data,dataType:'json',
178			success:function(return_data){
179				$(document).trigger('evo_success_trig_ajax', [obj, new_ajax_data, return_data]);
180			},complete:function(){
181				$(document).trigger('evo_complete_trig_ajax', [obj, new_ajax_data]);
182			}
183		});
184
185	});
186
187// Virtual Events & jitsi
188	function jitsi(mod_refresh){
189		
190		const domain = 'meet.jit.si';
191	    const api = [];
192
193	    jQuery('.evo-jitsi-wrapper').each(function(index, element) {
194	    	const O = $(this);
195	    	const eventO = O.closest('.eventon_list_event');
196
197	    	// check if mod refresh is set or no
198	    	if( mod_refresh != '' && mod_refresh == 'mod_refresh_no' && O.hasClass('mod')) return;
199
200	        var roomName = jQuery(element).data('n'),
201	            width = jQuery(element).data('width'),
202	            height = jQuery(element).data('height'),
203	            audioMuted = jQuery(element).data('audiomute'),
204	            videoMuted = jQuery(element).data('videomute'),
205	            screenSharing = jQuery(element).data('screen');
206	           
207
208	        const myOverwrite =
209			{
210			 	'TOOLBAR_BUTTONS': $(element).data('d'),
211			    "DEFAULT_BACKGROUND": '#494a4e',
212			    'MOBILE_APP_PROMO': false,
213			    'SETTINGS_SECTIONS':['devices', 'language', 'profile', 'calendar'],
214			};
215
216
217	        const options = {
218	            roomName,
219	            width,
220	            height,
221	            parentNode: element,	            
222	            configOverwrite: { 
223	            	startWithAudioMuted: audioMuted,
224	                startWithVideoMuted: videoMuted,
225	                startScreenSharing: false,	  
226	                disableInviteFunctions: false,             
227	            },
228	            interfaceConfigOverwrite: myOverwrite,     
229	        };
230
231
232	        const api = new JitsiMeetExternalAPI(domain, options);      
233
234	        api.addEventListener('participantRoleChanged', function(event){
235
236	        	// record moderator joined
237	        	if (event.role === "moderator"){	        		
238	        		_record_moderator_join( 'yes', eventO.data('event_id'), eventO.data('ri'));
239	        	}
240
241	        	const pp = jQuery(element).data('p');
242	        	if (event.role === "moderator" && pp != '__') {
243	        		ppp = pp.replace('_','');
244			        api.executeCommand('password', ppp);
245			    }	        	
246	        });	
247
248	        // moderator leave	        
249	        api.addEventListener('videoConferenceLeft', function(event){
250	        	if( eventO.find('.evo_vir_data').data('ismod') =='y'){
251	        		_record_moderator_join( 'no', eventO.data('event_id'), eventO.data('ri'));
252	        		O.siblings('.evo_vir_mod_left').show();
253	        		O.hide();
254	        	}
255	        });
256	    });
257	}
258	// record moderator logins for jitsi
259		function _record_moderator_join(joined, eid, ri){
260			var data_arg = {
261				'action': 'eventon_record_mod_joined',
262				'eid': eid,
263				'ri': ri,
264				'joined': joined,
265				'nonce': evo_general_params.n,				
266			};
267
268			$.ajax({
269				beforeSend: function(){},
270				type: 'POST',url: ajax_url,data: data_arg,dataType:'json',
271				success:function(data){	}
272			});
273		}
274	
275
276	// refresh event card elements  - evo_reload_virtual_events
277	// @+ 3.1
278		$('body').on('evo_refresh_elements',function(event, send_data ){
279
280			if( send_data.length <= 0 || !send_data) return;
281
282			send_data['nonce'] = evo_general_params.n;
283
284			$.ajax({
285				beforeSend: function(){	
286					if( 'evo_data' in send_data){
287						$.each(send_data.evo_data, function(ekey, eclasses){
288							$.each(eclasses, function(classnm, val){	
289								if(val && 'loader' in val && val['loader'] && 'loader_class' in val){
290									$('#event_'+ekey).find('.'+val['loader_class']).addClass('evoloading');	
291								}
292							});
293						});	
294					}
295				},
296				type: 'POST',url: get_ajax_url('eventon_refresh_elm'),data: send_data,dataType:'json',
297				success:function(data){
298					if( data.status == 'good' ){
299						evo_apply_refresh_content( data );
300					}
301				},complete: function(){	
302					if( 'evo_data' in send_data){
303						$.each(send_data.evo_data, function(ekey, eclasses){
304							$.each(eclasses, function(classnm, val){
305								if(val && 'loader' in val && val['loader'] && 'loader_class' in val){
306									$('#event_'+ekey).find('.'+val['loader_class']).removeClass('evoloading');	
307								}
308							});
309						});	
310					}
311				}
312			});
313		});
314
315		// refresh the closest hearbeat run parent
316		$('body').on('evo_refresh_designated_elm', function(ee, elm, elm_class, extra_data){
317
318			//get closest event object
319			const event = $(elm).closest('.eventon_list_event');
320
321			if( !event ) return;
322			if( event.find('.'+elm_class).length == 0 ) return;
323
324			const refresh_elm = event.find('.'+elm_class);
325
326			var send_data = {};		
327
328			send_data['evo_data'] = build_elm_refresh_data( refresh_elm , extra_data);
329			
330			$('body').trigger('evo_refresh_elements',[ send_data ]);
331		});
332
333	// record sign in - virtual plus
334		// @+3.1
335		$('body').on('click','.evo_vir_signin_btn',function(){
336						
337			extra_data = {};
338			extra_data['signin'] = 'y';
339			extra_data['refresh_main'] = 'y';
340			extra_data['loader'] = true;
341			extra_data['loader_class'] = 'evo_vir_main_content';
342
343			$('body').trigger('evo_refresh_designated_elm',[ $(this) , 'evo_vir_data',extra_data]);
344		});
345
346
347	// apply refresh event element content with matching data that is sent
348		function evo_apply_refresh_content(data){
349
350			if( 'evo_data' in data ){
351
352				$.each(data.evo_data, function(eclass, boxes){
353					// if event exists in the page
354
355					var vir_data_vals = false;
356					if( 'evo_vir_data' in boxes) vir_data_vals = boxes.evo_vir_data.data;
357
358					$('body').find('.'+eclass).each(function(){
359						const event_elm = $(this);
360
361						// set html
362						$.each(boxes, function(boxclass, boxdata){
363							if( !('html' in boxdata) ) return;
364							if( boxdata.html == '' ) return;
365							if( event_elm.find('.'+boxclass).legnth <= 0 ) return;
366
367							event_elm.find( '.'+boxclass ).html( boxdata.html );
368						});
369
370						// only for virtual event update
371						if( vir_data_vals ){
372
373							// reload jitsi for main content - if main content html is sent it will refresh
374								if( vir_data_vals && ('vir_type' in vir_data_vals) 
375									&& vir_data_vals.vir_type == 'jitsi' 
376									&& ('evo_vir_main_content' in boxes) 
377									&& ('html' in boxes.evo_vir_main_content)  
378									&& boxes.evo_vir_main_content.html != ''
379								){
380									jitsi('mod_refresh_no');
381								}
382
383							// update data for sent object
384								$.each(boxes, function(boxclass, boxdata){
385									if( boxdata.data == '' || boxdata.data === undefined) return;
386
387									// for jitsi if mod left --> force refresh main
388									if( boxdata !== undefined && vir_data_vals.vir_type == 'jitsi' && vir_data_vals.mod_joined =='left'){
389										
390										// force refresh main
391										boxdata.data['refresh_main'] = 'yy';
392									}	
393
394									event_elm.find( '.'+boxclass ).data( boxdata.data );
395								});
396						}
397
398					});
399				});
400			}
401		}
402	// get refresh data for specified elem
403		function build_elm_refresh_data( elm , extra_data){
404
405			dataObj = {};
406
407			// get closest event element and event id/ri from it
408				const event = $(elm).closest('.eventon_list_event');
409
410				dataObj = {}
411				const ekey = event.data('event_id')+'_'+ parseInt(event.data('ri'));
412				dataObj[ ekey ] = {};
413
414			const key2 = elm.data('key');
415
416			// append new data to the element
417			dataObj[ ekey ][ key2 ] = elm.data();
418
419			// check if awaitmod need checked
420				if( elm.data('check_awaitmod')){
421
422					// if waiting for mod element is on page -> set as user awaiting mod
423					if( ( event.find('.evo_vir_jitsi_waitmod').length>0) )
424						dataObj[ ekey ][ key2 ]['refresh_main'] = 'yy';
425
426					// if jitsi is loaded on page & mod is still in --> stop refreshing main
427					if( event.find('.evo-jitsi-wrapper').length>0 && dataObj[ ekey ][ key2 ]['mod_joined'] !='left') 
428						dataObj[ ekey ][ key2 ]['refresh_main'] =  '';
429				}
430
431			// append extra data
432			if( extra_data && extra_data !== undefined){
433				$.each( extra_data, function (index,val){
434					dataObj[ ekey ][ key2 ][index] = val;
435				});
436			}
437
438			return dataObj;
439		}	
440
441	// mark as virtual event ended
442		$(document)
443		.on('evo_before_trig_ajax',function(event, obj){
444			if(!obj.hasClass('evo_trig_vir_end')) return;
445			
446			var new_ajax_data = $(document).data( 'evo_data');
447			new_ajax_data['fnct'] = 'mark_event_ended';
448			$(document).data( 'evo_data', new_ajax_data );
449			
450		})
451		.on('evo_beforesend_trig_ajax',function( event, obj, new_ajax_data){
452			if(!obj.hasClass('evo_trig_vir_end')) return;
453
454			obj.closest('.evo_vir_mod_box').addClass('evoloading');
455		})
456		.on('evo_success_trig_ajax',function( event, obj, new_ajax_data, return_data){
457			if(!obj.hasClass('evo_trig_vir_end')) return;
458
459			// if virtual events were marked as ended
460			if(!('_vir_ended' in return_data)) return;
461
462			// refresh the virtual main content
463			extra_data = {};
464			extra_data['refresh_main'] = 'yy';
465			extra_data['loader'] = true;
466			extra_data['loader_class'] = 'evo_vir_main_content';
467
468			//console.log(extra_data);
469
470			$('body').trigger('evo_refresh_designated_elm',[ obj , 'evo_vir_data',extra_data]);
471		})
472		.on('evo_complete_trig_ajax',function( event, obj, new_ajax_data){
473
474			if(!obj.hasClass('evo_trig_vir_end')) return;
475			obj.closest('.evo_vir_mod_box').removeClass('evoloading');
476		})
477		;
478
479// Heartbeat - added 3.1
480	//hook into heartbeat-send
481	jQuery(document).on('heartbeat-send', function(e, data) {
482
483		// if there is run heartbeat items
484		if( $('body').find('.evo_refresh_on_heartbeat').length>0 ){
485			
486			$('body').find('.evo_refresh_on_heartbeat').each(function(){
487				if( $(this).closest('.eventon_list_event').length <= 0) return;
488				if( $(this).data('refresh')!== undefined && !$(this).data('refresh') ) return;
489
490				data['evo_data'] = build_elm_refresh_data( $(this) );
491			});			
492		}
493	});
494	
495	//hook into heartbeat-tick
496	jQuery(document).on('heartbeat-tick', function(e, data) {	
497		evo_apply_refresh_content( data );
498	});
499
500// Schedule View - 4.0
501	$('body')
502	.on('evo_init_ajax_success_each_cal',function(event, data, i, v, CAL){
503		$('body').find('.ajde_evcal_calendar.evoSV').each(function(){
504			evosv_populate( $(this) );
505		});
506	})
507	.on('evo_main_ajax_complete', function(event, CAL,  ajaxtype, data , data_arg){
508		SC = data_arg.shortcode;
509		if( SC.calendar_type == 'schedule'){
510			evosv_populate( CAL );
511		}
512	})
513	// view switching
514	.on('evo_vSW_clicked_before_ajax',function(event, O, CAL, DD, reload_cal_data){
515		if(!(O.hasClass('evosv'))) return;
516		var SC = CAL.evo_shortcode_data();
517
518		CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'});
519		CAL.evo_update_cal_sc({F:'fixed_day', V: SC.fixed_day });
520
521	})
522	.on('evo_vSW_clicked',function(event, OBJ, CAL, DD, reload_cal_data){
523		if(!(OBJ.hasClass('evosv'))) return;
524
525		//if( reload_cal_data) return;
526				
527		var _reload_cal_data = false;
528		var SC = CAL.evo_shortcode_data();
529
530		DD.setUTCDate( 1 );
531
532		if( SC.focus_start_date_range != Math.floor(DD.getTime()/1000) )
533			_reload_cal_data = true;
534
535		CAL.evo_update_cal_sc({F:'focus_start_date_range',V: Math.floor(DD.getTime()/1000) });
536
537		DD.setUTCMonth( DD.getUTCMonth() + 1);
538		DD.setUTCDate( -1);
539
540		CAL.evo_update_cal_sc({F:'focus_end_date_range', 
541			V: Math.floor(DD.getTime()/1000) });
542
543
544		DD.setUTCDate( SC.fixed_day ); // adjust date to fixed date
545
546		CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'});
547		CAL.evo_update_cal_sc({F:'fixed_day', V: SC.fixed_day });
548		
549		if( _reload_cal_data ){
550			$('body').trigger('evo_run_cal_ajax',[CAL.attr('id'),'none','filering']);
551		}else{
552			evosv_populate( CAL );
553		}
554
555		
556	})
557	// open events from schedule view
558		.on('click','.evosv_items',function(event, elm){
559			O = $(this);
560			CAL = O.closest('.ajde_evcal_calendar');
561			var e_cl = 'event_'+O.data('id');
562
563			const clicked_event_uxval = O.data('uxval');
564
565			// if event is set to slide down .. switch to lightbox
566			if( clicked_event_uxval == '1' ){
567				CAL.find('.'+e_cl).find('.desc_trig').data('ux_val', 3);
568			}
569
570			CAL.find('.'+e_cl).find('.desc_trig').trigger('click');
571		});
572
573	function evosv_populate(CAL){
574		var SC = CAL.evo_shortcode_data();
575		var cal_events = CAL.find('.eventon_list_event');
576		days_in_month = CAL.evo_day_in_month({M: SC.fixed_month, Y: SC.fixed_year});
577		time_format = CAL.evo_get_global({S1:'cal_def',S2:'wp_time_format'});
578		_txt = CAL.evo_get_txt({V:'no_events'});
579		_txt2 = CAL.evo_get_txt({V:'until'});
580		_txt3 = CAL.evo_get_txt({V:'from'});
581		_txt4 = CAL.evo_get_txt({V:'all_day'});
582
583		var html = "<div class='evosv_grid evoADDS'>";
584		CAL.find('#evcal_list').addClass('evo_hide');
585
586		var has_events = false;
587
588
589		processed_ids = {};
590
591		// go through each day in month
592		for(var x=1; x<= days_in_month; x++){
593			var SU = parseInt(SC.focus_start_date_range) + ( (x-1) * 86400);
594			var EU = SU + 86399;
595			var DD = new Date( SU *1000);
596			var month_name = CAL.evo_get_dms_vals({ V: (DD.getUTCMonth() +1), type:'m3'});
597			var day_name = CAL.evo_get_dms_vals({ V:DD.getUTCDay(), type:'d3'});
598			var DN = '<b>'+DD.getUTCDate()+'</b> '+ month_name+' '+day_name;
599
600
601			// run through each event and get events in this date
602			var events = {};
603
604			cal_events.each(function(index, elm){
605				ED = $(elm).evo_cal_get_basic_eventdata();
606				if( !ED) return;
607
608				//console.log(ED);
609
610				//if ( ED.uID in processed_ids) return;
611
612				processed_ids[ED.uID] = ED.uID;
613
614				var inrange = CAL.evo_is_in_range({
615					'S': SU,	'E': EU,	'start': ED.event_start_unix,
616					'end':ED.event_end_unix
617				});
618				if(!inrange) return;
619
620				has_events = true;
621
622				start = ED.event_start_unix;
623				end = ED.event_end_unix;
624				m = moment.unix( start ).utc();
625				me = moment.unix( end ).utc();
626
627				var all_day = $(elm).find('a.desc_trig').hasClass('allday') ? true: false;
628
629				// get event time
630				// all day
631				if( all_day ){
632					ED['t'] = _txt4;
633				}else{
634					if( start <= SU ){
635						if( end >= EU) ED['t'] = _txt4;
636						if( end < EU ) ED['t'] = _txt2+' ' + me.format( time_format);		
637					}else if(start > SU){
638						if( end >= EU)  ED['t'] = _txt3+' '+ m.format( time_format);
639						if( end < EU ) ED['t'] = m.format( time_format) +' - '+ me.format( time_format);
640					}	
641				}
642						
643
644				// hide end time
645				if( ED.hide_et == 'y'){
646					ED['t'] = m.format( time_format);
647				}
648
649				events[index] = ED;
650			});			
651
652			if( events && Object.keys(events).length > 0){
653				html += "<div class='date_row'>";
654				$.each(events, function(index, item){		
655
656					location_data = organizer_data = event_tags = '';
657
658					// location 
659					if( SC.show_location == 'yes' && 'location' in item){
660						location_data = "<div class='evosv_subdata evosv_location'><i class='fa fa-location-pin marr5'></i>" +item.location+"</div>";
661					}
662
663					// organizer					
664					if( SC.show_organizer == 'yes' && 'organizer' in item){
665						organizer_data = "<div class='evosv_subdata evosv_org'>" +item.organizer+"</div>";
666					}
667
668					// event tags
669					if( SC.show_tags == 'yes' && 'event_tags' in item){
670						event_tags = "<div class='evosv_subdata evosv_tags'>";
671						$.each( item.event_tags, function(index, val){
672							event_tags += "<span class='evosv_tag " + index +"'>" + val+"</span>";
673						});
674						event_tags += "</div>";
675					}
676
677					html += "<div class='row'>"+
678						"<div class='evosv_date'>"+DN+"</div>"+
679						"<div class='evosv_items' data-id='"+item.uID+"' data-uxval='"+ item.ux_val+"'>"+
680							"<div class='evosv_clr llxvl' style='background-color:"+item.hex_color+"'></div>"+
681							"<div class='evosv_time llxvl'>"+item.t+"</div>"+
682							"<div class='evosv_event llxvl'>"+ event_tags + item.event_title + location_data+ organizer_data+ "</div>"+
683							
684						"</div>"+
685					"</div>";
686				});
687				html+= "</div>";
688			}
689		}
690
691		// if no events
692		if( !has_events){
693			no_event_content = CAL.evo_get_global({S1: 'html', S2:'no_events'});
694			
695			html += "<div class='date_row'><div class='row no_events evosv'>"+no_event_content+"</div></div>";
696		}
697
698		html += '</div>';
699
700		if( CAL.find('.evosv_grid').length > 0){
701			CAL.find('.evosv_grid').replaceWith( html);
702		}else{
703			ELM = CAL.find('#eventon_loadbar_section');
704			ELM.after( html );
705		}
706		
707	}
708
709// Initial load data via ajax
710	function init_load_cal_data(){
711
712		// check if calendars are present in the page
713			var run_initload = false;
714
715			if( $('body').find('.ajde_evcal_calendar').length > 0 ) run_initload = true;
716			if( $('body').find('.ajax_loading_cal').length > 0 ) run_initload = true;
717			if( $('body').find('.eventon_single_event').length > 0 ) run_initload = true;
718
719			if(run_initload == false) return false;
720
721			var data_arg = {};	
722
723			BODY = $('body');
724			BODY.trigger('evo_global_page_run');
725
726			data_arg['global'] = $('#evo_global_data').data('d');
727			data_arg['cals'] ={};			
728
729		// pass ajax loading calendar shortcodes
730			$('body').find('.ajax_loading_cal').each(function(){
731				CAL = $(this);
732				SC = CAL.find('.evo_cal_data').data('sc');
733
734				data_arg['cals'][ CAL.attr('id')] = {};
735				data_arg['cals'][ CAL.attr('id')]['sc'] = SC;
736			});
737		
738		$.ajax({
739			beforeSend: function(){},
740			type: 'POST',
741			url: get_ajax_url('eventon_init_load'), 
742			data: data_arg,dataType:'json',
743			success:function(data){
744				$('#evo_global_data').data('d', data);
745
746				BUS = data;
747
748				// append html to calendars if present
749				if('cals' in data){
750					var time = 300;
751					$.each(data.cals, function(i,v){
752
753						setTimeout( function(){
754
755							CAL = BODY.find('#'+ i);
756
757							if(CAL.length === 0) return;
758
759							
760							if('html' in v){						
761								CAL.find('#evcal_list').html( v.html );
762								CAL.removeClass('ajax_loading_cal');
763								CAL.find('.evo_ajax_load_events').remove();
764
765								//CAL.evo_local_time();
766							}							
767
768							CAL.evo_calendar({
769								SC:v.sc,
770								json: v.json
771							});
772
773							$('body').trigger('evo_init_ajax_success_each_cal', [data, i, v, CAL]);
774
775						}, time);
776						time += 300;
777					});
778				}
779
780				$('body').trigger('evo_init_ajax_success', [data]);
781
782			},complete:function(data){					
783				// process all calendars in the page
784				$('body').find('.ajde_evcal_calendar').each(function(){
785					if($(this).hasClass('.ajax_loading_cal')) return;					
786					$(this).evo_calendar();
787				});
788
789				$('body').trigger('evo_init_ajax_completed', [data]);
790			}
791		});
792
793	}
794
795// ELEMENTS
796// tooltips
797	$('body').on('mouseover','.ajdeToolTip',function(event){
798		event.stopPropagation();
799		if($(this).hasClass('show')) return;
800
801		const t = $(this).data('d');
802		var p = $(this).position();
803		
804		var cor = getCoords(event.target);
805
806		$('.evo_tooltip_box').removeClass('show').removeClass('L').html(t);
807		var box_height = $('.evo_tooltip_box').height();
808		var box_width = $('.evo_tooltip_box').width();
809
810		$('.evo_tooltip_box').css({'top': (cor.top - 55 - box_height), 'left': ( cor.left + 5 ) })
811			.addClass('show');
812
813		// left align
814		if( $(this).hasClass('L')){
815			$('.evo_tooltip_box').css({'left': (cor.left - box_width - 15) }).addClass('L');			
816		}
817	})
818	.on('mouseout','.ajdeToolTip',function(){	
819		$('.evo_tooltip_box').removeClass('show');
820	});
821
822	function getCoords(elem) { // crossbrowser version
823	    var box = elem.getBoundingClientRect();
824	    //console.log(box);
825
826	    var body = document.body;
827	    var docEl = document.documentElement;
828
829	    var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
830	    var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
831
832	    var clientTop = docEl.clientTop || body.clientTop || 0;
833	    var clientLeft = docEl.clientLeft || body.clientLeft || 0;
834
835	    var top  = box.top +  scrollTop - clientTop;
836	    var left = box.left + scrollLeft - clientLeft;
837
838	    return { top: Math.round(top), left: Math.round(left) };
839	}
840	
841// Other
842	// LIGHTBOX		
843		// since 4.2 moving to functions
844		// open lightbox @2.9
845		$('body').on('evo_open_lightbox',function(event, lb_class, content){
846			const LIGHTBOX = $('.evo_lightbox.'+lb_class).eq(0);
847
848			// if already open
849			if(LIGHTBOX.is("visible")===true) return false;
850
851			if( content != ''){
852				LIGHTBOX.find('.evo_lightbox_body').html( content );
853			}
854			$('body').trigger('evolightbox_show', [ lb_class ]);
855		});
856		// close popup
857			BODY.on('click','.evolbclose', function(){	
858				if( $(this).hasClass('evolb_close_btn')) return;
859				LIGHTBOX = 	$(this).closest('.evo_lightbox');
860				closing_lightbox( LIGHTBOX );				
861			});
862
863		// close with click outside popup box when pop is shown	
864			$(document).on('click', function(event) {
865				//event.stopPropagation(); 
866				//console.log($(event.target));
867			    if( 
868			    	$(event.target).hasClass('evo_content_inin')
869			    ){
870			    	closing_lightbox( $(event.target).closest('.evo_lightbox') );
871			       	//console.log('5');
872			    }
873			});		
874			function closing_lightbox( lightboxELM){
875				
876				if(! lightboxELM.hasClass('show')) return false;
877				Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false;
878				lightboxELM.removeClass('show');
879
880				$('body').trigger('lightbox_before_event_closing', [lightboxELM]);
881
882				setTimeout( function(){ 
883					lightboxELM.find('.evo_lightbox_body').html('');
884					
885					if(Close){
886						$('body').removeClass('evo_overflow');
887						$('html').removeClass('evo_overflow');
888					}
889					
890					// trigger action to hook in at this stage
891						$('body').trigger('lightbox_event_closing', [lightboxELM]);
892				}, 100);
893			}
894
895		// when lightbox open triggered
896		$('body').on('evolightbox_show',function(event, lb_class){
897			$('.evo_lightboxes').show();
898			$('body').addClass('evo_overflow');
899			$('html').addClass('evo_overflow');
900
901			$('body').trigger('evolightbox_opened',[ lb_class ]);
902		});
903		
904	// OPENING event card -- USER INTREACTION and loading google maps
905		//event full description\		
906		$('body').on('click','.eventon_events_list .desc_trig', function(event){
907
908			var obj = $(this);					
909			
910			var attr = obj.closest('.evo_lightbox').attr('data-cal_id');
911			if(typeof attr !== typeof undefined && attr !== false){
912				var cal_id = attr;
913				var CAL = cal = $('#'+cal_id);
914			}else{
915				var CAL = cal = obj.closest('.ajde_evcal_calendar');
916			}
917
918			SC = CAL.evo_shortcode_data();
919
920			var evodata = cal.find('.evo-data');
921
922			click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false;
923			const event_id = obj.closest('.eventon_list_event').data('event_id');
924			var event_list = obj.closest('.eventon_events_list');
925						
926			// event specific values
927			var ux_val = obj.data('ux_val');
928			var exlk = obj.data('exlk');			
929			
930			// override overall calendar user intereaction OVER individual event UX
931			if(SC.ux_val!='' && SC.ux_val!== undefined && SC.ux_val!='0'){
932				ux_val = SC.ux_val;
933			}
934
935			// special mobile only user interaction 
936				if( SC.ux_val_mob !== undefined && SC.ux_val_mob != '' && 
937					SC.ux_val_mob != '-' && SC.ux_val_mob != ux_val){
938					if( is_mobile() ) ux_val = SC.ux_val_mob;
939				}
940
941
942
943			// open as lightbox
944			if(ux_val=='3' || ux_val == '3a'){
945				event.preventDefault();
946
947				repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri'));
948				repeat_interval = (repeat_interval)? repeat_interval: '0';
949				
950				var alt_SC_data = {};
951
952
953				alt_SC_data['repeat_interval'] = repeat_interval;
954				alt_SC_data['ux_val'] = ux_val;
955				alt_SC_data['evortl'] = event_list.hasClass('evortl')? 'yes':'no';
956				alt_SC_data['event_id'] = parseInt(event_id);
957				alt_SC_data['ajax_eventtop_show_content'] = true;
958
959				var new_SC_data = $.extend( {}, SC , alt_SC_data );
960
961				// since 4.2
962				eventon_open_event_lightbox( new_SC_data, obj, CAL);
963				
964				return false;
965
966			// open in single events page 
967			}else if(ux_val=='4'){		
968				
969				var url = obj.attr('href');
970				
971				if( url =='' ||  url === undefined){
972
973					url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
974					window.open(url, '_self');		
975				}
976
977				if(obj.attr('target') != '_blank')	window.open(url, '_self');
978
979				return;
980
981			// open in single events page  in new window
982			}else if(ux_val=='4a'){
983				
984				if( obj.attr('href')!='' &&  obj.attr('href')!== undefined){
985					return;
986				}else{
987					var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
988					window.open(url);
989					return false;
990				}
991
992			// open as external link
993			}else if(ux_val=='2'){
994				//var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
995				var url = obj.attr('href');
996
997				// if the click is coming from single event box
998				if( click_sinev_box ){
999					event.preventDefault();
1000					return false;
1001				}
1002
1003				//console.log(url);
1004				if(url !== undefined && url != ''){
1005					if(obj.attr('target') == '_blank'){  
1006						var win = window.open(url, '_blank');
1007						win.focus();
1008					}else{
1009						window.open(url, '_self');
1010					}	
1011
1012					event.preventDefault();				
1013				}
1014				return true;
1015
1016			// do not do anything
1017			}else if(ux_val=='X'){
1018				return false;
1019			}else if(ux_val=='none'){
1020				return false;
1021			}else{
1022				
1023				// redirecting to external link
1024				if(exlk=='1' && ux_val!='1'){
1025					// if there is no href
1026					if( obj.attr('href')!='' &&  obj.attr('href')!== undefined){
1027						return;
1028					}else{
1029						var url = obj.siblings('.evo_event_schema').find('a').attr('href');
1030						if(obj.attr('target') == '_blank'){  window.open(url);}else{ window.open(url, '_self');}
1031
1032						event.preventDefault();								
1033						return false;
1034					}
1035				// SLIDE DOWN eventcard
1036				}else{
1037
1038					var event_box = obj.closest('.eventon_list_event');			
1039					var click_item = event_box.find('.event_description');
1040
1041					if(click_item.hasClass('open')){
1042						event_box.removeClass('open');
1043						click_item.slideUp().removeClass('open');
1044					}else{
1045						// accordion
1046						if( SC.accord == 'yes'){
1047							cal.find('.eventon_list_event').removeClass('open');
1048							cal.find('.event_description').slideUp().removeClass('open');
1049						}
1050						event_box.addClass('open');
1051						click_item.slideDown().addClass('open');						
1052					}
1053					
1054					// This will make sure markers and gmaps run once and not multiples			
1055					if( obj.attr('data-gmstat')!= '1'){	
1056
1057						obj.attr({'data-gmstat':'1'});						
1058						obj.evoGenmaps({
1059							'fnt':2 ,
1060							'cal':cal,
1061						});
1062					}	
1063
1064					// trigger 
1065					if( obj.data('runjs')){
1066						$('body').trigger('evo_load_single_event_content',[ event_id, obj]);
1067					}	
1068
1069					$('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]);			
1070
1071					return false;
1072				}
1073			}
1074		});	
1075		
1076
1077		// process various lightbox types
1078		$('body')
1079		.on('evo_lightbox_processed', function(event, OO, LIGHTBOX){
1080			if( OO.uid != 'evo_open_eventcard_lightbox') return false;
1081
1082			var CAL = OO.other_data.CAL;
1083
1084			LIGHTBOX.addClass('eventcard eventon_events_list');
1085			LIGHTBOX_content = LIGHTBOX.find('.evolb_content');
1086			LIGHTBOX_content.attr('class', 'evolb_content '+ OO.other_data.extra_classes );
1087			LIGHTBOX_content.find('.evopop_top')
1088					.evoGenmaps({	'fnt':2 ,'cal':OO.other_data.CAL });
1089
1090			var SC = OO.other_data.SC;
1091			var obj = OO.other_data.obj;
1092
1093			fullheight_img_reset(); 
1094
1095			// update border color and eventtop color
1096				const evoet_data = LIGHTBOX_content.find('.evoet_data').data();
1097				bgcolor = evoet_data.bgc;
1098				bggrad = evoet_data.bggrad;
1099
1100				// if tiles and eventtop style set to clean
1101				var show_lightbox_color = SC.tiles == 'yes' && ( SC.eventtop_style == '0' || SC.eventtop_style == '4') ? false: true;
1102				
1103				if( (CAL && CAL.hasClass('color') && show_lightbox_color) ||
1104					(!CAL && show_lightbox_color)
1105
1106				){
1107					LIGHTBOX_content.addClass('color');
1108					LIGHTBOX_content.find('.evopop_top').css({
1109						'background-color':bgcolor,
1110						'background-image': bggrad,
1111					});
1112				}else{
1113					LIGHTBOX_content.find('.evopop_top').css({'border-left':'3px solid '+bgcolor});
1114				}
1115
1116			// trigger 
1117			if( obj.data('runjs')){
1118				$('body').trigger('evo_load_single_event_content',[ SC.event_id, OO.other_data.obj]);
1119			}
1120			
1121			// countdown
1122			LIGHTBOX_content.find('.evo_countdowner').each(function(){
1123				obj.removeClass('evo_cd_on');
1124				obj.evo_countdown();
1125			});
1126
1127
1128			
1129			// RTL
1130			if( SC.evortl =='yes')	LIGHTBOX.addClass('evortl');
1131
1132			$('body').trigger('evolightbox_end');	
1133
1134		})
1135
1136		// after eventcard content is loaded to lightbox via 3a - @since 4.2.3
1137			.on('evo_ajax_success_evo_open_eventcard_lightbox', function (event, OO, data){
1138				
1139				if( OO.ajaxdata.uid != "load_single_eventcard_content_3a") return false;
1140				
1141				LIGHTBOX = $('.evo_lightbox.'+ OO.lightbox_key);
1142				LIGHTBOX_content = LIGHTBOX.find('.evolb_content');
1143
1144				CAL = $('body').find('#'+ OO.ajaxdata.calid);
1145
1146				// generate map
1147				LIGHTBOX_content.evoGenmaps({	'fnt':2 ,'cal': CAL });
1148
1149
1150				// countdown
1151				LIGHTBOX_content.find('.evo_countdowner').each(function(){
1152					var obj = $(this);
1153					obj.removeClass('evo_cd_on');
1154					obj.evo_countdown();
1155				});
1156
1157				$('body').trigger('evolightbox_end');		
1158			})
1159		;
1160
1161		// open event as lightbox / U 4.3.3
1162		function eventon_open_event_lightbox( SC_data, obj, CAL){	
1163
1164
1165			const cancel_class = ( obj.hasClass('cancel_event')) ? ' cancel_event':'';
1166			
1167			// generate a random ID for this 
1168				maximum = 99;
1169				minimum = 10;
1170				var randomnumber = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1171
1172			// AJAX via lightbox
1173			if(SC_data.ux_val == '3a'){
1174
1175				var new_content = '';
1176				new_content += '<div class="evo_cardlb" style="padding:10px 10px 0 10px">';
1177				new_content += '<div style="margin-bottom:20px; width:100%; height:200px" class="evo_preloading"></div>';
1178				const box = '<div style="display:flex;justify-content: space-between;margin-bottom:10px"><div style="width:40px;height:40px; margin-right:20px" class="evo_preloading"></div> <div style="flex:1 0 auto"> <div class="evo_preloading" style="width:70%; height:20px; margin-bottom:10px"></div><div class="evo_preloading" style="width:100%; height:80px; margin-bottom:10px"></div>  </div> </div>';
1179				new_content += box + box + box;
1180				new_content += '</div>';
1181
1182				
1183				var data_arg = {};
1184				data_arg['event_id'] = SC_data.event_id;
1185				data_arg['ri'] = SC_data.repeat_interval;
1186				data_arg['SC'] = SC_data;
1187				data_arg['load_lbcontent'] = true;
1188				data_arg['action'] = 'eventon_load_single_eventcard_content';
1189				data_arg['uid'] = 'load_single_eventcard_content_3a';
1190				data_arg['calid'] = CAL.attr('id');
1191
1192				
1193				//reset view to match
1194					if( data_arg.SC.tile_style == '2') data_arg.SC.eventtop_style = '0';
1195					data_arg.SC.tile_style = '0';
1196					data_arg.SC.tile_bg = '0';
1197					data_arg.SC.tiles = 'no';
1198
1199				CAL.evo_lightbox_open({
1200					uid:'evo_open_eventcard_lightbox',
1201					//uid:'load_single_eventcard_content_3a',
1202					lbc:'evo_eventcard_'+ randomnumber,
1203					end:'client',
1204					content: new_content,
1205					ajax:'yes',
1206					ajax_type: 'endpoint',
1207					ajax_action: 'eventon_load_single_eventcard_content',
1208					d: 	data_arg,
1209					other_data: {
1210						extra_classes: 'evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+SC_data.event_id +'_'+ SC_data.repeat_interval + cancel_class,
1211						CAL:CAL,
1212						obj: obj,
1213						SC: SC_data
1214					}
1215				});
1216				
1217
1218			}else{
1219
1220				var content = obj.closest('.eventon_list_event').find('.event_description').html();
1221				var _content = $(content).not('.evcal_close');
1222								
1223				CAL.evo_lightbox_open({
1224					uid:'evo_open_eventcard_lightbox',
1225					lbc:'evo_eventcard_'+ randomnumber,
1226					end:'client',
1227					content: '<div class="evopop_top">'+ obj.html() +'</div>' + content,
1228					other_data: {
1229						extra_classes: 'evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+SC_data.event_id +'_'+ SC_data.repeat_interval + cancel_class,
1230						CAL:CAL,
1231						obj: obj,
1232						SC: SC_data
1233					}
1234				});
1235
1236				return;
1237			}						
1238		}	
1239
1240	// load eventon event anywhere via lightbox ajax
1241		$('body').on('click','.eventon_anywhere.evoajax', function(event){
1242			var obj = $(this);
1243			var data = obj.data('sc');
1244
1245			if( data.ev_uxval == '4') return;
1246
1247			event.preventDefault();
1248
1249			data['evortl'] = 'no';
1250			data['event_id'] = data.id;
1251			data['ux_val'] = '3a';
1252			data['ajax_eventtop_show_content'] = false;
1253
1254
1255
1256			//console.log(data);
1257			eventon_open_event_lightbox( data, obj, false);
1258		});
1259
1260	// copy event link
1261		var evo_card_socialshare_html = '';
1262		$('body').on('click','.copy.evo_ss', function(event){
1263			const OBJ = $(this);
1264			const ROW = OBJ.closest('.evcal_evdata_row');
1265			var link = decodeURIComponent( OBJ.data('l') );
1266			navigator.clipboard.writeText( link );
1267
1268
1269
1270			evo_card_socialshare_html = ROW.html();
1271			ROW.html( "<p style='display:flex'><i class='fa fa-check marr10'></i> " + $(this).data("t") + "</p>");
1272
1273			setTimeout(function(){
1274				ROW.html( evo_card_socialshare_html);
1275			},3000);
1276		});
1277
1278	// call to run google maps on load
1279		function init_run_gmap_openevc(delay){
1280			$('.ajde_evcal_calendar').each(function(){
1281		
1282				var CAL = $(this);
1283				var SC = CAL.evo_shortcode_data();
1284
1285				if( SC === undefined || SC === null) return;
1286
1287				if( typeof SC !== 'object' ){
1288					SC = JSON.parse(SC);
1289				}
1290
1291				if( 'evc_open' in SC && SC.evc_open =='yes'){
1292
1293					$(this).find('.desc_trig').each(function(){
1294						if(delay!='' && delay !== undefined){							
1295							$(this).evoGenmaps({'fnt':2, 'cal': CAL, 'delay':delay});
1296						}else{
1297							$(this).evoGenmaps({'fnt':2,'cal': CAL });							
1298						}
1299					});
1300				}				
1301			});
1302		}
1303	
1304	// Calendar Interaction
1305		// event bubbles
1306		$('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){
1307			O = $(this);
1308			LIST = O.closest('.eventon_events_list');
1309			title = O.find('.evoet_dayblock').data('bub');
1310
1311			p = O.position();
1312
1313			LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>");
1314			B = LIST.find('.evo_bub_box');
1315
1316			l = p.left;
1317			t = p.top- B.height() -30;
1318
1319			// adjust bubble to left if event on right edge
1320			LM = LIST.width();
1321			tl = p.left + B.width() + O.width();
1322			if(   tl > LM){
1323				l = l - B.width() +O.width()-20;
1324			}
1325
1326			B.css({'top':t, 'left':l});
1327
1328			LIST.find('.evo_bub_box').addClass('show');
1329		}).on('mouseout',function(){
1330			B = $(this).find('.evo_bub_box').remove();
1331		});
1332
1333	// Click on eventtop items
1334		$('body').on('click','.evocmd_button', function(event){
1335			event.preventDefault();
1336			event.stopPropagation();
1337
1338			href = $(this).data('href');			
1339			if( $(this).data('target')=='yes'){
1340				window.open(href,'_blank');
1341			}else{
1342				window.location = href;
1343			}
1344
1345		});
1346
1347	// GO TO TODAY
1348	// @+ 2.3 @up 2.8
1349		$('body').on('click','.evo-gototoday-btn', function(){
1350			var obj = $(this);
1351			CAL = obj.closest('.ajde_evcal_calendar');			
1352			var calid = CAL.attr('id');
1353
1354			CAL.evo_update_cal_sc({F:'fixed_month', V: obj.data('mo')});
1355			CAL.evo_update_cal_sc({F:'fixed_year', V: obj.data('yr')});
1356			
1357			run_cal_ajax( calid,'none','today');
1358			obj.fadeOut();
1359		});
1360
1361		$('body').on('evo_main_ajax_before', function(event, CAL, ajaxtype){
1362			if(ajaxtype == 'switchmonth')	CAL.find('.evo-gototoday-btn').fadeIn();
1363		});
1364		$('body').on('evo_main_ajax_complete', function(event, CAL,ajaxtype, D , data_arg){
1365			// if focused month and year are same as current month and year hide the current month button
1366			var N = moment().utc();
1367			SC = CAL.evo_shortcode_data();
1368
1369			var SU = parseInt( SC.focus_start_date_range);				
1370			var M = moment.unix(SU).utc();	
1371
1372			if( N.format('YYYY M') == M.format('YYYY M')){				
1373				CAL.find('.evo-gototoday-btn').fadeOut();
1374			}
1375
1376			// load countdown timers
1377			BODY.find('.evo_countdowner').each(function(){
1378				$(this).evo_countdown();
1379			});
1380			
1381		});
1382
1383	// MONTH jumper
1384		$('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){
1385			$(this).parent().siblings().find('.evo_j_container').slideToggle();
1386		});
1387
1388		// select a new time from jumper
1389		$('.evo_j_dates').on('click','a',function(){
1390			var val = $(this).attr('data-val'),
1391				type = $(this).parent().parent().attr('data-val'),
1392				CAL = $(this).closest('.ajde_evcal_calendar');
1393				SC = CAL.evo_shortcode_data();
1394
1395			if(type=='m'){ // change month
1396				CAL.evo_update_cal_sc({F:'fixed_month', V: val });
1397			}else{
1398				CAL.evo_update_cal_sc({F:'fixed_year', V: val });
1399			}
1400
1401			run_cal_ajax( CAL.attr('id') ,'none','jumper');
1402			
1403			// hide month jumper if not set to leave expanded
1404			if(SC.expj =='no')	container.delay(2000).slideUp();
1405		});
1406
1407	// RESET general calendar
1408		// @U 2.8.9
1409		function cal_resets(calOBJ){
1410			calargs = $(calOBJ).find('.cal_arguments');
1411			calargs.attr('data-show_limit_paged', 1 );
1412
1413			calOBJ.evo_update_cal_sc({
1414				F:'show_limit_paged',V:'1'
1415			});
1416		}
1417				
1418	// change IDs for map section for eventon widgets
1419		if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){
1420			cal.find('.evcal_gmaps').each(function(){
1421				var gmap_id = obj.attr('id');
1422				var new_gmal_id =gmap_id+'_widget'; 
1423				obj.attr({'id':new_gmal_id})
1424			});
1425		}
1426	
1427	// Tab view switcher
1428		$('body').find('.evo_tab_container').each(function(){
1429			$(this).find('.evo_tab_section').each(function(){
1430				if(!$(this).hasClass('visible')){
1431					$(this).addClass('hidden');
1432				}
1433			});
1434		});
1435		$('body').on('click','.evo_tab',function(){
1436			tab = $(this).data('tab');
1437			tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container');
1438			tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible');
1439			tabsection.find('.'+tab).addClass('visible').removeClass('hidden');
1440
1441			$(this).parent().find('.evo_tab').removeClass('selected');
1442			$(this).addClass('selected');
1443
1444			$('body').trigger('evo_tabs_newtab_selected',[ $(this)]);
1445		});
1446
1447	// layout view changer - legacy
1448		if($('body').find('.evo_layout_changer').length>0){
1449			// menu button focus adjust
1450			$('body').find('.evo_layout_changer').each(function(item){
1451				if($(this).parent().hasClass('boxy')){
1452					$(this).find('.fa-th-large').addClass('on');
1453				}else{
1454					$(this).find('.fa-reorder').addClass('on');
1455				}
1456			});
1457
1458			// interaction
1459			$('.evo_layout_changer').on('click','i',function(){
1460				const CAL = $(this).closest('.ajde_evcal_calendar');
1461				TYPE = $(this).data('type');
1462				$(this).parent().find('i').removeClass('on');
1463				$(this).addClass('on');
1464
1465				//console.log(TYPE);
1466				
1467				if(TYPE=='row'){
1468					CAL.attr('class','ajde_evcal_calendar');
1469					// set tile colors
1470					CAL.find('.eventon_list_event').each(function(){
1471						$(this).find('.desc_trig').css('background-color',  '');
1472						$(this).find('.desc_trig_outter').css('background-color',  '');
1473					});
1474				}else if(TYPE =='bar'){
1475					CAL.attr('class','ajde_evcal_calendar  box_2 sev cev');
1476					
1477					// set tile colors
1478					CAL.find('.eventon_list_event').each(function(){
1479						const color = $(this).data('colr');
1480						$(this).find('.desc_trig').css('background-color',  color);
1481					});
1482				}else{
1483
1484					// set tile colors
1485					CAL.find('.eventon_list_event').each(function(){
1486						const color = $(this).data('colr');
1487						$(this).find('.desc_trig_outter').css('background-color',  color);
1488					});
1489
1490					CAL.attr('class','ajde_evcal_calendar boxy boxstyle0 box_2');
1491				}				
1492			});
1493		}
1494	
1495	// v4.0 view switcher
1496		$('body').on('click', '.evo_cal_view_switcher_cur',function(){
1497					$(this).parent().toggleClass('SH');
1498			})
1499			.on('click', '.evo_vSW',function(){
1500				O = $(this);
1501				var DATA = O.data('d');
1502				if(O.hasClass('focusX')) return;
1503								
1504				CAL = O.closest('.ajde_evcal_calendar');
1505
1506				// remove other additions from other views
1507				CAL.find('.evoADDS').fadeOut().delay(200).queue(function(){
1508					$(this).remove();
1509				});
1510
1511				var SC = CAL.evo_shortcode_data();
1512				var reload_cal_data = false;
1513				
1514				// Create date object
1515					var DD = new Date(SC.fixed_year,SC.fixed_month -1 , SC.fixed_day, 0,0,0 );
1516					DD.setUTCHours(0);
1517					DD.setUTCFullYear( SC.fixed_year );
1518					DD.setUTCMonth( SC.fixed_month -1 );
1519					DD.setUTCDate( SC.fixed_day );
1520
1521				// switch to normal
1522					O.siblings('.evo_vSW').removeClass('focusX');					
1523					O.addClass('focusX');
1524					CAL.find('.evo_cal_view_switcher_cur').html( O.html() );
1525					O.closest('.evo_cal_view_switcher').removeClass('SH');
1526
1527				// calendar class toggling
1528					O.siblings('.evo_vSW').each(function(){
1529						var _d = $(this).data('d');
1530						if( _d && 'c' in _d )	CAL.removeClass( _d['c'] ); // remove other cls
1531					});
1532					if( DATA && 'c' in DATA)	CAL.addClass( DATA.c );
1533
1534				$('body').trigger('evo_vSW_clicked_before_ajax', [ O, CAL, DD, reload_cal_data]);
1535				
1536				// switching to calendars that need 1 month of events
1537				if( !(O.hasClass('evowv')) ){
1538
1539					DD.setUTCDate( 1 );
1540
1541					if( SC.focus_start_date_range != Math.floor(DD.getTime()/1000) )
1542						reload_cal_data = true;
1543
1544					CAL.evo_update_cal_sc({F:'focus_start_date_range',V: Math.floor(DD.getTime()/1000) });
1545
1546					DD.setUTCMonth( DD.getUTCMonth() + 1);
1547					DD.setUTCDate( -1);
1548
1549					CAL.evo_update_cal_sc({F:'focus_end_date_range', 
1550						V: Math.floor(DD.getTime()/1000) });
1551
1552					CAL.evo_update_cal_sc({F:'calendar_type', V: 'default'});
1553
1554					// treating events list based on dif preferences
1555					// vals el_visibility = hide_events, show_events
1556					if( 'el_visibility' in DATA){
1557						el_visibility = DATA.el_visibility;
1558
1559						if( el_visibility =='show_events') CAL.find('.eventon_list_event').show();
1560						if( el_visibility =='hide_events') CAL.find('.eventon_list_event').hide();
1561						if( el_visibility =='hide_list') CAL.find('#evcal_list').addClass('evo_hide');
1562						if( el_visibility =='show_all'){
1563							CAL.find('#evcal_list').removeClass('evo_hide');
1564							CAL.find('.eventon_list_event').show();
1565						} 
1566					}
1567
1568					
1569					//CAL.find('.eventon_list_event').show();
1570
1571					// run ajax to load new events in the range
1572					if( reload_cal_data ){
1573						$('body').trigger('evo_run_cal_ajax',[CAL.attr('id'),'none','filering']);
1574					}
1575				}
1576
1577							
1578				$('body').trigger('evo_vSW_clicked', [ O, CAL, DD, reload_cal_data]);
1579
1580			});
1581	
1582	// SORTING & FILTERING
1583		// display sort section
1584		$('body').on('click','.evo-filter-btn', function(){
1585			CAL = $(this).closest('.ajde_evcal_calendar');
1586			line = CAL.find('.eventon_sorting_section');
1587			if(line.is(':visible')){
1588				line.hide();
1589				$(this).removeClass('show');
1590			}else{
1591				line.show();
1592				$(this).addClass('show');
1593			}
1594			// hide sort menu
1595			CAL.find('.eventon_sort_line').hide();
1596		});	
1597		
1598		// SORTing
1599			$('body').on('click','.evo-sort-btn',function(){
1600				line = $(this).find('.eventon_sort_line');
1601				if(line.is(':visible')){
1602					line.hide();
1603					$(this).removeClass('show');
1604				}else{
1605					line.show();
1606					$(this).addClass('show');
1607				}
1608			});
1609		
1610			// update calendar based on the sorting selection
1611				$('body').on('click', '.evo_sort_option',function(){
1612					O = $(this);
1613					var CAL = O.closest('.ajde_evcal_calendar');
1614					var sort_by = O.data('val');
1615					
1616					// update new values everywhere
1617					CAL.evo_update_cal_sc({F:'sort_by',V:sort_by});
1618
1619					O.parent().find('p').removeClass('select');
1620					O.addClass('select');	
1621
1622					run_cal_ajax(CAL.attr('id'),'none','sorting');						
1623				});		
1624		
1625		// filtering section open and close menu
1626			$('body').on('click','.filtering_set_val',function(){
1627				// close sorting
1628					sortSelect = $(this).closest('.eventon_sorting_section').find('.evo_srt_options');
1629					if(sortSelect.is(':visible') == true) sortSelect.fadeToggle();
1630
1631				var obj = $(this);
1632				var current_Drop = obj.siblings('.eventon_filter_dropdown');
1633				var current_drop_pare = obj.closest('.eventon_filter');
1634
1635				current_drop_pare.siblings('.eventon_filter').find('.eventon_filter_dropdown').each(function(){
1636					if($(this).is(':visible')== true ){
1637						$(this).hide();
1638						$(this).siblings('p').removeClass('show');
1639					}				
1640				});
1641
1642				if(current_Drop.is(':visible')== true){
1643					obj.siblings('.eventon_filter_dropdown').fadeOut('fast');	
1644					obj.removeClass('show');	
1645				}else{
1646					obj.siblings('.eventon_filter_dropdown').fadeIn('fast');
1647					obj.addClass('show');
1648				}			
1649			});	
1650		
1651		// selection on filter dropdown list
1652			$('body').on('click','p.evo_filter_val',function (){
1653
1654				CAL = $(this).closest('.ajde_evcal_calendar');	
1655				var new_filter_val = $(this).data('filter_val'),
1656					O = $(this),
1657					filter_section = $(this).closest('.eventon_filter_line'),
1658					filter = $(this).closest('.eventon_filter'),
1659					filter_current_set_val = filter.data('filter_val');
1660					filter_def_val = filter.data('fldef');
1661
1662				const filter_set_val = filter.find('.filtering_set_val');
1663				const filter_btn = CAL.find('.evo-filter-btn');
1664
1665				const arg_filter_type = filter_section.data('filter_type');
1666
1667				FILTER_DROPDOWN = $(this).parent();
1668				CAL = $(this).closest('.ajde_evcal_calendar');	
1669
1670
1671				// for filter values with checkboxes
1672				if(arg_filter_type == 'select'){	
1673					val = '';
1674
1675
1676					// NOT all
1677					if( new_filter_val != 'all'){
1678						O.parent().find('p.all').removeClass('select');
1679						O.toggleClass('select');	
1680
1681						var unselect_count = 0;
1682						O.parent().find('p').each(function(){
1683							if( $(this).hasClass('select')){
1684								val += $(this).data('filter_val')+',';
1685							}else{
1686								if(!$(this).hasClass('all')) unselect_count++;
1687							}
1688						});	
1689
1690						// all selected
1691						if(unselect_count == 0){
1692							O.parent().find('p.all').addClass('select');
1693							val = 'all';
1694						}	
1695
1696						// remove comma at the end
1697						val = ( val.slice(-1) == ',')? val.slice(0,-1): val;
1698
1699						// if all field is not visible; nothing selected = all
1700						if(val == '' && O.parent().find('p.all').length == 0) val='all';
1701
1702					// == all
1703					}else{ 
1704						if( O.hasClass('select')){
1705							O.parent().find('p').removeClass('select');
1706						}else{
1707							O.parent().find('p').addClass('select');
1708							val = 'all';
1709						}						
1710					}
1711					
1712					filter.data('filter_val',val); // v 2.7.4
1713				
1714				// filter_type = default
1715				}else{					
1716					if( new_filter_val == 'all'){
1717						// if all is already selected
1718						if( O.hasClass('select')){
1719							new_filter_val = 'NOT-all';
1720							O.parent().find('p').removeClass('select');
1721						}else{
1722							O.parent().find('p').addClass('select');
1723						}						
1724					}else{
1725						O.parent().find('p').removeClass('select');
1726						O.addClass('select');
1727					}
1728
1729					filter.data('filter_val',new_filter_val);
1730				}
1731
1732				var set_new_filter_val = filter.data('filter_val');
1733
1734
1735				// display filter informer	
1736					if( !( CAL.hasClass('flhi') ) ){
1737						//console.log( CAL.attr('class'));
1738						//console.log(set_new_filter_val+' '+ filter_def_val);
1739						if( set_new_filter_val == filter_def_val){
1740							filter_set_val.removeClass('set');						
1741						}else{
1742							filter_set_val.addClass('set');
1743						}
1744
1745						var count_filters = filter_section.find('.filtering_set_val.set').length;
1746
1747						if( count_filters > 0){
1748							filter_btn.find('em').html( count_filters ).addClass('o');
1749							CAL.find('.evo_filter_clear').addClass('show');
1750						}else{
1751							filter_btn.find('em').removeClass('o');		
1752							CAL.find('.evo_filter_clear').removeClass('show');					
1753						}
1754					}
1755
1756					
1757
1758				// if select filter type 
1759				if(arg_filter_type == 'select') return;
1760
1761				
1762				// For non checkbox select options
1763					if(filter_current_set_val == new_filter_val){
1764						$(this).parent().fadeOut();
1765					}else{					
1766						cal_resets( CAL );
1767								
1768						// make changes					
1769						filter.data('filter_val', new_filter_val);
1770
1771						CAL.evo_update_sc_from_filters();					
1772
1773						run_cal_ajax( CAL.attr('id') ,'none','filering');
1774											
1775						// reset the new values				
1776						var new_filter_name = $(this).html();
1777						
1778						O.parent().fadeOut();
1779						filter_set_val.removeClass('show');
1780					}
1781			});
1782			
1783			// apply filters via button to the calendar
1784				$('.eventon_filter_dropdown').on('change','input',function(event){
1785					FILTER = $(this).closest('.eventon_filter');
1786
1787					val = '';
1788					FILTER.find('input').each(function(){
1789						val = ($(this).is(':checked'))? val + $(this).data('filter_val') +',': val;
1790					});
1791					val = (val=='')? '':val; // v2.5.2
1792					FILTER.data('filter_val',val); // v 2.7.4
1793				});
1794			// apply filters
1795				$('body').on('click','.evo_filter_submit',function(){
1796					// fadeout any open filter dropdowns
1797						$(this).closest('.eventon_filter_line').find('.eventon_filter_dropdown').fadeOut();
1798						$(this).closest('.eventon_filter_line').find('.filtering_set_val').removeClass('show');
1799
1800					CAL = $(this).closest('.ajde_evcal_calendar');	
1801					cal_resets( CAL);
1802
1803					CAL.evo_update_sc_from_filters();	// update shortcode from filters
1804					
1805					run_cal_ajax(CAL.attr('id'),'none','filering');
1806				});
1807
1808			// CLEAR filters - @4.2 u @4.4
1809			// reset back to default on page load values
1810				$('body').on('click','.evo_filter_clear',function(){
1811					CAL = $(this).closest('.ajde_evcal_calendar');
1812
1813					CAL.find('.eventon_filter').each(function(){
1814						const filter = $(this);
1815						const NOT_values = filter.data('notvals');
1816						const IN_values = filter.data('invals');
1817
1818						$(this).find('.filtering_set_val').removeClass('set');
1819						CAL.find('.evo-filter-btn em').removeClass('o');
1820
1821						
1822						if( IN_values == ''){
1823							
1824						}else if(IN_values == 'all'){
1825							filter.find('.evo_filter_val').addClass('select');
1826						}else if( IN_values != ''){
1827							filter.find('.evo_filter_val').removeClass('select');
1828							$.each( IN_values, function( index, value){
1829								filter.find('.evo_filter_val[data-filter_val="'+ value +'"]')
1830											.addClass('select');
1831							});
1832						}
1833
1834						// set the default filter value
1835						var default_value = '';
1836						$.each(NOT_values, function(index, value){
1837							default_value += 'NOT-'+ value + ',';
1838						});
1839						$.each(IN_values, function(index, value){
1840							default_value +=  value + ',';
1841						});
1842
1843						// remove last comma from the string @since 4.4
1844							default_value = default_value.replace(/,\s*$/, "");
1845
1846						filter.data('filter_val', default_value);
1847
1848					});
1849
1850					$(this).removeClass('show');
1851
1852					// update shortcode and run new ajax for events
1853					CAL.evo_update_sc_from_filters();					
1854					run_cal_ajax(CAL.attr('id'),'none','filering');
1855				});
1856		
1857	// CAL BODY Listeners
1858		$('body')
1859			// Show more events on list
1860				.on('click','.evoShow_more_events',  function(){
1861					CAL = $(this).closest('.ajde_evcal_calendar');
1862					SC = CAL.evo_shortcode_data();
1863
1864					OBJ = $(this);
1865
1866					// redirect to an external link 
1867						if(SC.show_limit_redir !== ''){
1868							window.location = SC.show_limit_redir;	return false;
1869						}
1870
1871					// ajax pagination
1872					if( SC.show_limit_ajax =='yes'){
1873						CURRENT_PAGED = parseInt(SC.show_limit_paged);				
1874						CAL.evo_update_cal_sc({F:'show_limit_paged', V: CURRENT_PAGED+1});
1875						run_cal_ajax( CAL.attr('id'), 'none','paged');
1876
1877					}else{
1878						var event_count = parseInt( SC.event_count );
1879						
1880						var eventList = OBJ.parent();
1881						var allEvents = eventList.find('.eventon_list_event').length;
1882
1883						var currentShowing = eventList.find('.eventon_list_event:visible').length;
1884
1885						for(x=1; x<=event_count ; x++ ){
1886							var inde = currentShowing+x-1;
1887							eventList.find('.eventon_list_event:eq('+ inde+')').slideDown();
1888						}
1889
1890						// hide view more button
1891						if(allEvents > currentShowing && allEvents<=  (currentShowing+event_count)){
1892							$(this).fadeOut();
1893						}
1894					}		
1895
1896				})
1897			// MONTH switch
1898				.on('click','.evcal_btn_prev', function(){
1899					var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');
1900					var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'next': 'prev';
1901					run_cal_ajax(cal_id, direction ,'switchmonth');
1902				})
1903				.on('click','.evcal_btn_next',function(){					
1904					var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');			
1905					var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'prev': 'next';
1906					run_cal_ajax(cal_id, direction ,'switchmonth');
1907				})
1908
1909			// JUMPER switch
1910				.on('calendar_month_changed',function(event, CAL){
1911					SC = CAL.evo_shortcode_data();
1912
1913					var O = CAL.find('.evo_j_container');
1914					O.find('.evo_j_months a').removeClass('set');
1915					O.find('.evo_j_months a[data-val="'+ SC.fixed_month +'"]').addClass('set');
1916
1917					O.find('.evo_j_years a').removeClass('set');
1918					O.find('.evo_j_years a[data-val="'+ SC.fixed_year +'"]').addClass('set');
1919
1920					// show go to today 
1921					B = CAL.find('.evo-gototoday-btn');
1922					if( SC.fixed_month != B.data('mo') || SC.fixed_year != B.data('yr')){
1923						B.show();
1924					}
1925				})
1926			
1927			// show more/less event details
1928				.on('click','.evobtn_details_show_more',function(){		
1929					control_more_less( $(this));	
1930				})
1931			// refresh now calendar
1932				.on('runajax_refresh_now_cal',function(e, OBJ, nonce){
1933
1934					const section = OBJ.closest('.evo_eventon_live_now_section');
1935					const CAL = section.find('.ajde_evcal_calendar').eq(0);
1936
1937					var dataA = {
1938						nonce: nonce,
1939						other: OBJ.data(),
1940						SC: CAL.evo_shortcode_data()
1941					};
1942
1943					
1944
1945					$.ajax({
1946						beforeSend: function(){
1947							section.addClass('evoloading');
1948						},
1949						type: 'POST',url: get_ajax_url('eventon_refresh_now_cal'), data: dataA,dataType:'json',
1950						success:function(data){
1951							if( data.status == 'good'){
1952								section.html( data.html);
1953
1954								$('body').trigger('evo_refresh_designated_elm',[ OBJ, 'evo_vir_data']);
1955							}
1956
1957						},complete:function(data){
1958							section.removeClass('evoloading');
1959
1960							BODY.find('.evo_countdowner').each(function(){
1961								$(this).evo_countdown();
1962							});
1963						}
1964					});
1965				})
1966
1967			// refresh event top
1968				.on('runajax_refresh_eventtop',function(e, OBJ, nonce){
1969
1970				})
1971
1972			// click on no events - @v 4.2
1973				.on('click','.evo_no_events_btn', function (e){
1974					BODY.trigger('click_on_no_event_btn', [$(this) ] );
1975				})
1976				;
1977		
1978
1979	// PRIMARY hook to get content	
1980		// MAIN AJAC for calendar events v2.8
1981		function run_cal_ajax( cal_id, direction, ajaxtype){
1982			
1983			// identify the calendar and its elements.
1984			var CAL = ev_cal = $('#'+cal_id); 
1985
1986			// check if ajax post content should run for this calendar or not			
1987			if(CAL.attr('data-runajax')!='0'){
1988
1989				// category filtering for the calendar
1990				var cat = CAL.find('.evcal_sort').attr('cat');
1991
1992				// reset paged values for switching months
1993				if(ajaxtype=='switchmonth'){
1994					CAL.find('.cal_arguments').attr('data-show_limit_paged',1);
1995					CAL.evo_update_cal_sc({F:'show_limit_paged', V: '1'});
1996				}	
1997
1998				SC = CAL.evo_shortcode_data();
1999
2000				$('body').trigger('evo_main_ajax_before', [CAL, ajaxtype, direction, SC]);		
2001
2002				var data_arg = {
2003					//action: 		'eventon_get_events',
2004					direction: 		direction,
2005					shortcode: 		SC,
2006					ajaxtype: 		ajaxtype,
2007				};	
2008
2009				EVENTS_LIST = ev_cal.find('.eventon_events_list');
2010
2011				$.ajax({
2012					beforeSend: function(){
2013						ev_cal.addClass('evo_loading');
2014						if(ajaxtype != 'paged')	EVENTS_LIST.slideUp('fast');
2015
2016						if(ajaxtype == 'paged'){
2017							txt = EVENTS_LIST.find('.evoShow_more_events').html();
2018							EVENTS_LIST.find('.evoShow_more_events').html('. . .').data('txt',txt);
2019						}
2020						ev_cal.evo_loader_animation();					
2021					},
2022					type: 'POST', url: get_ajax_url('eventon_get_events'),data: data_arg,dataType:'json',
2023					success:function(data){
2024						if(!data) return false;
2025						if(ajaxtype == 'paged'){	
2026							EVENTS_LIST.find('.evoShow_more_events').remove();
2027							EVENTS_LIST.find('.clear').remove();
2028
2029
2030							EVENTS_LIST.append( data.html + "<div class='clear'></div>");
2031
2032							// hide show more events if all events loaded
2033							var events_in_list = EVENTS_LIST.find('.eventon_list_event').length;
2034							if( 'total_events' in data && data.total_events == events_in_list){
2035								EVENTS_LIST.find('.evoShow_more_events').hide();
2036							}	
2037
2038							// for month lists duplicate headers // @+2.8.1
2039							var T = {};
2040							EVENTS_LIST.find('.evcal_month_line').each(function(){
2041								d = $(this).data('d');
2042								if( T[d]) 
2043									$(this).remove();
2044								else
2045									T[d] = true;
2046							});
2047
2048							var T = {};
2049							EVENTS_LIST.find('.sep_month_events').each(function(){
2050								d = $(this).data('d');
2051								if( T[d]){
2052									var H = $(this).html();
2053									EVENTS_LIST.find('.sep_month_events[data-d="'+d+'"]').append( H );
2054									$(this).remove();
2055								}else{T[d] = true;}
2056							});
2057							
2058						}else{
2059							EVENTS_LIST.html(data.html);
2060						}
2061						
2062						// update calednar month title
2063						animate_month_switch(data.cal_month_title, ev_cal.find('.evo_month_title'));
2064							
2065						// update calendar shortcode values after ajax
2066						ev_cal.evo_update_all_cal_sc({SC: data.SC});
2067
2068						// update events list to calendar footer data
2069						ev_cal.find('.evo_cal_events').data('events', data.json);
2070
2071						$('body').trigger('calendar_month_changed',[CAL]);
2072						
2073						$('body').trigger('evo_main_ajax_success', [CAL, ajaxtype, data, data_arg]);
2074															
2075					},complete:function(data){
2076						ev_cal.evo_loader_animation({direction:'end'});
2077
2078						// show events list events if not set to hide on load
2079						if(! EVENTS_LIST.hasClass('evo_hide')) EVENTS_LIST.delay(300).slideDown('slow');
2080						
2081						ev_cal.evoGenmaps({'delay':400});
2082						init_run_gmap_openevc(600);
2083						fullheight_img_reset(cal_id);
2084
2085						// pluggable
2086						$('body').trigger('evo_main_ajax_complete', [CAL, ajaxtype, data.responseJSON , data_arg]);
2087						ev_cal.removeClass('evo_loading');
2088					}
2089				});
2090			}			
2091		}
2092
2093		$('body').on('evo_run_cal_ajax',function(event,cal_id, direction, ajaxtype){
2094			run_cal_ajax( cal_id, direction, ajaxtype);
2095		});
2096
2097		// deprecated bridge function for sortby value 
2098		function ajax_post_content(sortby, cal_id, direction, ajaxtype){
2099			run_cal_ajax( cal_id, direction, ajaxtype);
2100		}
2101
2102	// subtle animation when switching months
2103		function animate_month_switch(new_data, title_element){			
2104			var current_text = title_element.html();
2105			var CAL = title_element.closest('.ajde_evcal_calendar');
2106
2107			
2108			title_element.html(new_data);
2109			return;
2110
2111			/*  - @v 4.2
2112			var hei = title_element.height();
2113			var wid= title_element.width();
2114			
2115			
2116			title_element.html("<span style='position:absolute; width:"+wid+"; height:"+hei+" ;'>"+current_text+"</span><span style='position:absolute; display:none;'>"+new_data+"</span>").width(wid);
2117
2118			var LC_w = title_element.find('span:last-child').width()+5;
2119
2120			console.log(title_element);
2121						
2122			title_element.animate({width: LC_w},2000);
2123			title_element.find('span:first-child').fadeOut(800); 
2124			title_element.find('span:last-child').fadeIn(800, function(){
2125				title_element.html(new_data);
2126			});
2127			*/
2128			
2129		}
2130	
2131	// actual animation/function for more/less button
2132		function control_more_less(obj){
2133			var content = obj.attr('content');
2134			var current_text = obj.find('.ev_more_text').html();
2135			var changeTo_text = obj.find('.ev_more_text').attr('data-txt');
2136			const cell = obj.closest('.evcal_evdata_cell');
2137
2138				
2139			// show more
2140			if(content =='less'){			
2141				
2142				obj.closest('.evcal_evdata_cell').removeClass('shorter_desc');
2143						
2144
2145				obj.attr({'content':'more'});
2146				obj.find('.ev_more_arrow').removeClass('ard');
2147				obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text);
2148				
2149			}else{
2150				obj.closest('.evcal_evdata_cell').addClass('shorter_desc');
2151				
2152				obj.attr({'content':'less'});
2153				obj.find('.ev_more_arrow').addClass('ard');
2154				obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text);
2155			}
2156		}
2157		
2158	// expand and shrink featured image		
2159		$('body').on('click','.evcal_evdata_img',function(){
2160			if(!$(this).hasClass('evo_noclick')){		
2161				feature_image_expansion($(this), 'click');
2162			}
2163		});		
2164	
2165	// featured image height processing
2166		function feature_image_expansion(image, type){
2167			img = image;
2168			
2169			var img_status = img.attr('data-status');
2170			var img_style = img.attr('data-imgstyle');
2171			
2172			// if image already expanded
2173			if(img_status=='open' ){
2174				img.attr({'data-status':'close'}).css({'height':''});			
2175			}else{	
2176				var img_full_height = parseInt(img.attr('data-imgheight'));
2177				var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width());
2178					cal_width = (cal_width)? cal_width: img.width();
2179				var img_full_width = parseInt(img.attr('data-imgwidth'));
2180
2181
2182				// show at minimized height
2183				if(img_style=='100per'){
2184					relative_height = img_full_height;
2185				}else if(img_style=='full'){
2186					relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ;
2187				}else{
2188					// minimized version
2189					if(type=='click'){
2190						relative_height = parseInt(img_full_height * (cal_width/img_full_width));
2191						relative_height = (relative_height)? relative_height: img_full_height;
2192						
2193						relative_height = parseInt((cal_width * img_full_height) /img_full_width);
2194						
2195						//console.log(relative_height+ ' '+img_full_height+' '+cal_width);
2196
2197					}else{
2198						relative_height = img.attr('data-minheight');
2199					}					
2200				}
2201				
2202				// when to set the status as open for images
2203				if(img_status=='' && img_style=='minmized'){
2204					img.attr({'data-status':'close'}).removeClass('expanded');
2205				}else{
2206					img.attr({'data-status':'open'}).addClass('expanded');
2207				}
2208				img.css({'height':relative_height});
2209			}			
2210		}
2211
2212	// reset featured images based on settings
2213		function fullheight_img_reset(calid){
2214			if(calid){
2215				$('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){
2216					feature_image_expansion($(this));
2217				});
2218			}else{
2219				$('.evo_metarow_fimg').each(function(){					
2220					feature_image_expansion($(this));					
2221				});
2222			}
2223		}
2224			
2225	// treatments for calendar events upon load
2226		function treat_events(calid){
2227			if(calid!=''){
2228				if(is_mobile()){
2229					$('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'});
2230				}
2231			}
2232		}
2233
2234		// if mobile check
2235		function is_mobile(){
2236			return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false;
2237		}
2238
2239	// edit event button redirect
2240		$('body').on('click','.editEventBtnET', function(event){
2241			event.stopPropagation();
2242			href = $(this).attr('href');
2243			window.open(href);
2244		});
2245
2246	// repeat events series
2247	// @u 2.6.9
2248		$('body').on('click','.evo_repeat_series_date',function(){
2249			if( $(this).parent().data('click') ){
2250				URL =  $(this).data('l');
2251				window.location = URL;
2252			}
2253		});
2254
2255	// Tax Archive Content
2256		// organizer links from eventtop @4.5
2257		$('body').on('click','.evo_org_clk_link',function(){
2258			window.open( $(this).data('link') , "_blank");
2259		});
2260
2261	// event location archive card page
2262		// @u 2.8.6
2263		$('body').find('.evo_location_map').each(function(){			
2264			$(this).evo_load_gmap();
2265		});
2266
2267		// on event card lightbox load -> organizer details @since 4.2
2268		$('body').on('evo_ajax_complete_eventon_get_tax_card_content', function(event,  OO){
2269			
2270			LB = $('body').find('.'+ OO.lightbox_key);
2271
2272			if( LB.find('.evo_trigger_map').length == 0 ) return;
2273			map_id_elm = LB.find('.evo_trigger_map');
2274			
2275			map_id_elm.evo_load_gmap();
2276
2277			// run countdown timers
2278			LB.find('.evo_countdowner').each(function(){
2279				$(this).evo_countdown();
2280			});
2281			
2282		});
2283		
2284	// SINGLE EVENTS
2285		// Loading single event json based content
2286			$('body').on('evo_load_single_event_content', function(event, eid, obj){
2287				var ajaxdataa = {};
2288				ajaxdataa['eid'] = eid;
2289				ajaxdataa['nonce'] = the_ajax_script.postnonce;	
2290
2291				// pass on other event values
2292				if(obj.data('j')){
2293					$.each(obj.data('j'), function(index,val){
2294						ajaxdataa[ index] = val;
2295					});
2296				}			
2297				
2298				$.ajax({
2299					beforeSend: function(){ 	},	
2300					url:	get_ajax_url('eventon_load_event_content'),
2301					data: 	ajaxdataa,	dataType:'json', type: 	'POST',
2302					success:function(data){
2303						$('body').trigger('evo_single_event_content_loaded', [data, obj]);
2304					},complete:function(){ 	}
2305				});
2306			});
2307	
2308		if(is_mobile()){
2309			if($('body').find('.fb.evo_ss').length != 0){
2310				$('body').find('.fb.evo_ss').each(function(){
2311					obj = $(this);
2312					obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')});
2313				});
2314			}
2315		}
2316
2317		// on single event page
2318		if($('body').find('.evo_sin_page').length>0){
2319			$('.evo_sin_page').each(function(){
2320				$('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]);
2321				$(this).find('.desc_trig ').attr({'data-ux_val':'none'});
2322			});
2323		}
2324		
2325		// Single events box
2326			// Click on single event box
2327				$('.eventon_single_event').on('click', '.evcal_list_a',function(event){
2328					var obj = $(this);				
2329					var CAL = obj.closest('.ajde_evcal_calendar');
2330					var SC = CAL.evo_shortcode_data();
2331
2332					event.preventDefault();
2333
2334					// open in event page
2335					if(SC.ux_val == 4){ 
2336						var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href');
2337						window.location.href= url;
2338					}else if(SC.ux_val == '2'){ // External Link
2339						var url = SC.exturl;
2340						window.location.href= url;
2341					}else if(SC.ux_val == 'X'){ // do not do anything
2342						return false;
2343					}
2344				});
2345			// each single event box
2346				$('body').find('.eventon_single_event').each(function(){
2347					var _this = $(this);
2348
2349					var CAL = _this.closest('.ajde_evcal_calendar');
2350					var SC = CAL.evo_shortcode_data();	
2351					var evObj = CAL.find('.eventon_list_event');									
2352
2353					// show expanded eventCard
2354					if( SC.expanded =='yes'){
2355						_this.find('.evcal_eventcard').show();
2356						var idd = _this.find('.evcal_gmaps');						
2357
2358						// close button
2359						_this.find('.evcal_close').parent().css({'padding-right':0});
2360						_this.find('.evcal_close').hide();
2361
2362						//console.log(idd);
2363						var obj = _this.find('.desc_trig');
2364
2365						// Google Map
2366						obj.evoGenmaps({
2367							'fnt':2, 
2368							'cal':CAL,
2369						});
2370
2371						// mark as eventcard open @since 4.4
2372						evObj.find('.event_description').addClass('open');
2373
2374					// open eventBox and lightbox	
2375					}else if(SC.uxval =='3'){
2376
2377						var obj = _this.find('.desc_trig');
2378						// remove other attr - that cause to redirect
2379						obj.removeAttr('data-exlk').attr({'data-ux_val':'3'});
2380					}
2381
2382					// show event excerpt
2383					var ev_excerpt = CAL.find('.event_excerpt').html();
2384					
2385					if(ev_excerpt!='' && ev_excerpt!== undefined && SC.excerpt =='yes' ){
2386						var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>'
2387						evObj.append(appendation);
2388					}
2389
2390					// trigger support @since 4.4
2391					var obj = evObj.find('.desc_trig');
2392					var event_id = evObj.data('event_id');
2393
2394
2395					$('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]);	
2396				});
2397
2398	// HELPER items script
2399		// yes no button		
2400			$('body').on('click','.ajde_yn_btn ', function(event){
2401
2402				// stop this code from working on wp-admin
2403				if($('body').hasClass('wp-admin')) return false; 
2404				
2405				var obj = $(this);
2406				var afterstatement = obj.attr('afterstatement');
2407					afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement;	
2408				var uid = '';
2409
2410				// yes
2411				if(obj.hasClass('NO')){					
2412					obj.removeClass('NO');
2413					obj.siblings('input').val('yes');
2414
2415					// afterstatment
2416					if(afterstatement!=''){
2417						var type = (obj.attr('as_type')=='class')? '.':'#';
2418						if( obj.data('uid') !== undefined) uid = obj.data('uid');
2419						$(type+ afterstatement).slideDown('fast');						
2420					}
2421
2422				}else{//no
2423					obj.addClass('NO');
2424					obj.siblings('input').val('no');
2425					
2426					if(afterstatement!=''){
2427						var type = (obj.attr('as_type')=='class')? '.':'#';
2428						$(type+ afterstatement ).slideUp('fast');
2429					}
2430				}
2431			});
2432
2433// Search Scripts
2434	// Enter key detection for pc
2435		$.fn.evo_enterKey = function (fnc) {
2436		    return this.each(function () {
2437		        $(this).keypress(function (ev) {
2438		            var keycode = (ev.keyCode ? ev.keyCode : ev.which);
2439		            if (keycode == '13') {
2440		                fnc.call(this, ev);
2441		            }
2442		        })
2443		    })
2444		}
2445		
2446	$('body').on('click','.evo-search',function(){
2447		var section = $(this).closest('.calendar_header');
2448		var item = section.find('.evo_search_bar');
2449
2450		item.slideToggle('fast', function(){
2451			if(item.is(':visible'))  item.find('input').focus();
2452		});
2453	});
2454
2455	// Submit search from search box
2456		$('body').on('click','.evo_do_search',function(){
2457			do_search_box( $(this) );
2458		});
2459
2460		// dynamic enter key press on the search input field @4.2
2461			$('body').on('keypress', '.evo_search_field',function(event){
2462				var keycode = (event.keyCode ? event.keyCode : event.which);
2463				if( keycode == '13' ){
2464					do_search_box( $(this).siblings('.evo_do_search') );
2465				}			
2466			});
2467
2468		// primary search function
2469		function do_search_box(OBJ){
2470			SearchVal = OBJ.closest('.evosr_search_box').find('input').val();
2471			Evosearch = OBJ.closest('.EVOSR_section');
2472			OBJ.closest('.evo_search_entry').find('.evosr_msg').hide();
2473			//console.log(SearchVal);
2474
2475			if( SearchVal === undefined || SearchVal == ''){
2476				OBJ.closest('.evo_search_entry').find('.evosr_msg').show();
2477				return false;
2478			}
2479
2480			$('body')
2481			.on('evo_ajax_beforesend_evo_get_search_results', function (event, uid){
2482				Evosearch.find('.evo_search_results_count').hide();
2483				Evosearch.addClass('searching');
2484			}).on('evo_ajax_complete_evo_get_search_results', function (event, uid){
2485				Evosearch.removeClass('searching');
2486			}).on('evo_ajax_success_evo_get_search_results', function (event, uid, data){
2487				Evosearch.find('.evo_search_results').html( data.content);
2488
2489				if(Evosearch.find('.no_events').length==0){
2490					// find event count
2491					Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length;
2492					Evosearch.find('.evo_search_results_count span').html( Events);
2493					Evosearch.find('.evo_search_results_count').fadeIn();
2494				}
2495			});
2496
2497			var ajax_results = OBJ.evo_admin_get_ajax({
2498				'ajaxdata': {
2499					//action: 		'eventon_search_evo_events',
2500					search: 		SearchVal,
2501					shortcode:  	Evosearch.find('span.data').data('sc')					
2502				},
2503				ajax_type:'endpoint',
2504				ajax_action:'eventon_search_evo_events',
2505				'uid':'evo_get_search_results',
2506				end: 'client'
2507			});
2508
2509		}
2510
2511	// submit search from calendar
2512		$('body').on('click','.evosr_search_btn',function(){	
2513			search_within_calendar( $(this).siblings('input') );		});
2514		$(".evo_search_bar_in input").evo_enterKey(function () {	
2515			search_within_calendar( $(this) );		});
2516
2517		function search_within_calendar(obj){
2518
2519			var ev_cal = obj.closest('.ajde_evcal_calendar');
2520			
2521			ev_cal.evo_update_cal_sc({F:'show_limit_paged',V: '1' });
2522			ev_cal.evo_update_cal_sc({F:'s',V: obj.val() });
2523
2524			run_cal_ajax( ev_cal.attr('id'),'none','search');
2525			
2526		   	return false;	
2527		}	
2528
2529		// reset search field @since 4.5
2530		$('body').on('evo_main_ajax_complete',function(event,CAL, ajaxtype, responseJSON , data_arg ){
2531
2532			if(ajaxtype == 'search' ){
2533				if( data_arg.shortcode['s'] != '' ){
2534					CAL.find('.evosr_search_clear_btn').addClass('show');
2535				}					
2536			}
2537		}).on('click','.evosr_search_clear_btn',function(event){
2538			event.preventDefault();
2539			const obj = $(this);
2540			var ev_cal = obj.closest('.ajde_evcal_calendar');
2541			ev_cal.evo_update_cal_sc({F:'s',V: '' });
2542			run_cal_ajax( ev_cal.attr('id'),'none','search');
2543
2544			obj.removeClass('show');
2545			obj.siblings('input').val('');
2546		});
2547
2548
2549	// More event images interaction
2550		$('body').on('click','.evo_event_more_img',function(){
2551			var O = $(this);
2552			var eCARD = O.closest('.evcal_eventcard');
2553			var fIMG = O.find('img');
2554			var fURL = fIMG.data('f');
2555
2556			O.parent().find('span').removeClass('select'); O.addClass('select');
2557
2558			eCARD.find('img.evo_event_main_img').attr({'src': fURL});
2559
2560			relIMG = eCARD.find('.evo_metarow_fimg');
2561			relIMG.css('background-image', 'url('+ fURL +')' );
2562			relIMG.data('imgheight', fIMG.data('h'));
2563		});	
2564
2565// supportive
2566	// ajax url function 
2567		function get_ajax_url(action){
2568			return $('body').evo_get_ajax_url({a:action, type:'endpoint'});
2569		}
2570	// handlebar additions
2571		function handlebar_additional_arguments(){
2572			Handlebars.registerHelper('ifE',function(v1, options){
2573				return (v1 !== undefined && v1 != '' && v1)
2574                    ? options.fn(this)
2575                    : options.inverse(this);
2576			});
2577
2578			Handlebars.registerHelper('ifEQ',function(v1, v2, options){
2579				return ( v1 == v2)? options.fn(this): options.inverse(this);
2580			});
2581			Handlebars.registerHelper('ifNEQ',function(v1, v2, options){
2582				return ( v1 != v2)? options.fn(this): options.inverse(this);
2583			});
2584			Handlebars.registerHelper('BUStxt',function(V, options){	
2585				if( !( V in BUS.txt) ) return V;
2586				return BUS.txt[V];
2587			});
2588			Handlebars.registerHelper('GetDMnames',function(V, U, options){				
2589				return BUS.dms[U][ V ];
2590			});
2591			// get total of increments
2592			Handlebars.registerHelper('forAdds',function(count, add_val, options){	
2593				O = '';
2594				for(x=1; x<= count; x++){	O += add_val;	}			
2595				return O;
2596			});
2597			Handlebars.registerHelper('GetEvProp',function(EID, PROP, CALID){
2598				EID = EID.split('-');	
2599				EV = $('#'+ CALID).find('.evo_cal_events').data('events');
2600				
2601				var O = '';
2602				$.each(EV, function(i,d){
2603					if( d.ID == EID[0] && d.ri == EID[1]){
2604						if( !(PROP in d.event_pmv)) return;
2605						O = d.event_pmv[PROP][0];
2606					}
2607				});
2608				return O;
2609			});
2610			Handlebars.registerHelper('GetEvV',function(EID, PROP, CALID){
2611				EID = EID.split('-');	
2612				EV = $('#'+ CALID).find('.evo_cal_events').data('events');
2613				
2614				var O = '';
2615				$.each(EV, function(i,d){
2616					if( d.ID == EID[0] && d.ri == EID[1]){
2617						O = d[PROP];
2618					}
2619				});
2620				return O;
2621			});
2622			Handlebars.registerHelper('COUNT',function( V){		
2623				return Object.keys(V).length;
2624			});
2625			Handlebars.registerHelper('CountlimitLess',function( AR, C,options){		
2626				var L= Object.keys(AR).length;
2627				return ( L < C)? options.inverse(this): options.fn(this);
2628			});
2629			Handlebars.registerHelper('ifCOND',function(v1, operator, v2, options){
2630				return checkCondition(v1, operator, v2)
2631	                ? options.fn(this)
2632	                : options.inverse(this);
2633			});
2634			Handlebars.registerHelper('toJSON', function(obj) {
2635			    return new Handlebars.SafeString(JSON.stringify(obj));
2636			});
2637			Handlebars.registerHelper('Cal_def_check',function(V, options){		
2638				if( BUS.cal_def && BUS.cal_def[V] ) return options.fn(this);
2639				return options.inverse(this);
2640			});
2641			Handlebars.registerHelper('TypeCheck',function(V, options){		
2642				if( options.type == V ) return options.fn(this);
2643				return options.inverse(this);
2644			});
2645		}
2646		function checkCondition(v1, operator, v2) {
2647	        switch(operator) {
2648	            case '==':
2649	                return (v1 == v2);
2650	            case '===':
2651	                return (v1 === v2);
2652	            case '!==':
2653	                return (v1 !== v2);
2654	            case '<':
2655	                return (v1 < v2);
2656	            case '<=':
2657	                return (v1 <= v2);
2658	            case '>':
2659	                return (v1 > v2);
2660	            case '>=':
2661	                return (v1 >= v2);
2662	            case '&&':
2663	                return (v1 && v2);
2664	            case '||':
2665	                return (v1 || v2);
2666	            default:
2667	                return false;
2668	        }
2669	    }
2670	// @2.9.1
2671	// increase and reduce quantity
2672	    $('body').on('click','.evo_qty_change', function(event){
2673	        var OBJ = $(this);
2674	        var QTY = oQTY = parseInt(OBJ.siblings('em').html());
2675	        var MAX = OBJ.siblings('input').attr('max');
2676	        var BOX = OBJ.closest('.evo_purchase_box');
2677
2678	        var pfd = BOX.find('.evo_purchase_box_data').data('pfd');
2679	        
2680
2681	        (OBJ.hasClass('plu'))?  QTY++: QTY--;
2682
2683	        QTY =(QTY==0)? 1: QTY;
2684	        QTY = (MAX!='' && QTY > MAX)? MAX: QTY;
2685
2686	        // new total price
2687	        var sin_price = OBJ.parent().data('p');
2688	        new_price = sin_price * QTY;
2689
2690	        new_price = get_format_price( new_price, pfd);
2691
2692	        BOX.find('.total .value').html( new_price);
2693
2694	        OBJ.siblings('em').html(QTY);
2695	        OBJ.siblings('input').val(QTY);
2696
2697	        $('body').trigger('evo_qty_changed',[QTY,oQTY, new_price,OBJ ]);
2698	    });
2699
2700    // Total formating
2701        function get_format_price(price, data){
2702
2703            // price format data
2704            PF = data;
2705           
2706            totalPrice = price.toFixed(PF.numDec); // number of decimals
2707            htmlPrice = totalPrice.toString().replace('.', PF.decSep);
2708
2709            if(PF.thoSep.length > 0) {
2710                htmlPrice = _addThousandSep(htmlPrice, PF.thoSep);
2711            }
2712            if(PF.curPos == 'right') {
2713                htmlPrice = htmlPrice + PF.currencySymbol;
2714            }
2715            else if(PF.curPos == 'right_space') {
2716                htmlPrice = htmlPrice + ' ' + PF.currencySymbol;
2717            }
2718            else if(PF.curPos == 'left_space') {
2719                htmlPrice = PF.currencySymbol + ' ' + htmlPrice;
2720            }
2721            else {
2722                htmlPrice = PF.currencySymbol + htmlPrice;
2723            }
2724            return htmlPrice;
2725        }
2726        function _addThousandSep(n, thoSep){
2727            var rx=  /(\d+)(\d{3})/;
2728            return String(n).replace(/^\d+/, function(w){
2729                while(rx.test(w)){
2730                    w= w.replace(rx, '$1'+thoSep+'$2');
2731                }
2732                return w;
2733            });
2734        };
2735
2736
2737
2738});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.