PageSourceSearch

https://pttc.org/wp-content/plugins/eventON/assets/js/eventon_script.js?ver=1.0

js pttc.org collected 2026-10-02 16:57:13 UTC 17,853 bytes, 627 lines download raw bytes

1/*
2	Javascript code that is associated with the front end of the calendar
3	version: 1.11
4*/
5jQuery(document).ready(function($){
6	
7	init();
8
9
10	function init(){
11		init_run_gmap_openevc();
12
13		fullheight_img_reset();
14
15		$('.evopop_top').click(function(){
16			//_form_set_rsvp_choise($(this));
17			alert('f');
18		});
19	}
20
21
22	// LIGHTBOX
23		var popupcode = "<div class='evo_popup' style='display:none'><div class='evo_popin'><a class='evopopclose'>X</a><div class='evo_pop_body evcal_eventcard'></div></div></div><div class='evo_popbg' style='display:none'></div>";
24		$('body').append(popupcode);
25		
26		// close popup
27		$('.evopopclose').click(function(){
28			$(this).closest('.evo_popup').fadeOut().siblings('.evo_popbg').fadeOut();
29		});
30		// close with click outside popup box when pop is shown
31			$(document).mouseup(function (e){
32				var container=$('.evo_pop_body');
33				
34					if (!container.is(e.target) // if the target of the click isn't the container...
35						&& e.pageX < ($(window).width() - 30)
36					&& container.has(e.target).length === 0) // ... nor a descendant of the container
37					{
38						$('.evo_popup').fadeOut(300);
39						$('.evo_popbg').fadeOut(300);
40					}
41				
42			});
43			
44		// LIGHTBOX functionsx
45			function prepair_popup(){
46				var cur_window_top = parseInt($(window).scrollTop()) + 50;
47				$('.evo_popin').css({'margin-top':cur_window_top});				
48				$('.evo_pop_body').html('');
49			}
50			
51			function show_popup(){
52				$('.evo_popup').fadeIn(300);
53				$('.evo_popbg').fadeIn(300);
54			}
55			
56			function appendTo_popup(content){
57				$('.evo_pop_body').append(content);
58			}
59
60	
61	// OPENING event card -- USER INTREACTION and loading google maps
62		//event full description\
63
64		if(is_mobile()){
65			var etop_action = 'tap';
66		}else{
67			var etop_action = 'click';
68		}
69
70
71		$('body').on(etop_action,'.eventon_events_list .desc_trig', function(){
72
73			var obj = $(this);
74			var attr = obj.closest('.evoLB').attr('data-cal_id');
75			if(typeof attr !== typeof undefined && attr !== false){
76				var cal_id = attr;
77				var cal = $('#'+cal_id);
78			}else{
79				var cal = obj.closest('.ajde_evcal_calendar');
80			}
81			
82			
83			var evodata = cal.find('.evo-data');
84			var ux_val__ = evodata.data('ux_val');
85			var accord__ = evodata.data('accord');
86
87			
88			
89			var exlk = obj.data('exlk');
90			var ux_val = obj.data('ux_val');
91			
92			// override overall calendar user intereaction OVER individual event UX
93			if(ux_val__!='' && ux_val__!== undefined && ux_val__!='00'){
94				ux_val = ux_val__;
95			}
96			
97			//console.log(ux_val);
98			// open as popup
99			if(ux_val=='3'){
100				
101				$('.evo_pop_body').show();
102				obj.evoGenmaps({
103					'_action':'lightbox',
104				});
105
106				// update border color
107					bgcolor = $('.evo_pop_body').find('.evcal_cblock').attr('bgcolor');
108					$('.evo_pop_body').find('.evopop_top').css({'border-left':'3px solid '+bgcolor});
109				
110				return false;
111
112			// open in single events page -- require single event addon
113			}else if(ux_val=='4'){
114				
115				if( $(this).attr('href')!='' &&  $(this).attr('href')!== undefined){
116					return;
117				// if there is no href like single event box	
118				}else{
119					var url = $(this).siblings('.evo_event_schema').find('a').attr('href');
120					window.open(url, '_self');
121					return false;
122				}
123
124			}else if(ux_val=='2'){
125				return;
126			}else if(ux_val=='X'){
127				return false;
128			}else if(ux_val=='none'){
129				return false;
130			}else{
131				
132				// redirecting to external link
133				if(exlk=='1' ){
134					// if there is a href and <a>
135					if( $(this).attr('href')!='' &&  $(this).attr('href')!== undefined){
136						return;
137
138					// if there is no href like single event box	
139					}else{
140						var url = $(this).siblings('.evo_event_schema').find('a').attr('href');
141
142						window.location = url;
143						return false;
144					}
145				}else{
146
147					//alert('ff');
148					
149					var click_item = $(this).siblings('.event_description');
150					if(click_item.hasClass('open')){
151						click_item.slideUp().removeClass('open');
152					}else{
153						// accordion
154						if(accord__=='1'){
155							cal.find('.event_description').slideUp().removeClass('open');
156						}
157						click_item.slideDown().addClass('open');
158						
159					}
160					
161					// This will make sure markers and gmaps run once and not multiples			
162					if( obj.attr('data-gmstat')!= '1'){				
163						obj.attr({'data-gmstat':'1'});
164						//load_googlemaps(obj);
165						
166						obj.evoGenmaps({'fnt':2});
167					}
168							
169					return false;
170				}
171			}
172		});
173		
174
175		// call to run google maps on load
176		function init_run_gmap_openevc(delay){
177			$('.ajde_evcal_calendar').each(function(){
178				if($(this).find('.evo-data').data('evc_open')=='1'){
179					$(this).find('.desc_trig').each(function(){
180						if(delay!=''){
181							$(this).evoGenmaps({'fnt':2, 'delay':delay});
182						}else{
183							$(this).evoGenmaps({'fnt':2});
184						}
185					});
186				}
187			});
188		}
189	
190
191	// MONTH jumper
192		$('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){
193			$(this).parent().siblings('.evo_j_container').slideToggle();
194		});
195
196		// select a new time from jumper
197		$('.evo_j_dates').on('click','a',function(){
198			var val = $(this).attr('val');
199			var type = $(this).parent().parent().attr('val');
200			var container = $(this).closest('.evo_j_container');
201
202			if(type=='m'){
203				container.attr({'m':val});
204			}else{
205				container.attr({'y':$(this).html() });
206			}
207
208			// update set class
209				$(this).parent().find('a').removeClass('set');
210				$(this).addClass('set');
211
212			if(container.attr('m')!==undefined && container.attr('y')!==undefined){
213				
214				var calid = container.closest('.ajde_evcal_calendar').attr('id');
215				var evo_data = $('#'+calid).find('.evo-data');
216				evo_data.attr({
217					'data-cmonth':container.attr('m'),
218					'data-cyear':container.attr('y'),
219				});
220
221
222				ajax_post_content(evo_data.attr('data-sort_by'),calid,'none');
223
224				container.delay(2000).slideUp();
225			}
226		});
227
228		function change_jumper_set_values(cal_id){
229			var evodata = $('#'+cal_id).find('.evo-data');
230			var ej_container = $('#'+cal_id).find('.evo_j_container');
231			
232			ej_container.attr({'m':evodata.attr('data-cmonth')});
233		}
234	
235
236	// close event card
237		$('.eventon_events_list').on('click','.evcal_close',function(){
238			$(this).parent().parent().slideUp();
239		});
240		
241		
242	// change IDs for map section for eventon widgets
243		if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){
244			cal.find('.evcal_gmaps').each(function(){
245				var gmap_id = obj.attr('id');
246				var new_gmal_id =gmap_id+'_widget';
247				obj.attr({'id':new_gmal_id})
248			});
249		}
250
251
252	// show more events on the list
253		$('body').on('click','.evoShow_more_events',  function(){
254			var evCal = $(this).closest('.ajde_evcal_calendar');
255			var evoData = evCal.find('.evo-data');
256			var event_count = parseInt(evoData.data('ev_cnt'));
257			var show_limit = evoData.data('show_limit');
258			var allEvents = evCal.find('.eventon_list_event').length;
259
260			var currentShowing = evCal.find('.eventon_list_event:visible').length;
261
262			for(x=1; x<=event_count ; x++ ){
263				var inde = currentShowing+x-1;
264				evCal.find('.eventon_list_event:eq('+ inde+')').slideDown();
265			}
266
267			// hide view more button
268			if(allEvents > currentShowing && allEvents<=  (currentShowing+event_count)){
269				$(this).fadeOut();
270			}
271
272
273			//console.log(currentShowing);
274		});
275	
276		
277	//===============================
278	// SORT BAR SECTION
279	// ==============================
280	
281		// display sort section
282		$('.evo_sort_btn').click(function(){
283			$(this).siblings('.eventon_sorting_section').slideToggle('fast');
284		});	
285		
286		// sorting section	
287		$('.evo_srt_sel p.fa').click(function(){		
288			$(this).siblings('.evo_srt_options').fadeToggle();
289		});
290		
291			// update calendar based on the sorting selection
292			$('.evo_srt_options').on('click','p',function(){		
293					
294				var evodata = $(this).closest('.eventon_sorting_section').siblings('.evo-data');
295				var cmonth = parseInt( evodata.attr('data-cmonth'));
296				var cyear = parseInt( evodata.attr('data-cyear'));	
297				var sort_by = $(this).attr('val');
298				var new_sorting_name = $(this).html();
299				var cal_id = evodata.parent().attr('id');	
300							
301				ajax_post_content(sort_by,cal_id,'none');
302				
303				// update new values everywhere
304				evodata.attr({'data-sort_by':sort_by});		
305				$(this).parent().find('p').removeClass('evs_hide');
306				$(this).addClass('evs_hide');		
307				$(this).parent().siblings('p.fa').html(new_sorting_name);
308				$(this).parent().hide();
309
310			});
311		
312		
313		// filtering section
314		$('.filtering_set_val').click(function(){
315			var obj = $(this);
316			obj.siblings('.eventon_filter_dropdown').fadeToggle('fast');
317			
318			
319		});	
320
321		
322		
323			// selection on filter dropdown list
324			$('.eventon_filter_dropdown').on('click','p',function(){
325				var new_filter_val = $(this).attr('filter_val');
326				var filter = $(this).closest('.eventon_filter');
327				var filter_current_set_val = filter.attr('filter_val');
328				
329				if(filter_current_set_val == new_filter_val){
330					$(this).parent().fadeOut();
331				}else{
332					// set new filtering changes				
333					var evodata = $(this).closest('.eventon_sorting_section').siblings('.evo-data');
334					var cmonth = parseInt( evodata.attr('data-cmonth'));
335					var cyear = parseInt( evodata.attr('data-cyear'));	
336					var sort_by = evodata.attr('data-sort_by');
337					var cal_id = evodata.parent().attr('id');				
338					
339					// make changes
340					filter.attr({'filter_val':new_filter_val});	
341					evodata.attr({'data-filters_on':'true'});
342					
343					ajax_post_content(sort_by,cal_id,'none');
344					
345					// reset the new values				
346					var new_filter_name = $(this).html();
347					$(this).parent().find('p').removeClass('evf_hide');
348					$(this).addClass('evf_hide');
349					$(this).parent().fadeOut();
350					$(this).parent().siblings('.filtering_set_val').html(new_filter_name);
351				}
352			});
353		
354			// fadeout dropdown menus
355			/*
356			$(document).mouseup(function (e){
357				var item=$('.eventon_filter_dropdown');
358				var container=$('.eventon_filter_selection');
359				
360				if (!container.is(e.target) // if the target of the click isn't the container...
361					&& e.pageX < ($(window).width() - 30)
362				&& container.has(e.target).length === 0) // ... nor a descendant of the container
363				{
364					item.fadeOut('fast');
365				}
366				
367			});
368*/
369			
370
371		
372
373	// MONTH SWITCHING
374		// previous month
375		$('.evcal_btn_prev').click(function(){
376			var evodata = $(this).parent().siblings('.evo-data');				
377			var sort_by=evodata.attr('data-sort_by');		
378			cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');
379			
380			ajax_post_content(sort_by,cal_id,'prev');			
381			
382		});
383		
384		// next month
385		$('.evcal_btn_next').click(function(){	
386			
387			var evodata = $(this).parent().siblings('.evo-data');				
388			var sort_by=evodata.attr('data-sort_by');		
389			cal_id = $(this).closest('.ajde_evcal_calendar').attr('id');
390			
391			ajax_post_content(sort_by, cal_id,'next');
392			
393		});
394		
395	
396	/*	PRIMARY hook to get content	*/
397		function ajax_post_content(sort_by,cal_id, direction){
398			
399			// identify the calendar and its elements.
400			var ev_cal = $('#'+cal_id); 
401			var cal_head = ev_cal.find('.calendar_header');	
402			var evodata = ev_cal.find('.evo-data');	
403
404			// check if ajax post content should run for this calendar or not
405			//console.log(ev_cal.attr('data-runajax'));
406			if(ev_cal.attr('data-runajax')!='0'){	
407
408				var filters_on = ( evodata.attr('data-filters_on')=='true')?'true':'false';
409					
410				// creat the filtering data array if exist
411				if(filters_on =='true'){
412					var filter_section = ev_cal.find('.eventon_filter_line');
413					var filter_array = [];
414					
415					filter_section.find('.eventon_filter').each(function(index){
416						var filter_val = $(this).attr('filter_val');
417						
418						if(filter_val !='all'){
419							var filter_ar = {};
420							filter_ar['filter_type'] = $(this).attr('filter_type');
421							filter_ar['filter_name'] = $(this).attr('filter_field');
422							filter_ar['filter_val'] = filter_val;
423							filter_ar['filter_op'] = $(this).attr('data-fl_o');
424							filter_array.push(filter_ar);
425						}
426					});			
427				}else{
428					var filter_array ='';
429				}
430				
431				var shortcode_array ={};
432				
433				ev_cal.find('.cal_arguments').each(function(){
434					$.each(this.attributes, function(i, attrib){
435						var name = attrib.name;
436						//console.log(name);
437						if(attrib.name!='class' && attrib.name!='style' ){
438							shortcode_array[attrib.name] = attrib.value;	
439						}
440					});
441				});				
442				//console.log(shortcode_array);
443				
444				
445				
446				// category filtering for the calendar
447				var cat = ev_cal.find('.evcal_sort').attr('cat');
448				var event_count = parseInt(evodata.attr('data-ev_cnt'));
449				
450				var data_arg = {
451					action: 		'the_ajax_hook',
452					current_month: 	evodata.attr('data-cmonth'),	
453					current_year: 	evodata.attr('data-cyear'),
454					focus_start_date_range: evodata.attr('data-range_start'),
455					focus_end_date_range: evodata.attr('data-range_end'),
456					send_unix: 		evodata.attr('data-send_unix'),
457					direction: 		direction,
458					sort_by: 		sort_by, 
459					event_count: 	event_count,
460					filters: 		filter_array,
461					shortcode: 		shortcode_array
462				};
463				
464				cal_head.find('.eventon_other_vals').each(function(){
465					if($(this).val()!=''){
466						data_arg[$(this).attr('name')] = $(this).val();
467					}
468				});
469				
470				
471				$.ajax({
472					beforeSend: function(){
473						ev_cal.find('.eventon_events_list').slideUp('fast');
474						ev_cal.find('#eventon_loadbar').show().css({width:'0%'}).animate({width:'100%'});
475					},
476					type: 'POST',
477					url:the_ajax_script.ajaxurl,
478					data: data_arg,
479					dataType:'json',
480					success:function(data){
481						//alert(data);
482						ev_cal.find('.eventon_events_list').html(data.content);
483						animate_month_switch(data.cal_month_title, ev_cal.find('#evcal_cur'));
484						
485						evodata.attr({'data-cmonth':data.month,'data-cyear':data.year});
486						change_jumper_set_values(cal_id);						
487						
488					},complete:function(){
489						ev_cal.find('#eventon_loadbar').css({width:'100%'}).fadeOut();
490						ev_cal.find('.eventon_events_list').delay(300).slideDown('slow');
491						ev_cal.evoGenmaps({'delay':400});
492						init_run_gmap_openevc(600);
493						fullheight_img_reset(cal_id);
494					}
495				});
496			}
497			
498		}
499	
500	// subtle animation when switching months
501		function animate_month_switch(new_data, title_element){
502			
503			var current_text = title_element.html();
504			var hei = title_element.height();
505			var wid= title_element.width();
506			
507			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);
508			
509			
510			title_element.find('span:first-child').fadeOut(800); 
511			title_element.find('span:last-child').fadeIn(800, function(){
512				title_element.html(new_data).width('');
513			});
514			
515		}
516	
517	
518	// show more and less of event details
519		$('.eventon_events_list').on('click','.eventon_shad_p',function(){		
520			control_more_less( $(this) );		
521		});
522		
523		$('.evo_pop_body').on('click','.eventon_shad_p',function(){		
524			control_more_less( $(this));		
525		});	
526	
527	// actual animation/function for more/less button
528		function control_more_less(obj){
529			
530			
531			var content = obj.attr('content');
532			var current_text = obj.find('.ev_more_text').html();
533			var changeTo_text = obj.find('.ev_more_text').attr('txt');
534			
535			if(content =='less'){			
536				
537				var hei = obj.parent().siblings('.eventon_full_description').height();
538				var orhei = obj.closest('.evcal_evdata_cell').height();
539				
540				obj.closest('.evcal_evdata_cell').attr({'orhei':orhei}).animate({height: (parseInt(hei)+40) });
541				
542				obj.attr({'content':'more'});
543				obj.find('.ev_more_arrow').addClass('less');
544				obj.find('.ev_more_text').attr({'txt':current_text}).html(changeTo_text);
545				
546			}else{
547				var orhei = parseInt(obj.closest('.evcal_evdata_cell').attr('orhei'));
548				
549				obj.closest('.evcal_evdata_cell').animate({height: orhei });
550				
551				obj.attr({'content':'less'});
552				obj.find('.ev_more_arrow').removeClass('less');
553				obj.find('.ev_more_text').attr({'txt':current_text}).html(changeTo_text);
554			}
555		}
556	
557	
558	// expand and shrink featured image
559		$('.ajde_evcal_calendar').on('click','.evcal_evdata_img',function(){
560			if(!$(this).hasClass('evo_noclick')){				
561				feature_image_expansion($(this));
562			}
563		});
564		$('.evo_popup').on('click','.evcal_evdata_img',function(){
565			if(!$(this).hasClass('evo_noclick')){				
566				feature_image_expansion($(this));
567			}
568		});
569	
570		function feature_image_expansion(image, height){
571			img = image;
572			
573			var img_status = img.attr('status');
574			
575			if(img_status=='open' ){
576				img.attr({'status':'close'}).css({'height':''});				
577			}else{				
578
579				var img_full_height = parseInt(img.attr('data-imgheight'));
580				
581				if(img.hasClass('evo_fullheight')){
582					relative_height = img_full_height;
583				}else{
584					var cal_width = parseInt(img.parent().width());			
585					var img_full_width = parseInt(img.attr('data-imgwidth'));
586					var img_current_height = parseInt(img.height());
587					
588					var relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ;
589
590					//console.log(relative_height+' '+xx);
591				}
592				
593				img.css({'height':relative_height}).attr({'status':'open'});
594			}
595			
596		}
597
598		
599		function fullheight_img_reset(calid){
600			if(calid){
601				$('#'+calid).find('.eventon_list_event .evo_fullheight').each(function(){
602					feature_image_expansion($(this));
603				});
604			}else{
605				$('.evo_fullheight').each(function(){					
606					feature_image_expansion($(this));					
607				});
608			}
609		}
610		
611	
612	// treatments for calendar events upon load
613		function treat_events(calid){
614			if(calid!=''){
615				if(is_mobile()){
616					$('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'});
617				}
618			}
619		}
620
621		// if mobile check
622		function is_mobile(){
623			return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false;
624		}
625
626
627})

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.