PageSourceSearch

https://mdkdzialdowo.pl/wp-content/plugins/eventON/assets/js/eventon_script.js?ver=2.8.5

js mdkdzialdowo.pl collected 2026-10-08 01:35:24 UTC 43,416 bytes, 1,408 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: 2.8.4
5 */
6
7jQuery(document).ready(function($){
8	
9	init();
10	var BODY = $('body');
11
12	var BUS = ''; // initial eventon calendar data
13
14	// RUN on Page load
15	function init(){
16		init_run_gmap_openevc();
17		fullheight_img_reset();	
18
19		init_load_cal_data();
20		handlebar_additional_arguments();
21	}
22
23
24	// Initial load data via ajax
25	function init_load_cal_data(){
26		var data_arg = {action: 'eventon_init_load'};	
27
28		BODY = $('body');
29		BODY.trigger('evo_global_page_run');
30
31		data_arg['global'] = $('#evo_global_data').data('d');
32		data_arg['cals'] ={};
33
34		// pass ajax loading calendar shortcodes
35		$('body').find('.ajax_loading_cal').each(function(){
36			CAL = $(this);
37			SC = CAL.find('.evo_cal_data').data('sc');
38
39			data_arg['cals'][ CAL.attr('id')] = {};
40			data_arg['cals'][ CAL.attr('id')]['sc'] = SC;
41		});
42
43		$.ajax({
44			beforeSend: function(){},
45			type: 'POST',
46			url:the_ajax_script.ajaxurl,
47			data: data_arg,
48			dataType:'json',
49			success:function(data){
50				$('#evo_global_data').data('d', data);
51
52				BUS = data;
53
54				// append html to calendars if present
55				if('cals' in data){
56					$.each(data.cals, function(i,v){
57						CAL = BODY.find('#'+ i);
58						if('html' in v){							
59							CAL.find('#evcal_list').html( v.html );
60							CAL.removeClass('ajax_loading_cal');
61							CAL.find('.evo_ajax_load_events').remove();
62						}
63						if('json' in v)	CAL.find('.evo_cal_events').data('events', v.json);
64						if('sc' in v) CAL.evo_update_all_cal_sc({SC: v.sc});
65
66						$('body').trigger('evo_init_ajax_success_each_cal', [data, i, v]);
67					});
68				}
69
70				$('body').trigger('evo_init_ajax_success', [data]);
71
72			},complete:function(data){				
73				init_run_gmap_openevc();
74			}
75		});
76	}
77
78	// handlebar additions
79		function handlebar_additional_arguments(){
80			Handlebars.registerHelper('ifE',function(v1, options){
81				return (v1 !== undefined && v1 != '' && v1)
82                    ? options.fn(this)
83                    : options.inverse(this);
84			});
85
86			Handlebars.registerHelper('ifEQ',function(v1, v2, options){
87				return ( v1 == v2)? options.fn(this): options.inverse(this);
88			});
89			Handlebars.registerHelper('ifNEQ',function(v1, v2, options){
90				return ( v1 != v2)? options.fn(this): options.inverse(this);
91			});
92			Handlebars.registerHelper('BUStxt',function(V, options){	
93				if( !( V in BUS.txt) ) return V;
94				return BUS.txt[V];
95			});
96			Handlebars.registerHelper('GetDMnames',function(V, U, options){				
97				return BUS.dms[U][ V ];
98			});
99			// get total of increments
100			Handlebars.registerHelper('forAdds',function(count, add_val, options){	
101				O = '';
102				for(x=1; x<= count; x++){	O += add_val;	}			
103				return O;
104			});
105			Handlebars.registerHelper('GetEvProp',function(EID, PROP, CALID){
106				EID = EID.split('-');	
107				EV = $('#'+ CALID).find('.evo_cal_events').data('events');
108				
109				var O = '';
110				$.each(EV, function(i,d){
111					if( d.ID == EID[0] && d.ri == EID[1]){
112						if( !(PROP in d.event_pmv)) return;
113						O = d.event_pmv[PROP][0];
114					}
115				});
116				return O;
117			});
118			Handlebars.registerHelper('GetEvV',function(EID, PROP, CALID){
119				EID = EID.split('-');	
120				EV = $('#'+ CALID).find('.evo_cal_events').data('events');
121				
122				var O = '';
123				$.each(EV, function(i,d){
124					if( d.ID == EID[0] && d.ri == EID[1]){
125						O = d[PROP];
126					}
127				});
128				return O;
129			});
130			Handlebars.registerHelper('COUNT',function( V){		
131				return Object.keys(V).length;
132			});
133			Handlebars.registerHelper('CountlimitLess',function( AR, C,options){		
134				var L= Object.keys(AR).length;
135				return ( L < C)? options.inverse(this): options.fn(this);
136			});
137			Handlebars.registerHelper('ifCOND',function(v1, operator, v2, options){
138				return checkCondition(v1, operator, v2)
139	                ? options.fn(this)
140	                : options.inverse(this);
141			});
142			Handlebars.registerHelper('toJSON', function(obj) {
143			    return new Handlebars.SafeString(JSON.stringify(obj));
144			});
145			Handlebars.registerHelper('Cal_def_check',function(V, options){		
146				if( BUS.cal_def && BUS.cal_def[V] ) return options.fn(this);
147				return options.inverse(this);
148			});
149			Handlebars.registerHelper('TypeCheck',function(V, options){		
150				if( options.type == V ) return options.fn(this);
151				return options.inverse(this);
152			});
153		}
154		function checkCondition(v1, operator, v2) {
155	        switch(operator) {
156	            case '==':
157	                return (v1 == v2);
158	            case '===':
159	                return (v1 === v2);
160	            case '!==':
161	                return (v1 !== v2);
162	            case '<':
163	                return (v1 < v2);
164	            case '<=':
165	                return (v1 <= v2);
166	            case '>':
167	                return (v1 > v2);
168	            case '>=':
169	                return (v1 >= v2);
170	            case '&&':
171	                return (v1 && v2);
172	            case '||':
173	                return (v1 || v2);
174	            default:
175	                return false;
176	        }
177	    }
178
179	// LIGHTBOX		
180		// close popup
181			BODY.on('click','.evolbclose', function(){	
182				LIGHTBOX = 	$(this).closest('.evo_lightbox');
183				closing_lightbox( LIGHTBOX );				
184			});
185
186		// close with click outside popup box when pop is shown	
187			$(document).on('click', function(event) {
188				//event.stopPropagation(); 
189				//console.log($(event.target));
190			    if( 
191			    	$(event.target).hasClass('evo_content_inin')
192			    ){
193			    	closing_lightbox( $(event.target).closest('.evo_lightbox') );
194			       	//console.log('5');
195			    }
196			});		
197			function closing_lightbox( lightboxELM){
198				
199				if(! lightboxELM.hasClass('show')) return false;
200				Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false;
201				lightboxELM.removeClass('show');
202
203				$('body').trigger('lightbox_before_event_closing', [lightboxELM]);
204
205				setTimeout( function(){ 
206					lightboxELM.find('.evo_lightbox_body').html('');
207					
208					if(Close){
209						$('body').removeClass('evo_overflow');
210						$('html').removeClass('evo_overflow');
211					}
212					
213					// trigger action to hook in at this stage
214						$('body').trigger('lightbox_event_closing', [lightboxELM]);
215				}, 500);
216			}
217
218		// when lightbox open triggered
219		$('body').on('evolightbox_show',function(){
220			$('.evo_lightboxes').show();
221			$('body').addClass('evo_overflow');
222			$('html').addClass('evo_overflow');
223
224			$('body').trigger('evolightbox_opened');
225		});
226		
227	// OPENING event card -- USER INTREACTION and loading google maps
228		//event full description\		
229		$('body').on('click','.eventon_events_list .desc_trig', function(event){
230
231			var obj = $(this);					
232			
233			var attr = obj.closest('.evo_lightbox').attr('data-cal_id');
234			if(typeof attr !== typeof undefined && attr !== false){
235				var cal_id = attr;
236				var CAL = cal = $('#'+cal_id);
237			}else{
238				var CAL = cal = obj.closest('.ajde_evcal_calendar');
239			}
240
241			SC = CAL.evo_shortcode_data();
242
243			var evodata = cal.find('.evo-data');
244
245			click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false;
246			event_id = obj.closest('.eventon_list_event').data('event_id');
247						
248			
249			// whole calendar specific values
250			var cal_ux_val = SC.ux_val;
251						
252			// event specific values
253			var ux_val = obj.data('ux_val');
254			var exlk = obj.data('exlk');			
255			
256			// override overall calendar user intereaction OVER individual event UX
257			if(cal_ux_val!='' && cal_ux_val!== undefined && cal_ux_val!='0'){
258				ux_val = cal_ux_val;
259			}
260
261			//console.log(cal_ux_val+' '+ux_val);
262			// open as lightbox
263			if(ux_val=='3'){
264				event.preventDefault();
265
266				// set elements
267				EVO_LIGHTBOX = $('.evo_lightbox.eventcard');
268				LIGHTBOX_body = EVO_LIGHTBOX.find('.evo_lightbox_body');
269
270				repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri'));
271				repeat_interval = (repeat_interval)? repeat_interval: '0';
272				
273				// resets
274					EVO_LIGHTBOX.find('.evo_pop_body').show();
275					fullheight_img_reset();
276					LIGHTBOX_body.html('');
277
278				var event_list = obj.closest('.eventon_events_list');
279				var content = obj.closest('.eventon_list_event').find('.event_description').html();
280				var content_front = obj.html();
281				
282				var _content = $(content).not('.evcal_close');
283				
284				// RTL
285				if(event_list.hasClass('evortl')){	
286					EVO_LIGHTBOX.find('.evo_popin').addClass('evortl');	
287					EVO_LIGHTBOX.addClass('evortl');
288				}
289			
290				LIGHTBOX_body.append('<div class="evopop_top">'+content_front+'</div>').append(_content);
291				LIGHTBOX_body.attr('class','evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+event_id +'_'+ repeat_interval);
292				
293				var this_map = LIGHTBOX_body.find('.evcal_gmaps');
294				var idd = this_map.attr('id');
295				this_map.attr({'id':idd+'_evop'});
296				
297				EVO_LIGHTBOX.addClass('show');
298				$('body').trigger('evolightbox_show');
299
300				obj.evoGenmaps({	
301					'_action':'lightbox',
302					'cal':cal,
303					'mapSpotId':idd+'_evop'
304				});
305				
306				fullheight_img_reset();    // added second reset
307
308				// update border color
309					bgcolor = $('.evo_pop_body').find('.evcal_cblock').attr('data-bgcolor');
310					$('.evo_pop_body').find('.evopop_top').css({'border-left':'3px solid '+bgcolor});
311
312				// trigger 
313				if( obj.data('runjs')){
314					$('body').trigger('evo_load_single_event_content',[ event_id, obj]);
315				}
316				
317				$('body').trigger('evolightbox_end');
318				return false;
319
320			// open in single events page 
321			}else if(ux_val=='4'){
322				
323				if( obj.attr('href')!='' &&  obj.attr('href')!== undefined){
324					return;
325				}else{
326					var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
327					if(obj.attr('target') == '_blank'){  window.open(url);}else{ window.open(url, '_self');}
328					return false;
329				}
330			// open in single events page  in new window
331			}else if(ux_val=='4a'){
332				
333				if( obj.attr('href')!='' &&  obj.attr('href')!== undefined){
334					return;
335				}else{
336					var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
337					window.open(url);
338					return false;
339				}
340
341			// open as external link
342			}else if(ux_val=='2'){
343				//var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href');
344				var url = obj.attr('href');
345
346				// if the click is coming from single event box
347				if( click_sinev_box ){
348					event.preventDefault();
349					return false;
350				}
351
352				//console.log(url);
353				if(url !== undefined && url != ''){
354					if(obj.attr('target') == '_blank'){  
355						var win = window.open(url, '_blank');
356						win.focus();
357					}else{
358						window.open(url, '_self');
359					}	
360
361					event.preventDefault();				
362				}
363				return true;
364
365			// do not do anything
366			}else if(ux_val=='X'){
367				return false;
368			}else if(ux_val=='none'){
369				return false;
370			}else{
371				
372				// redirecting to external link
373				if(exlk=='1' && ux_val!='1'){
374					// if there is no href
375					if( obj.attr('href')!='' &&  obj.attr('href')!== undefined){
376						return;
377					}else{
378						var url = obj.siblings('.evo_event_schema').find('a').attr('href');
379						if(obj.attr('target') == '_blank'){  window.open(url);}else{ window.open(url, '_self');}
380
381						event.preventDefault();								
382						return false;
383					}
384				// SLIDE DOWN eventcard
385				}else{
386					
387					var event_box = obj.closest('.eventon_list_event');			
388					var click_item = event_box.find('.event_description');
389
390					if(click_item.hasClass('open')){
391						event_box.removeClass('open');
392						click_item.slideUp().removeClass('open');
393					}else{
394						// accordion
395						if( SC.accord == 'yes'){
396							cal.find('.eventon_list_event').removeClass('open');
397							cal.find('.event_description').slideUp().removeClass('open');
398						}
399						event_box.addClass('open');
400						click_item.slideDown().addClass('open');						
401					}
402					
403					// This will make sure markers and gmaps run once and not multiples			
404					if( obj.attr('data-gmstat')!= '1'){				
405						obj.attr({'data-gmstat':'1'});						
406						obj.evoGenmaps({'fnt':2});
407					}	
408
409					// trigger 
410					if( obj.data('runjs')){
411						$('body').trigger('evo_load_single_event_content',[ event_id, obj]);
412					}				
413
414					return false;
415				}
416			}
417		});		
418
419		// call to run google maps on load
420			function init_run_gmap_openevc(delay){
421				$('.ajde_evcal_calendar').each(function(){
422					SC = $(this).evo_shortcode_data();
423
424					if( SC === undefined) return;
425
426					if( 'evc_open' in SC && SC.evc_open =='yes'){
427
428						$(this).find('.desc_trig').each(function(){
429							if(delay!='' && delay !== undefined){							
430								$(this).evoGenmaps({'fnt':2, 'delay':delay});
431							}else{
432								$(this).evoGenmaps({'fnt':2});							
433							}
434						});
435					}
436				});
437			}
438
439	// Calendar Interaction
440		// event bubbles
441		$('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){
442			O = $(this);
443			LIST = O.closest('.eventon_events_list');
444			title = O.find('.evcal_event_title').html();
445
446			p = O.position();
447
448			LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>");
449			B = LIST.find('.evo_bub_box');
450
451			l = p.left;
452			t = p.top- B.height() -30;
453
454			// adjust bubble to left if event on right edge
455			LM = LIST.width();
456			tl = p.left + B.width() + O.width();
457			if(   tl > LM){
458				l = l - B.width() +O.width()-20;
459			}
460
461			B.css({'top':t, 'left':l});
462
463			LIST.find('.evo_bub_box').addClass('show');
464		}).on('mouseout',function(){
465			B = $(this).find('.evo_bub_box').remove();
466		});
467
468	// Click on eventtop items
469		$('body').on('click','.evocmd_button', function(event){
470			event.preventDefault();
471			event.stopPropagation();
472
473			href = $(this).data('href');			
474			if( $(this).data('target')=='yes'){
475				window.open(href,'_blank');
476			}else{
477				window.location = href;
478			}
479
480		});
481
482	// GO TO TODAY
483	// @+ 2.3 @up 2.8
484		$('body').on('click','.evo-gototoday-btn', function(){
485			var obj = $(this);
486			CAL = obj.closest('.ajde_evcal_calendar');			
487			var calid = CAL.attr('id');
488
489			CAL.evo_update_cal_sc({F:'fixed_month', V: obj.data('mo')});
490			CAL.evo_update_cal_sc({F:'fixed_year', V: obj.data('yr')});
491			
492			run_cal_ajax( calid,'none','today');
493			obj.fadeOut();
494		});
495
496		$('body').on('evo_main_ajax_before', function(event, CAL, ajaxtype){
497			if(ajaxtype == 'switchmonth')	CAL.find('.evo-gototoday-btn').fadeIn();
498		});
499		$('body').on('evo_main_ajax_complete', function(event, CAL,ajaxtype, D , data_arg){
500			// if focused month and year are same as current month and year hide the current month button
501			var N = moment().utc();
502			SC = CAL.evo_shortcode_data();
503
504			var SU = parseInt( SC.focus_start_date_range);				
505			var M = moment.unix(SU).utc();	
506
507			if( N.format('YYYY M') == M.format('YYYY M')){				
508				CAL.find('.evo-gototoday-btn').fadeOut();
509			}
510			
511		});
512
513	// MONTH jumper
514		$('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){
515			$(this).parent().siblings().find('.evo_j_container').slideToggle();
516		});
517
518		// select a new time from jumper
519		$('.evo_j_dates').on('click','a',function(){
520			var val = $(this).attr('data-val'),
521				type = $(this).parent().parent().attr('data-val'),
522				CAL = $(this).closest('.ajde_evcal_calendar');
523				SC = CAL.evo_shortcode_data();
524
525			if(type=='m'){ // change month
526				CAL.evo_update_cal_sc({F:'fixed_month', V: val });
527			}else{
528				CAL.evo_update_cal_sc({F:'fixed_year', V: val });
529			}
530
531			run_cal_ajax( CAL.attr('id') ,'none','jumper');
532			
533			// hide month jumper if not set to leave expanded
534			if(SC.expj =='no')	container.delay(2000).slideUp();
535		});
536
537	// RESET general calendar
538		function cal_resets(calOBJ){
539			calargs = $(calOBJ).find('.cal_arguments');
540			calargs.attr('data-show_limit_paged', 1 );
541		}
542	
543	// close event card
544		$('.eventon_events_list').on('click','.evcal_close',function(){
545			$(this).closest('.evcal_eventcard').slideUp().removeClass('open');
546		});		
547		
548	// change IDs for map section for eventon widgets
549		if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){
550			cal.find('.evcal_gmaps').each(function(){
551				var gmap_id = obj.attr('id');
552				var new_gmal_id =gmap_id+'_widget'; 
553				obj.attr({'id':new_gmal_id})
554			});
555		}
556	
557	// Tab view switcher
558		$('body').find('.evo_tab_container').each(function(){
559			$(this).find('.evo_tab_section').each(function(){
560				if(!$(this).hasClass('visible')){
561					$(this).addClass('hidden');
562				}
563			});
564		});
565		$('body').on('click','ul.evo_tabs li',function(){
566			tab = $(this).data('tab');
567			tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container');
568			tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible');
569			tabsection.find('.'+tab).addClass('visible').removeClass('hidden');
570
571			$(this).parent().find('li').removeClass('selected');
572			$(this).addClass('selected');
573		});
574	// layout view changer
575		if($('body').find('.evo_layout_changer').length>0){
576			$('body').find('.evo_layout_changer').each(function(item){
577				if($(this).parent().hasClass('boxy')){
578					$(this).find('.fa-th-large').addClass('on');
579				}else{
580					$(this).find('.fa-reorder').addClass('on');
581				}
582			});
583
584			$('.evo_layout_changer').on('click','i',function(){
585				TYPE = $(this).data('type');
586				$(this).parent().find('i').removeClass('on');
587				$(this).addClass('on');
588
589				//console.log(TYPE);
590				
591				if(TYPE=='row'){
592					$(this).closest('.ajde_evcal_calendar').removeClass('boxy');
593				}else{
594					$(this).closest('.ajde_evcal_calendar').addClass('boxy');
595				}				
596			});
597		}
598	
599	// SORTING & FILTERING
600		// display sort section
601		$('.evo-filter-btn').click(function(){
602			CAL = $(this).closest('.ajde_evcal_calendar');
603			line = CAL.find('.eventon_sorting_section');
604			if(line.is(':visible')){
605				line.hide();
606				$(this).removeClass('show');
607			}else{
608				line.show();
609				$(this).addClass('show');
610			}
611			// hide sort menu
612			CAL.find('.eventon_sort_line').hide();
613		});	
614		
615		// SORTing
616			$('.evo-sort-btn').click(function(){
617				line = $(this).find('.eventon_sort_line');
618				if(line.is(':visible')){
619					line.hide();
620					$(this).removeClass('show');
621				}else{
622					line.show();
623					$(this).addClass('show');
624				}
625			});
626		
627			// update calendar based on the sorting selection
628				$('.eventon_sort_line').on('click','p',function(){
629					O = $(this);
630					var CAL = O.closest('.ajde_evcal_calendar');
631					var sort_by = O.data('val');
632					
633					// update new values everywhere
634					CAL.evo_update_cal_sc({F:'sort_by',V:sort_by});
635
636					O.parent().find('p').removeClass('select');
637					O.addClass('select');	
638
639					run_cal_ajax(CAL.attr('id'),'none','sorting');						
640				});		
641		
642		// filtering section open and close menu
643			$('.filtering_set_val').click(function(){
644				// close sorting
645					sortSelect = $(this).closest('.eventon_sorting_section').find('.evo_srt_options');
646					if(sortSelect.is(':visible') == true) sortSelect.fadeToggle();
647
648				var obj = $(this);
649				var current_Drop = obj.siblings('.eventon_filter_dropdown');
650				var current_drop_pare = obj.closest('.eventon_filter');
651
652				current_drop_pare.siblings('.eventon_filter').find('.eventon_filter_dropdown').each(function(){
653					if($(this).is(':visible')== true ){
654						$(this).hide();
655						$(this).siblings('p').removeClass('show');
656					}				
657				});
658
659				if(current_Drop.is(':visible')== true){
660					obj.siblings('.eventon_filter_dropdown').fadeOut('fast');	
661					obj.removeClass('show');	
662				}else{
663					obj.siblings('.eventon_filter_dropdown').fadeIn('fast');
664					obj.addClass('show');
665				}			
666			});	
667		
668		// selection on filter dropdown list
669			$('.eventon_filter_dropdown').on('click','p',function(){
670				var new_filter_val = $(this).data('filter_val'),
671					O = $(this),
672					filter_section = $(this).closest('.eventon_filter_line');
673				var filter = $(this).closest('.eventon_filter');
674				var filter_current_set_val = filter.data('filter_val');
675				var select_filter_type = filter_section.hasClass('selecttype')? true:false;
676				FILTER_DROPDOWN = $(this).parent();
677				CAL = $(this).closest('.ajde_evcal_calendar');	
678
679				// for filter values with checkboxes
680				if(select_filter_type){	
681					val = '';
682
683					// NOT all
684					if( new_filter_val != 'all'){
685						O.parent().find('p.all').removeClass('select');
686						O.toggleClass('select');	
687
688						var unselect_count = 0;
689						O.parent().find('p').each(function(){
690							if( $(this).hasClass('select')){
691								val += $(this).data('filter_val')+',';
692							}else{
693								if(!$(this).hasClass('all')) unselect_count++;
694							}
695						});	
696
697						// all selected
698						if(unselect_count == 0){
699							O.parent().find('p.all').addClass('select');
700							val = 'all';
701						}	
702
703						// remove comma at the end
704						val = ( val.slice(-1) == ',')? val.slice(0,-1): val;
705
706						// if all field is not visible; nothing selected = all
707						if(val == '' && O.parent().find('p.all').length == 0) val='all';
708
709					// == all
710					}else{ 
711						if( O.hasClass('select')){
712							O.parent().find('p').removeClass('select');
713						}else{
714							O.parent().find('p').addClass('select');
715							val = 'all';
716						}						
717					}
718					
719					filter.data('filter_val',val); // v 2.7.4
720				
721				// regular selecting
722				}else{					
723					if( new_filter_val == 'all'){
724						O.parent().find('p').addClass('select');
725					}else{
726						O.parent().find('p').removeClass('select');
727						O.addClass('select');
728					}
729				}
730				if(filter_section.hasClass('selecttype')) return;
731				
732
733				// For non checkbox select options
734				if(filter_current_set_val == new_filter_val){
735					$(this).parent().fadeOut();
736				}else{					
737					cal_resets( CAL );
738							
739					// make changes					
740					filter.data('filter_val', new_filter_val);
741
742					CAL.evo_update_sc_from_filters();					
743
744					run_cal_ajax( CAL.attr('id') ,'none','filering');
745										
746					// reset the new values				
747					var new_filter_name = $(this).html();
748					
749					O.parent().fadeOut();
750					O.parent().siblings('.filtering_set_val').removeClass('show');
751				}
752			});
753			
754			// apply filters via button to the calendar
755				$('.eventon_filter_dropdown').on('change','input',function(event){
756					FILTER = $(this).closest('.eventon_filter');
757
758					val = '';
759					FILTER.find('input').each(function(){
760						val = ($(this).is(':checked'))? val + $(this).data('filter_val') +',': val;
761					});
762					val = (val=='')? '':val; // v2.5.2
763					FILTER.data('filter_val',val); // v 2.7.4
764				});
765			// apply filters
766				$('body').on('click','.evo_filter_submit',function(){
767					// fadeout any open filter dropdowns
768						$(this).closest('.eventon_filter_line').find('.eventon_filter_dropdown').fadeOut();
769						$(this).closest('.eventon_filter_line').find('.filtering_set_val').removeClass('show');
770
771					CAL = $(this).closest('.ajde_evcal_calendar');	
772					cal_resets( CAL);
773
774					CAL.evo_update_sc_from_filters();	// update shortcode from filters
775					
776					run_cal_ajax(CAL.attr('id'),'none','filering');
777				});
778		
779	// CAL BODY Listeners
780		$('body')
781			// Show more events on list
782				.on('click','.evoShow_more_events',  function(){
783					CAL = $(this).closest('.ajde_evcal_calendar');
784					SC = CAL.evo_shortcode_data();
785
786					OBJ = $(this);
787
788					// redirect to an external link 
789						if(SC.show_limit_redir !== ''){
790							window.location = SC.show_limit_redir;	return false;
791						}
792
793					// ajax pagination
794					if( SC.show_limit_ajax =='yes'){
795						CURRENT_PAGED = parseInt(SC.show_limit_paged);				
796						CAL.evo_update_cal_sc({F:'show_limit_paged', V: CURRENT_PAGED+1});
797						run_cal_ajax( CAL.attr('id'), 'none','paged');
798
799					}else{
800						var event_count = parseInt( SC.event_count );
801						
802						var eventList = OBJ.parent();
803						var allEvents = eventList.find('.eventon_list_event').length;
804
805						var currentShowing = eventList.find('.eventon_list_event:visible').length;
806
807						for(x=1; x<=event_count ; x++ ){
808							var inde = currentShowing+x-1;
809							eventList.find('.eventon_list_event:eq('+ inde+')').slideDown();
810						}
811
812						// hide view more button
813						if(allEvents > currentShowing && allEvents<=  (currentShowing+event_count)){
814							$(this).fadeOut();
815						}
816					}		
817
818				})
819			// MONTH switch
820				.on('click','.evcal_btn_prev', function(){
821					cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');
822					run_cal_ajax(cal_id,'prev','switchmonth');
823				})
824				.on('click','.evcal_btn_next',function(){					
825					cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');			
826					run_cal_ajax( cal_id,'next','switchmonth');
827				})
828
829			// JUMPER switch
830				.on('calendar_month_changed',function(event, CAL){
831					SC = CAL.evo_shortcode_data();
832
833					var O = CAL.find('.evo_j_container');
834					O.find('.evo_j_months a').removeClass('set');
835					O.find('.evo_j_months a[data-val="'+ SC.fixed_month +'"]').addClass('set');
836
837					O.find('.evo_j_years a').removeClass('set');
838					O.find('.evo_j_years a[data-val="'+ SC.fixed_year +'"]').addClass('set');
839
840					// show go to today 
841					B = CAL.find('.evo-gototoday-btn');
842					if( SC.fixed_month != B.data('mo') || SC.fixed_year != B.data('yr')){
843						B.show();
844					}
845				})
846
847			// View Switcher
848				.on('click', '.evo_vSW',function(){
849					O = $(this);
850					if(O.hasClass('focus')) return;
851					O.siblings('.evo_vSW').removeClass('focus');
852					O.addClass('focus');
853					CAL = O.closest('.ajde_evcal_calendar');
854					CAL.find('.evoADDS').fadeOut().delay(200).queue(function(){
855						$(this).remove();
856					});
857
858					if(O.hasClass('evoD')){
859						CAL.evo_update_cal_sc({F:'calendar_type', V: 'default'});
860						//SC = CAL.evo_shortcode_data();
861						CAL.find('#evcal_list').removeClass('evo_hide');
862						CAL.find('.eventon_list_event').show();
863					}
864								
865					$('body').trigger('evo_vSW_clicked', [ O, CAL]);
866				})
867			// show more/less event details
868			.on('click','.eventon_shad_p',function(){		
869				control_more_less( $(this));		
870			})
871		;
872
873
874	// PRIMARY hook to get content	
875		// MAIN AJAC for calendar events v2.8
876		function run_cal_ajax( cal_id, direction, ajaxtype){
877			
878			// identify the calendar and its elements.
879			var CAL = ev_cal = $('#'+cal_id); 
880
881			// check if ajax post content should run for this calendar or not			
882			if(CAL.attr('data-runajax')!='0'){
883
884				// category filtering for the calendar
885				var cat = CAL.find('.evcal_sort').attr('cat');
886
887				// reset paged values for switching months
888				if(ajaxtype=='switchmonth'){
889					CAL.find('.cal_arguments').attr('data-show_limit_paged',1);
890					CAL.evo_update_cal_sc({F:'show_limit_paged', V: '1'});
891				}	
892
893				SC = CAL.evo_shortcode_data();
894
895				$('body').trigger('evo_main_ajax_before', [CAL, ajaxtype, direction, SC]);		
896
897				var data_arg = {
898					action: 		'the_ajax_hook',
899					direction: 		direction,
900					shortcode: 		SC,
901					ajaxtype: 		ajaxtype,
902				};	
903
904				EVENTS_LIST = ev_cal.find('.eventon_events_list');
905
906				$.ajax({
907					beforeSend: function(){
908						ev_cal.addClass('evo_loading');
909						if(ajaxtype != 'paged')	EVENTS_LIST.slideUp('fast');
910
911						if(ajaxtype == 'paged'){
912							txt = EVENTS_LIST.find('.evoShow_more_events').html();
913							EVENTS_LIST.find('.evoShow_more_events').html('. . .').data('txt',txt);
914						}
915						ev_cal.evo_loader_animation();					
916					},
917					type: 'POST',
918					url:the_ajax_script.ajaxurl,
919					data: data_arg,
920					dataType:'json',
921					success:function(data){
922						if(!data) return false;
923						if(ajaxtype == 'paged'){	
924							EVENTS_LIST.find('.evoShow_more_events').remove();
925							EVENTS_LIST.find('.clear').remove();
926
927
928							EVENTS_LIST.append( data.html + "<div class='clear'></div>");
929
930							// hide show more events if all events loaded
931							var events_in_list = EVENTS_LIST.find('.eventon_list_event').length;
932							if( 'total_events' in data && data.total_events == events_in_list){
933								EVENTS_LIST.find('.evoShow_more_events').hide();
934							}	
935
936							// for month lists duplicate headers // @+2.8.1
937							var T = {};
938							EVENTS_LIST.find('.evcal_month_line').each(function(){
939								d = $(this).data('d');
940								if( T[d]) 
941									$(this).remove();
942								else
943									T[d] = true;
944							});
945
946							var T = {};
947							EVENTS_LIST.find('.sep_month_events').each(function(){
948								d = $(this).data('d');
949								if( T[d]){
950									var H = $(this).html();
951									EVENTS_LIST.find('.sep_month_events[data-d="'+d+'"]').append( H );
952									$(this).remove();
953								}else{T[d] = true;}
954							});
955							
956						}else{
957							EVENTS_LIST.html(data.html);
958						}
959						
960						// update calednar month title
961						animate_month_switch(data.cal_month_title, ev_cal.find('#evcal_cur'));
962							
963						// update calendar shortcode values after ajax
964						ev_cal.evo_update_all_cal_sc({SC: data.SC});
965
966						// update events list to calendar footer data
967						ev_cal.find('.evo_cal_events').data('events', data.json);
968
969						$('body').trigger('calendar_month_changed',[CAL]);
970						
971						$('body').trigger('evo_main_ajax_success', [CAL, ajaxtype, data, data_arg]);
972															
973					},complete:function(data){
974						ev_cal.evo_loader_animation({direction:'end'});
975
976						// show events list events if not set to hide on load
977						if(! EVENTS_LIST.hasClass('evo_hide')) EVENTS_LIST.delay(300).slideDown('slow');
978						
979						ev_cal.evoGenmaps({'delay':400});
980						init_run_gmap_openevc(600);
981						fullheight_img_reset(cal_id);
982
983						// pluggable
984						$('body').trigger('evo_main_ajax_complete', [CAL, ajaxtype, data.responseJSON , data_arg]);
985						ev_cal.removeClass('evo_loading');
986					}
987				});
988			}			
989		}
990
991		$('body').on('evo_run_cal_ajax',function(event,cal_id, direction, ajaxtype){
992			run_cal_ajax( cal_id, direction, ajaxtype);
993		});
994
995		// deprecated bridge function for sortby value 
996		function ajax_post_content(sortby, cal_id, direction, ajaxtype){
997			run_cal_ajax( cal_id, direction, ajaxtype);
998		}
999
1000	// subtle animation when switching months
1001		function animate_month_switch(new_data, title_element){			
1002			var current_text = title_element.html();
1003			var hei = title_element.height();
1004			var wid= title_element.width();
1005			
1006			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);
1007						
1008			title_element.find('span:first-child').fadeOut(800); 
1009			title_element.find('span:last-child').fadeIn(800, function(){
1010				title_element.html(new_data).width('');
1011			});
1012		}
1013
1014	
1015	// actual animation/function for more/less button
1016		function control_more_less(obj){
1017			var content = obj.attr('content');
1018			var current_text = obj.find('.ev_more_text').html();
1019			var changeTo_text = obj.find('.ev_more_text').attr('data-txt');
1020			
1021			if(content =='less'){			
1022				
1023				var hei = obj.parent().siblings('.eventon_full_description').height();
1024				var orhei = obj.closest('.evcal_evdata_cell').height();
1025				
1026				obj.closest('.evcal_evdata_cell').attr({'orhei':orhei}
1026).animate({height: (parseInt(hei)+40) });
1027				
1028				obj.attr({'content':'more'});
1029				obj.find('.ev_more_arrow').addClass('less');
1030				obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text);
1031				
1032			}else{
1033				var orhei = parseInt(obj.closest('.evcal_evdata_cell').attr('orhei'));
1034				
1035				obj.closest('.evcal_evdata_cell').animate({height: orhei });
1036				
1037				obj.attr({'content':'less'});
1038				obj.find('.ev_more_arrow').removeClass('less');
1039				obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text);
1040			}
1041		}
1042		
1043	// expand and shrink featured image		
1044		$('body').on('click','.evcal_evdata_img',function(){
1045			if(!$(this).hasClass('evo_noclick')){				
1046				feature_image_expansion($(this), 'click');
1047			}
1048		});		
1049	
1050	// featured image height processing
1051		function feature_image_expansion(image, type){
1052			img = image;
1053			
1054			var img_status = img.attr('data-status');
1055			var img_style = img.attr('data-imgstyle');
1056			
1057			// if image already expanded
1058			if(img_status=='open' ){
1059				img.attr({'data-status':'close'}).css({'height':''});			
1060			}else{	
1061				var img_full_height = parseInt(img.attr('data-imgheight'));
1062				var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width());
1063					cal_width = (cal_width)? cal_width: img.width();
1064				var img_full_width = parseInt(img.attr('data-imgwidth'));
1065
1066
1067				// show at minimized height
1068				if(img_style=='100per'){
1069					relative_height = img_full_height;
1070				}else if(img_style=='full'){
1071					relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ;
1072				}else{
1073					// minimized version
1074					if(type=='click'){
1075						relative_height = parseInt(img_full_height * (cal_width/img_full_width));
1076						relative_height = (relative_height)? relative_height: img_full_height;
1077						
1078						relative_height = parseInt((cal_width * img_full_height) /img_full_width);
1079						
1080						//console.log(relative_height+ ' '+img_full_height+' '+cal_width);
1081
1082					}else{
1083						relative_height = img.attr('data-minheight');
1084					}					
1085				}
1086				
1087				// when to set the status as open for images
1088				if(img_status=='' && img_style=='minmized'){
1089					img.attr({'data-status':'close'}).removeClass('expanded');
1090				}else{
1091					img.attr({'data-status':'open'}).addClass('expanded');
1092				}
1093				img.css({'height':relative_height});
1094			}			
1095		}
1096
1097	// reset featured images based on settings
1098		function fullheight_img_reset(calid){
1099			if(calid){
1100				$('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){
1101					feature_image_expansion($(this));
1102				});
1103			}else{
1104				$('.evo_metarow_fimg').each(function(){					
1105					feature_image_expansion($(this));					
1106				});
1107			}
1108		}
1109			
1110	// treatments for calendar events upon load
1111		function treat_events(calid){
1112			if(calid!=''){
1113				if(is_mobile()){
1114					$('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'});
1115				}
1116			}
1117		}
1118
1119		// if mobile check
1120		function is_mobile(){
1121			return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false;
1122		}
1123
1124	// edit event button redirect
1125		$('body').on('click','.editEventBtnET', function(event){
1126			event.stopPropagation();
1127
1128			href = $(this).attr('href');
1129			//console.log(href);
1130			window.open(href);
1131		});
1132
1133	// repeat events series
1134	// @u 2.6.9
1135		$('body').on('click','.evo_repeat_series_date',function(){
1136			if( $(this).parent().data('click') ){
1137				URL =  $(this).data('l');
1138				window.location = URL;
1139			}
1140		});
1141
1142	// event location archive card page
1143	// @u 2.6.11
1144		$('body').find('.evo_location_map').each(function(){
1145			THIS = $(this);
1146			MAPID = THIS.attr('id');
1147
1148			var location_type = THIS.attr('data-location_type');
1149			if(location_type=='add'){
1150				var address = THIS.attr('data-address');
1151				var location_type = 'add';
1152			}else{			
1153				var address = THIS.attr('data-latlng');
1154				var location_type = 'latlng';				
1155			}
1156
1157			// zoomlevel
1158				zoom = parseInt(THIS.data('zoom'));
1159				scrollwheel = THIS.data('scroll') == 'yes'? true: false;
1160
1161			initialize(
1162				MAPID, 
1163				address, 
1164				THIS.data('mty'), 
1165				zoom, 
1166				location_type, 
1167				scrollwheel
1168			);
1169		});
1170		
1171	// SINGLE EVENTS
1172		// Loading single event json based content
1173			$('body').on('evo_load_single_event_content', function(event, eid, obj){
1174				var ajaxdataa = {};
1175				ajaxdataa['action']='eventon_load_event_content';
1176				ajaxdataa['eid'] = eid;
1177				ajaxdataa['nonce'] = the_ajax_script.postnonce;	
1178
1179				// pass on other event values
1180				if(obj.data('j')){
1181					$.each(obj.data('j'), function(index,val){
1182						ajaxdataa[ index] = val;
1183					});
1184				}			
1185				
1186				$.ajax({
1187					beforeSend: function(){ 	},	
1188					url:	the_ajax_script.ajaxurl,
1189					data: 	ajaxdataa,	dataType:'json', type: 	'POST',
1190					success:function(data){
1191						$('body').trigger('evo_single_event_content_loaded', [data, obj]);
1192					},complete:function(){ 	}
1193				});
1194			});
1195	
1196		if(is_mobile()){
1197			if($('body').find('.fb.evo_ss').length != 0){
1198				$('body').find('.fb.evo_ss').each(function(){
1199					obj = $(this);
1200					obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')});
1201				});
1202			}
1203		}
1204
1205		// on single event page
1206		if($('body').find('.evo_sin_page').length>0){
1207			$('.evo_sin_page').each(function(){
1208				$('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]);
1209				$(this).find('.desc_trig ').attr({'data-ux_val':'none'});
1210			});
1211		}
1212		
1213		// Single events box
1214			// Click on single event box
1215				$('.eventon_single_event').on('click', '.evcal_list_a',function(event){
1216					var obj = $(this);				
1217					var CAL = obj.closest('.ajde_evcal_calendar');
1218					var SC = CAL.evo_shortcode_data();
1219
1220					event.preventDefault();
1221
1222					// open in event page
1223					if(SC.ux_val == 4){ 
1224						var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href');
1225						window.location.href= url;
1226					}else if(SC.ux_val == '2'){ // External Link
1227						var url = SC.exturl;
1228						window.location.href= url;
1229					}else if(SC.ux_val == 'X'){ // do not do anything
1230						return false;
1231					}
1232				});
1233			// each single event box
1234				$('body').find('.eventon_single_event').each(function(){
1235					var _this = $(this);
1236
1237					var CAL = _this.closest('.ajde_evcal_calendar');
1238					var SC = CAL.evo_shortcode_data();	
1239					var evObj = CAL.find('.eventon_list_event');									
1240
1241					// show expanded eventCard
1242					if( SC.expanded =='yes'){
1243						_this.find('.evcal_eventcard').show();
1244						var idd = _this.find('.evcal_gmaps');						
1245
1246						// close button
1247						_this.find('.evcal_close').parent().css({'padding-right':0});
1248						_this.find('.evcal_close').hide();
1249
1250						//console.log(idd);
1251						var obj = _this.find('.desc_trig');
1252
1253						obj.evoGenmaps({'fnt':2});
1254
1255					// open eventBox and lightbox	
1256					}else if(SC.uxval =='3'){
1257
1258						var obj = _this.find('.desc_trig');
1259						// remove other attr - that cause to redirect
1260						obj.removeAttr('data-exlk').attr({'data-ux_val':'3'});
1261					}
1262
1263					// show event excerpt
1264					var ev_excerpt = CAL.find('.event_excerpt').html();
1265					
1266					if(ev_excerpt!='' && ev_excerpt!== undefined && SC.excerpt =='yes' ){
1267						var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>'
1268						evObj.append(appendation);
1269					}
1270				});
1271
1272
1273	// HELPER items script
1274		// yes no button		
1275			$('body').on('click','.ajde_yn_btn ', function(){
1276				var obj = $(this);
1277				var afterstatement = obj.attr('afterstatement');
1278					afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement;		
1279				// yes
1280				if(obj.hasClass('NO')){					
1281					obj.removeClass('NO');
1282					obj.siblings('input').val('yes');
1283
1284					// afterstatment
1285					if(afterstatement!=''){
1286						var type = (obj.attr('as_type')=='class')? '.':'#';
1287						$(type+ afterstatement).addClass('tt').slideDown('fast');						
1288					}
1289
1290				}else{//no
1291					obj.addClass('NO');
1292					obj.siblings('input').val('no');
1293					
1294					if(afterstatement!=''){
1295						var type = (obj.attr('as_type')=='class')? '.':'#';
1296						$(type+ afterstatement ).slideUp('fast');
1297					}
1298				}
1299			});
1300
1301// Search Scripts
1302	// Enter key detection for pc
1303		$.fn.evo_enterKey = function (fnc) {
1304		    return this.each(function () {
1305		        $(this).keypress(function (ev) {
1306		            var keycode = (ev.keyCode ? ev.keyCode : ev.which);
1307		            if (keycode == '13') {
1308		                fnc.call(this, ev);
1309		            }
1310		        })
1311		    })
1312		}
1313		
1314	$('.evo-search').on('click',function(){
1315		var section = $(this).closest('.calendar_header');
1316		var item = section.find('.evo_search_bar');
1317
1318		item.slideToggle('2000', function(){
1319			if(item.is(':visible'))  item.find('input').focus();
1320		});
1321	});
1322
1323	// Submit search from search box
1324		$('body').on('click','.evo_do_search',function(){
1325			do_search_box( $(this) );
1326		});
1327
1328		$(".evosr_search_box input").evo_enterKey(function () {
1329			do_search_box( $(this).siblings('.evo_do_search') );
1330		});
1331
1332		function do_search_box(OBJ){
1333			SearchVal = OBJ.closest('.evosr_search_box').find('input').val();
1334			Evosearch = OBJ.closest('.EVOSR_section');
1335			OBJ.closest('.evo_search_entry').find('.evosr_msg').hide();
1336			//console.log(SearchVal);
1337
1338			if( SearchVal === undefined || SearchVal == ''){
1339				OBJ.closest('.evo_search_entry').find('.evosr_msg').show();
1340				return false;
1341			}
1342			SC = Evosearch.find('span.data').evo_item_shortcodes();
1343			
1344			var data_arg = {
1345				action: 		'eventon_search_evo_events',
1346				search: 		SearchVal,
1347				shortcode: SC
1348			};
1349			$.ajax({
1350				beforeSend: function(){
1351					Evosearch.find('.evo_search_results_count').hide();
1352					Evosearch.addClass('searching');
1353				},
1354				type: 'POST',
1355				url:the_ajax_script.ajaxurl,
1356				data: data_arg,
1357				dataType:'json',
1358				success:function(data){
1359					Evosearch.find('.evo_search_results').html( data.content);
1360
1361					if(Evosearch.find('.no_events').length>0){
1362
1363					}else{
1364						// find event count
1365						Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length;
1366						Evosearch.find('.evo_search_results_count span').html( Events);
1367						Evosearch.find('.evo_search_results_count').fadeIn();
1368					}
1369					
1370				},complete: function(){
1371					Evosearch.removeClass('searching');
1372				}
1373			});
1374		}
1375
1376	// submit search from calendar
1377		$('body').on('click','.evosr_search_btn',function(){	search_within_calendar( $(this).siblings('input') );		});
1378		$(".evo_search_bar_in input").evo_enterKey(function () {	search_within_calendar( $(this) );		});
1379
1380		function search_within_calendar(obj){
1381
1382			var ev_cal = obj.closest('.ajde_evcal_calendar');
1383
1384			ev_cal.evo_update_cal_sc({F:'s',V: obj.val() });
1385
1386			run_cal_ajax( ev_cal.attr('id'),'none','search');
1387			
1388		   	return false;	
1389		}	
1390
1391
1392	// More event images interaction
1393		$('body').on('click','.evo_event_more_img',function(){
1394			var O = $(this);
1395			var eCARD = O.closest('.evcal_eventcard');
1396			var fIMG = O.find('img');
1397			var fURL = fIMG.data('f');
1398
1399			O.parent().find('span').removeClass('select'); O.addClass('select');
1400
1401			eCARD.find('img.evo_event_main_img').attr({'src': fURL});
1402
1403			relIMG = eCARD.find('.evo_metarow_fimg');
1404			relIMG.css('background-image', 'url('+ fURL +')' );
1405			relIMG.data('imgheight', fIMG.data('h'));
1406		});	
1407
1408});

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.