PageSourceSearch

https://malratuindah.id/wp-content/plugins/eventON/assets/js/eventon_script.js?ver=4.2

js malratuindah.id collected 2026-10-02 17:44:27 UTC 78,588 bytes, 2,581 lines download raw bytes

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

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.