PageSourceSearch

https://franke-akademie.de/wp-content/plugins/eventON/assets/js/eventon_script.js?ver=4.0.2

js franke-akademie.de collected 2026-10-02 15:08:22 UTC 74,658 bytes, 2,464 lines download raw bytes

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

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.