PageSourceSearch

https://www.ctc.org.hk/wp-content/themes/ctc/assets/js/main.js?ver=20260924222946

js ctc.org.hk collected 2026-09-24 22:30:10 UTC 49,801 bytes, 1,672 lines download raw bytes

1var isDevice = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),
2	bp_menu = 1300;
3 
4function init_common() {
5	// init nav
6	$(".s-header .btn-menu").click(function (e) {
7		$(this).toggleClass("active");
8		$(this).hasClass("active") ? $("html").addClass("_open_menu") : $("html").removeClass("_open_menu");
9		$("html").removeClass("_open_search _open_filter");
10	});
11
12	/* $(".s-header .has-sub .btn-collapse-toggle").click(function (e) {
13		$(this).parent().next().collapse("toggle");
14		return false;
15	}); */
16
17	$(".s-header .has-sub .btn-collapse-toggle").click(function (e) {
18		$(this).parent().next().slideToggle();
19		return false;
20	});
21
22
23
24	$(".s-header .btn-search, .s-header .btn-search-close").click(function (e) {
25		$(".s-header .btn-menu").removeClass("active");
26		$("html").removeClass("_open_menu").toggleClass("_open_search");
27	});
28
29	//.b-collapse
30	$(".collapse").on('show.bs.collapse hide.bs.collapse', function (e) {
31		e.type == "show" ? $(this).parent().addClass("expand") : $(this).parent().removeClass("expand");
32	});
33	/* 	$(".b-collapse-toggle").click(function (e) {
34			$(this).next().collapse("toggle");
35		}); */
36
37	$(".b-collapse-toggle").click(function (e) {
38		var target = $(this).next();
39		if (target.is(":visible")) {
40			target.slideUp();
41			$(this).parent().removeClass("expand");
42
43		} else {
44			target.slideDown();
45			$(this).parent().addClass("expand");
46		}
47	});
48
49
50	$(".nav-fs a").click(function (e) {
51		e.preventDefault();
52
53		$(this).parents(".nav-fs").find("a").removeClass("active");
54		$(this).addClass("active");
55
56		var fs = $(this).attr("href").replace("#", "");
57		$("html").removeClass("fs-sm fs-md fs-lg").addClass("fs-" + fs);
58		return false;
59	});
60
61	// form-select
62
63
64	$(window).resize(function (e) {
65		$(".s-header .box-ctx").css("max-height", window.innerHeight + "px");
66	}).trigger("resize");
67
68	$(".b-tabs .txt-tab").click(function (e) {
69
70		if ($(this).attr("href") != "#" && $(this).attr("href") != "#0")
71			return true;
72
73		e.preventDefault();
74		$(this).addClass("active").parents(".b-tabs").find(".txt-tab").not(this).removeClass("active");
75
76		var i = $(this).parent().index();
77		//console.log('tab:'+i);
78		// update select
79		$(this).parent().find("select").prop('selectedIndex', i).selectric('refresh');
80		// update b-view
81		$($(this).parents(".b-tabs-views").find(".box-view")[i]).addClass("active").siblings().removeClass("active");
82		return false;
83	});
84
85
86	$('select').selectric({
87		disableOnMobile: false,
88		nativeOnMobile: false,
89		onInit: function (elm) {
90			if ($(elm).hasClass("district-select")) {
91			var listItems = document.querySelectorAll('.district-list .selectric-scroll li');
92				listItems.forEach((item) => {
93					item.style.display = "block";
94				});
95			var areaSelectricScrollDiv = document.querySelector('.area-list .selectric-scroll');
96			var areaSelectedLi = areaSelectricScrollDiv.querySelector('li.selected');
97			var areaSelectedText = areaSelectedLi.textContent.trim();
98			//console.log(areaSelectedText);
99			districtArray = [];
100			if (areaSelectedText === '港島區') {
101				districtArray = ['全部區域','南區', '中西區', '灣仔區', '東區'];
102			} else if (areaSelectedText === '九龍區') {
103				districtArray = ['全部區域', '深水埗區', '九龍城區', '觀塘區', '油尖旺區', '黃大仙區'];
104			} else if (areaSelectedText === '新界區') {
105				districtArray = ['全部區域', '沙田區', '西貢區', '離島區', '大埔區', '元朗區', '北區', '葵青區', '荃灣區', '屯門區'];
106			} else if (areaSelectedText === '港岛区') {
107				districtArray = ['全部区域', '南区', '中西区', '湾仔区', '东区'];
108			} else if (areaSelectedText === '九龙区') {
109				districtArray = ['全部区域', '深水埗区', '九龙城区', '观塘区', '油尖旺区', '黄大仙区'];
110			} else if (areaSelectedText === '新界区') {
111				districtArray = ['全部区域', '沙田区', '西贡区', '离岛区', '大埔区', '元朗区', '北区', '葵青区', '荃湾区', '屯门区'];
112			}
113			var listItems = document.querySelectorAll('.district-list .selectric-scroll li');
114			//console.log(listItems);
115			listItems.forEach((item) => {
116				if (!districtArray.includes(item.textContent.trim()) && (areaSelectedText != "全部地區" && areaSelectedText != "全部地区")) {
117					item.style.display = 'none';
118				}
119			});
120		}
121
122			
123		},
124		onChange: function (elm) {
125			if ($(elm).hasClass("form-select-tabs")) {
126				$(elm).parents(".b-tabs").find(".txt-tab")[elm.selectedIndex].click();
127			}
128
129			if ($(elm).hasClass("talk_category_list")) {
130				//console.log("class" + $(elm).attr('class'));
131				var cult_talk_section = $(this).parents(".cult-talk-list");
132				var list = $('.row.row-list');
133				list.empty();
134				get_cult_talk_list(cult_talk_section);
135			}
136
137
138			if ($(elm).hasClass("area-select")) {
139				//console.log("area select");
140				var listItems = document.querySelectorAll('.district-list .selectric-scroll li');
141				listItems.forEach((item) => {
142					item.style.display = "block";
143				});
144
145				var dropDownMenuDiv = document.querySelector('.district-list .selectric-items');
146				dropDownMenuDiv.style.height = 'unset';
147
148				var areaSelectricScrollDiv = document.querySelector('.area-list .selectric-scroll');
149				var areaSelectedLi = areaSelectricScrollDiv.querySelector('li.selected');
150				var areaSelectedText = areaSelectedLi.textContent.trim();
151				var areasDistrictList = checkDistrict(areaSelectedText);
152
153				var firstAreaItem = areaSelectricScrollDiv.querySelector('li');
154				var firstAreaText = firstAreaItem.textContent.trim();
155
156				var firstLabel = document.querySelector(".district-list .selectric .label");
157				if (firstAreaText == '全部地區') {
158					firstLabel.textContent = "全部區域";
159				} else if (firstAreaText == '全部地区') {
160					firstLabel.textContent = "全部区域";
161				}
162				var listItems = document.querySelectorAll('.district-list .selectric-scroll li');
163				listItems.forEach((item) => {
164					if (!areasDistrictList.includes(item.textContent.trim()) && (areaSelectedText != "全部地區" && areaSelectedText != "全部地区")) {
165						item.style.display = 'none';
166					}
167				});
168			}
169		}
170	});
171
172
173	function checkDistrict(area) {
174
175		var areaSelectricScrollDiv = document.querySelector('.area-list .selectric-scroll');
176		var firstAreaItem = areaSelectricScrollDiv.querySelector('li');
177		var firstAreaText = firstAreaItem.textContent.trim();
178
179		districtArray = [];
180		if (firstAreaText == '全部地區') {
181			if (area === '港島區') {
182				districtArray = ['全部區域','中西區', '東區', '南區', '灣仔區'];
183			} else if (area === '九龍區') {
184				districtArray = ['全部區域', '九龍城區','油尖旺區','深水埗區','黃大仙區','觀塘區'];
185			} else if (area === '新界區') {
186				districtArray = ['全部區域', '大埔區','元朗區','屯門區','北區','西貢區','沙田區', '荃灣區', '葵青區','離島區'];
187			}
188		} else if (firstAreaText == '全部地区') {
189			if (area === '港岛区') {
190				districtArray = ['全部区域', '中西区', '东区', '南区',  '湾仔区'];
191			} else if (area === '九龙区') {
192				districtArray = ['全部区域', '九龙城区', '油尖旺区', '深水埗区','黄大仙区','观塘区'];
193			} else if (area === '新界区') {
194				districtArray = ['全部区域', '大埔区','元朗区','屯门区','北区','西贡区','沙田区', '荃湾区', '葵青区','离岛区'];
195			}
196		}
197		return districtArray;
198	};
199
200    $(".b-tabs:not(.link-tabs) .txt-tab.active").each(function() {
201		var dataTabId = $(this).data("tab-id");
202		console.log(dataTabId);
203	});
204	//$(".b-tabs:not(.link-tabs) .txt-tab").each(function() {
205
206	$(".b-tabs:not(.link-tabs) .txt-tab").click(function (e) {
207		e.preventDefault();
208		var current_tab_id = $(this).attr('data-tab-id');		
209		var currentUrl = window.location.href;
210		const url = new URL(currentUrl);
211		const tabId = url.hash.split('=')[1];
212		console.log('tabId1:'+tabId);
213		$(this).addClass("active").parents(".b-tabs").find(".txt-tab").not(this).removeClass("active");
214		
215		if (currentUrl.indexOf('#?tab_id') < 0) {
216			window.location.hash = 'tab_id='+current_tab_id;
217		}else{
218			href = updateTabId(currentUrl,current_tab_id);
219			window.history.pushState('', '', href);
220		}
221		appendTabIdToHref();
222
223		$('#' + current_tab_id).removeClass("tab_deactive");
224		$(".b-tabs .txt-tab").each(function () {
225			var other_tab_id = $(this).attr('data-tab-id');
226			if (current_tab_id !== other_tab_id) {
227				if ($('#' + other_tab_id).length > 0) {
228					$('#' + other_tab_id).addClass("tab_deactive");
229					console.log("removed id:" + other_tab_id);
230				}
231			}
232		});
233		return false;
234	});
235
236	$(".b-cookie .btn").click(function (e) {
237		$(".b-cookie").fadeOut();
238	});
239
240
241	/*
242	function getQueryParam(url, param) {
243		param = param.replace(/[\[\]]/g, "\\$&");
244		var regex = new RegExp("[?&]" + param + "(=([^&#]*)|&|#|$)");
245		var results = regex.exec(url);
246		if (!results) return null;
247		if (!results[2]) return '';
248		return decodeURIComponent(results[2].replace(/\+/g, " "));
249	}
250	*/
251
252	
253	
254	function checkLanguage(textContent,zh_url,zh_hans_url,en_url,tabId){
255		if (textContent =="繁體"){
256			href = updateTabId(zh_url,tabId);
257		}else if (textContent =="English"){
258			href = updateTabId(en_url,tabId);
259		}else{
260			href = updateTabId(zh_hans_url,tabId);
261		}
262		return href;
263	}
264	function appendTabIdToHref(){
265		var url = window.location.href;
266		const currentUrl = new URL(url);
267		const tabId = currentUrl.hash.split('=')[1];
268		var languageUrl = document.querySelectorAll('#active-url');
269		if(tabId != null){			
270			for (var i = 0; i < languageUrl.length; i++) {
271				var href = languageUrl[i].getAttribute('href');
272				var textContent = languageUrl[i].textContent;
273				if (textContent =="繁體"){
274					var zh_url = languageUrl[i].getAttribute('href');
275				}else if (textContent =="English"){
276					var en_url = languageUrl[i].getAttribute('href');
277				}else{
278					var zh_hans_url = languageUrl[i].getAttribute('href');
279				}
280			
281				if (href.indexOf('tab_id') < 0 ) { //check url not have tab_id
282					href = checkLanguage(textContent,zh_url,zh_hans_url,en_url,tabId);
283					console.log('returnUrl:'+href);
284					languageUrl[i].setAttribute('href', href);
285				}else{					
286					href = checkLanguage(textContent,zh_url,zh_hans_url,en_url,tabId);
287					console.log('newhref:'+href);
288					languageUrl[i].setAttribute('href', href);
289				}
290				
291			}
292		}                
293		var divTab = document.querySelector('a[data-tab-id="'+tabId+'"]');
294		//console.log('dataTabId:'+'a[data-tab-id="'+tabId+'"].txt-tab');
295		var tabs = document.querySelectorAll('.b-tabs:not(.link-tabs) .txt-tab');
296		
297		//tab.addClass("active").parents(".b-tabs");
298		if (divTab) {
299			tabs.forEach(function(tab) {
300				var dataTabId = tab.getAttribute('data-tab-id');
301				console.log('dataTab:'+dataTabId);
302			});
303		}
304	}
305}
306
307function updateTabId(url,newTabId) {
308	//console.log('weburl:'+url);
309    const currentUrl = new URL(url);
310	const params = new URLSearchParams(currentUrl.hash.slice(1)); //get tab_id
311	console.log('newTab:'+newTabId);
312    if (params.has('tab_id')) { // check if currentUrl have tab_id
313		params.set('tab_id',newTabId);
314		currentUrl.hash = params.toString();
315		updateUrl = currentUrl.href;
316		console.log('haveTabId:'+updateUrl);
317    } else {
318        params.append('tab_id', newTabId);
319		currentUrl.hash = params.toString();
320		updateUrl = currentUrl.href;
321		console.log('notTabId:'+updateUrl);
322    }	
323	return updateUrl;
324}
325
326function init_slider() {
327
328	window.b_slider_banner = new Swiper('.b-slider-banner', {
329		
330		loop: true,
331		effect: "fade",
332		//allowTouchMove: false,
333		//preventInteractionOnTransition: true,
334		pagination: { el: '.swiper-pagination', clickable: true },
335		//speed: 3200,
336		
337		autoplay: {
338			delay: 5000,
339			disableOnInteraction: false,
340		},
341		on: {
342			init: function () {
343				
344				$(".b-slider-banner .btn-pause").click(function(e){
345					$(this).toggleClass("paused");
346					$(this).hasClass("paused") ? b_slider_banner.autoplay.pause() : b_slider_banner.autoplay.resume();
347				});
348				
349				window.tabPressed = false;
350				$(document).on('keydown', '*', function (e) {
351
352				if (e.key === "Tab" && window.tabPressed == false) {
353					window.tabPressed = true;
354					// $('.btn-pause').click();
355					$(".b-slider-banner .btn-pause").click();
356					window.b_slider_banner.autoplay.stop();
357					
358				}
359});
360			},
361		},
362	});
363
364
365	$(".row-slider-side").each(function (e) {
366
367		var b_slider_img = new Swiper($(this).find('.b-slider')[0], {
368			loop: false,
369			//autoHeight: $(this).find('.b-slider').data("auto-height"),
370			//pagination: { el: $(this).find('.swiper-pagination')[0], clickable: true },
371			navigation: {
372				nextEl: $(this).find(".btn-next")[0],
373				prevEl: $(this).find(".btn-prev")[0],
374			}
375		});
376	});
377
378
379	$(".row-slider-full").each(function (e) {
380		var b_slider_f = new Swiper($(this).find(".b-slider")[0], {
381			loop: true,
382			/*autoplay: {
383				delay: 3000,
384			},*/
385			navigation: {
386				nextEl: $(this).find(".btn-next")[0],
387				prevEl: $(this).find(".btn-prev")[0],
388			}
389		});
390	});
391
392	$(".row-slider-video").each(function (e) {
393		var b_slider_video = new Swiper($(this).find(".b-slider")[0], {
394			//loop: true,
395			spaceBetween: 15,
396			navigation: {
397				nextEl: $(this).find(".btn-next")[0],
398				prevEl: $(this).find(".btn-prev")[0],
399			},
400			on: {
401				slideChange: function () {
402					$('.b-video iframe').each(function () {
403						$(this)[0].contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
404					});
405				},
406			},
407			breakpoints: {
408				768: { spaceBetween: 20 },
409			},
410		});
411	});
412
413	$(".row-slider-gallery").each(function (e) {
414
415		var b_slider_thumbs = new Swiper($(this).find(".b-slider-thumbs")[0], {
416			loop: false,
417			spaceBetween: 12,
418			slidesPerView: 2.1,
419			breakpoints: {
420				600: { slidesPerView: 4 },
421			},
422		});
423
424		var b_slider_gallery = new Swiper($(this).find(".b-slider-gallery")[0], {
425			loop: false,
426			spaceBetween: 15,
427			navigation: {
428				nextEl: $(this).find(".btn-next")[0],
429				prevEl: $(this).find(".btn-prev")[0],
430			},
431			breakpoints: {
432				768: { spaceBetween: 20 },
433			},
434			thumbs: {
435				swiper: b_slider_thumbs
436			}
437		});
438	});
439
440	$(".row-slider-gallery2").each(function (e) {
441
442		var b_slider_gallery2 = new Swiper($(this).find(".b-slider-gallery2")[0], {
443			loop: true,
444			centeredSlides: true,
445			slidesPerView: 1.05,
446			spaceBetween: 15,
447			navigation: {
448				nextEl: $(this).find(".btn-next")[0],
449				prevEl: $(this).find(".btn-prev")[0],
450			},
451			breakpoints: {
452				768: { spaceBetween: 20 },
453			},
454		});
455	});
456
457	$(".row-slider-history").each(function (e) {
458
459		var b_slider_gallery2 = new Swiper($(this).find(".b-slider")[0], {
460			loop: false,
461			autoHeight: true,
462			pagination: { el: $(this).find('.swiper-pagination')[0], clickable: true },
463			navigation: {
464				nextEl: $(this).find(".btn-next")[0],
465				prevEl: $(this).find(".btn-prev")[0],
466			}
467		});
468	});
469
470	$(".b-slider-tabs").each(function (e) {
471		var $this = $(this);
472		var init_slide = $this.data("initial-slide") ? $this.data("initial-slide") : 0
473
474		var b_slider_tabs = new Swiper($this[0], {
475			loop: false,
476			slidesPerView: "auto",
477			initialSlide: init_slide,
478			/*navigation: {
479				nextEl: $(this).find(".btn-next")[0],
480				prevEl: $(this).find(".btn-prev")[0],
481			},*/
482			on: {
483				"progress": function (swiper) {
484					swiper.isBeginning ? $this.removeClass("_hide-start") : $this.addClass("_hide-start");
485					swiper.isEnd ? $this.removeClass("_hide-end") : $this.addClass("_hide-end");
486				},
487			}
488		});
489	});
490
491	//$("#test").click();
492	
493	
494}
495
496$(document).ready(function (e) {
497	$("html").addClass("_doc_ready");
498	isDevice ? $("html").addClass("_mobile") : $("html").addClass("_desktop");
499
500	init_common();
501	init_slider();
502
503});
504
505$(window).on("load", function (e) {
506	$("html").addClass("_win_load");
507
508	//$(window).resize(win_resize).trigger("resize");
509
510
511});
512
513
514
515// god click open modal
516jQuery(document).ready(function ($) {
517	$(document).on('click', '.god-modal', function (e) {
518		e.preventDefault();
519		//$('.row-slider-video').show();
520		//var videoContainer = $(this).find('.row-slider-video')
521		//console.log(videoContainer);
522		$('.b-video').css("padding-top", "56.25%");
523		$('.b-video-2').css("padding-top", "56.25%");
524		var title = $(this).find('.god-title').text();
525		var description = $(this).find('.god-description').text();
526		var video = $(this).find('.god-video').html();
527		var video_2 = $(this).find('.god-video-2').html();
528		var image = $(this).find('.god-image').html();
529
530		//var iframe = $('#god-video-iframe');
531		//iframe.attr('src', video);
532		
533
534		if (video == "") {
535			console.log("video is" + video);
536			//$('.row-slider-video').hide();
537			var image_html = '';
538			image_html += '<img class="god-image-no-video" src="';
539			image_html += image;
540			image_html += '"/>
540'
541			$('.b-video').html(image_html);
542			$('.b-video').css("padding-top", "unset");
543		} else {
544			$('.b-video').html(video);
545		}
546
547		if (video_2 == "null") {
548			var image_html = '';
549			$('.b-video-2').html(image_html);
550			$('.b-video-2').css("padding-top", "unset");
551		} else {
552			$('.b-video-2').html(video_2);
553		}
554
555		$('.god-popup .txt-subtitle-line').text(title);
556		$('.god-popup .txt-desc').html(description);
557
558		/* 		$.modaal({
559					content_source: '.god-popup',
560					type: 'inline',
561					animation: 'fade'
562				}); */
563	});
564});
565
566
567//god click show more
568$(document).on('click', '.god-list-button', function () {
569	var target_page = $('.god-list').attr('data-page');
570	//$('.god-list').attr('data-page', target_page);
571	target_page = parseInt(target_page) + 1;
572	var god_section = $(this).parents(".god-list");
573
574	get_god_list(god_section, parseInt(target_page));
575
576});
577
578
579function get_god_list(god_list_section, current_page = 1) {
580
581	//console.log("get_god");
582
583	//console.log(current_page);
584	var ajaxurl = god_list_section.attr("data-ajaxurl");
585	var per_page = god_list_section.attr("data-perpage");
586
587	var current_date = new Date();
588
589	jQuery.ajax({
590		url: ajaxurl,
591		data: {
592			action: 'get_god_list',
593			current_page: current_page,
594			per_page: per_page,
595		},
596		dataType: 'JSON',
597		type: 'POST',
598		success: function (result) {
599			var html = '';
600			var total_page = result.total_pages;
601			//console.log(result);
602			//console.log("total_page" + total_page);
603
604			if (result.data != undefined) {
605				for (var item of result.data) {
606
607					console.log(item.video);
608					html += '<div class="col col-12 col-md-6 col-lg-4 god-modal">';
609					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
610					html += '<div class="god-title" style="display: none">' + item.title + '</div>';
611					html += '<div class="god-description" style="display: none">' + item.description + '</div>';
612					html += '<div class="god-video" style="display: none">' + item.video + '</div>';
613					html += '<div class="god-video-2" style="display: none">' + item.video_copy + '</div>';
614					html += '<div class="god-image" style="display: none">' + item.image + '</div>';
615					html += '<div class="b-card b-card-video"><div class="box-img-title">';
616					//console.log("item.video" +item.video);
617					if (!item.image) {
618						if (item.video && item.video.match(/embed\/([^?"']+)/)) {
619							var videoId = item.video.match(/embed\/([^?"']+)/)[1];
620							console.log("videoId" + videoId);
621							html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
622						} else {
623
624							html += '<div class="img-card"><img alt="' + item.title + '" src="' + item.default_thumbnail + '" /></div>';
625						}
626					} else {
627						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.image + '></div>';
628					}
629
630					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
631					if(item.video) {
632						html += '<div class="ico ico-video"></div>';
633					} else {
634						html += '<div class="ico ico-video" style="visibility: hidden"></div>';
635					}
636					
637					html += '</div></div>';
638					html += '<div class="txt txt-card-desc">' + item.description + '</div>';
639					html += '</div></a></div>';
640				}
641
642				$('.god-list .row-list').append(html);
643				$('.god-list').attr('data-page', current_page);
644
645				$('[data-modaal-type="inline"]').modaal();
646
647				if (current_page === total_page) {
648					$('.god-list-button').hide();
649				}
650			}
651		},
652		error: function (result) {
653			console.log('error from admin-ajax.js', result);
654		}
655	});
656}
657
658
659//cult24 open modal
660jQuery(document).ready(function ($) {
661	$(document).on('click', '.cult24-modal', function (e) {
662		//console.log("clicked");
663		e.preventDefault();
664
665		var title = $(this).find('.cult24-title').text();
666		var description = $(this).find('.cult24-description').text();
667		var video = $(this).find('.cult24-video').html();
668		var provided_by = $(this).find('.cult24-provided_by').text();
669		$('.cult24-popup .video-provider').text("");
670
671		//var iframe = $('#cult-24-video-iframe');
672		//iframe.attr('src', video_link);
673		$('.b-video').html(video);
674
675		$('.cult24-popup .txt-subtitle-line').text(title);
676		$('.cult24-popup .txt-desc').html(description);
677
678		if (provided_by && provided_by !== "null") {
679			$('.cult24-popup .video-provider').text(provided_by);
680		}
681
682
683		/* 		$.modaal({
684					content_source: '.cult24-popup',
685					type: 'inline',
686					animation: 'fade'
687				}); */
688	});
689});
690
691
692
693//cult 24 show more
694$(document).on('click', '.cult24-list-button', function () {
695	var target_page = $('.cult24-list').attr('data-page');
696	//$('.god-list').attr('data-page', target_page);
697	target_page = parseInt(target_page) + 1;
698	var cult24_section = $(this).parents(".cult24-list");
699
700	get_cult24_list(cult24_section, parseInt(target_page));
701
702});
703
704
705
706function get_cult24_list(cult24_list_section, current_page = 1) {
707
708	//console.log("get_cult24");
709
710	//console.log(current_page);
711	var ajaxurl = cult24_list_section.attr("data-ajaxurl");
712	var per_page = cult24_list_section.attr("data-perpage");
713
714	var current_date = new Date();
715
716	jQuery.ajax({
717		url: ajaxurl,
718		data: {
719			action: 'get_cult24_list',
720			current_page: current_page,
721			per_page: per_page,
722		},
723		dataType: 'JSON',
724		type: 'POST',
725		success: function (result) {
726			var html = '';
727			var total_page = result.total_pages;
728			//console.log(result);
729			//console.log("total_page" + total_page);
730
731			if (result.data != undefined) {
732				for (var item of result.data) {
733
734
735					html += '<div class="col col-12 col-md-6 col-lg-4 cult24-modal">';
736					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
737					html += '<div class="cult24-title" style="display: none">' + item.title + '</div>';
738					html += '<div class="cult24-description" style="display: none">' + item.description + '</div>';
739					html += '<div class="cult24-video" style="display: none">' + item.video + '</div>';
740					html += '<div class="cult24-provided_by" style="display: none">' + item.provided_by + '</div>';
741					html += '<div class="b-card b-card-video"><div class="box-img-title">';
742					if (!item.image) {
743						if (item.video && item.video.match(/embed\/([^?"']+)/)) {
744							var videoId = item.video.match(/embed\/([^?"']+)/)[1];
745							//console.log("videoId" + videoId);
746							html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
747						} else {
748
749							html += '<div class="img-card"><img alt="' + item.title + '" src="' + item.default_thumbnail + '" /></div>';
750						}
751					} else {
752						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.image + '></div>';
753					}
754
755					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
756					html += '<div class="ico ico-video"></div></div></div>';
757					html += '<div class="txt txt-card-desc">' + item.description + '</div>';
758					html += '</div></a></div>';
759				}
760
761				$('.cult24-list .row-list').append(html);
762				$('.cult24-list').attr('data-page', current_page);
763
764				$('[data-modaal-type="inline"]').modaal();
765
766				if (current_page === total_page) {
767					$('.cult24-list-button').hide();
768				}
769			}
770		},
771		error: function (result) {
772			console.log('error from admin-ajax.js', result);
773		}
774	});
775}
776
777
778//cult event show more
779$(document).on('click', '.cult-event-list-button', function () {
780	var target_page = $('.cult-event-list').attr('data-page');
781	//$('.god-list').attr('data-page', target_page);
782	target_page = parseInt(target_page) + 1;
783	var cult_event_section = $(this).parents(".cult-event-list");
784
785	get_cult_event_list(cult_event_section, parseInt(target_page));
786
787});
788
789
790
791
792function get_cult_event_list(cult_event_list_section, current_page = 1) {
793
794	//console.log("get_cult_event");
795
796	//console.log(current_page);
797	var ajaxurl = cult_event_list_section.attr("data-ajaxurl");
798	var per_page = cult_event_list_section.attr("data-perpage");
799
800	var current_date = new Date();
801
802	jQuery.ajax({
803		url: ajaxurl,
804		data: {
805			action: 'get_cult_event_list',
806			current_page: current_page,
807			per_page: per_page,
808		},
809		dataType: 'JSON',
810		type: 'POST',
811		success: function (result) {
812			var html = '';
813			var total_page = result.total_pages;
814			//console.log(result);
815			//console.log("total_page" + total_page);
816
817
818			if (result.data != undefined) {
819				for (var item of result.data) {
820
821					console.log("image" + item.event_type_image);
822					html += '<div class="col col-12 col-md-6 col-lg-4">';
823					html += '<a href="' + item.targetUrl + '">';
824					html += '<div class="b-card b-card-event">';
825					html += '<div class="img-card"><img src=' + item.event_type_image + '></div>';
826					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
827					//html += '<div class="txt txt-card-date">' + item.publish_date + '</div></div></div></a>';
828					html += '<div class="txt txt-card-date">' + '</div></div></div></a></div>';
829				}
830
831				$('.cult-event-list .row-list').append(html);
832				$('.cult-event-list').attr('data-page', current_page);
833
834
835				if (current_page === total_page) {
836					$('.cult-event-list-button').hide();
837				}
838			}
839		},
840		error: function (result) {
841			console.log('error from admin-ajax.js', result);
842		}
843	});
844}
845
846
847
848jQuery(document).ready(function ($) {
849	$(document).on('click', '.cult-event-modal', function (e) {
850		//console.log("event_modal_clicked");
851		e.preventDefault();
852
853		var title = $(this).find('.event_title').text();
854		var description = $(this).find('.description').html();
855
856
857		$('.cult-event-popup .event-title').text(title);
858		$('.cult-event-popup .description').html(description);
859
860		var swiperWrapper = $('.event-gallery-wrapper');
861		swiperWrapper.empty();
862
863		var thumbnailWrapper = $('.event-thumbnail-wrapper');
864		thumbnailWrapper.empty();
865
866
867
868		$(this).find('.repeater-wrapper').each(function () {
869			var repeaterWrapper = $(this);
870
871			var imageElement = repeaterWrapper.find('.event_image_repeater_image');
872			var imageDescriptionElement = repeaterWrapper.find('.event_image_repeater_image_description');
873			var videoElement = repeaterWrapper.find('.event_image_repeater_video');
874
875
876
877
878			var video = videoElement.html();
879			//console.log("video" + video);
880
881
882			var image = imageElement.text();
883			var imageDescription = imageDescriptionElement.text();
884
885			//console.log('Image: ' + image);
886			//console.log('Image Description: ' + imageDescription);
887
888
889			var slideHTML = '<div class="swiper-slide">' +
890				'<a href="' + image + '" target="_blank">' + '<div class="img-gallery event-image-container">' +
891				'<img src="' + image + '" />' +
892				'<div class="txt-caption">' + imageDescription + '</div>' +
893				'</div>' + '</a>' +
894				'</div>';
895
896
897			swiperWrapper.append(slideHTML);
898
899
900			var thumbnailHTML = '<div class="swiper-slide">' +
901				'<div class="img-gallery event-thumbnail-container">' +
902				'<img src="' + image + '" />' +
903				'</div></div>';
904
905			if (video) {
906
907			}
908
909
910
911
912			//console.log(thumbnailHTML);
913			thumbnailWrapper.append(thumbnailHTML);
914		});
915
916
917		/* 		$.modaal({
918					content_source: '.cult24-popup',
919					type: 'inline',
920					animation: 'fade'
921				}); */
922
923
924
925	});
926});
927
928$(document).on("click", '.cult-talk-keyword-button', function () {
929
930
931	var cult_talk_section = $(this).parents(".cult-talk-list");
932	var list = $('.row.row-list');
933	list.empty();
934	get_cult_talk_list(cult_talk_section);
935})
936
937
938
939
940function get_cult_talk_list(cult_talk_list_section, current_page = 1) {
941
942	//console.log("get_talk_event");
943
944	//console.log(current_page);
945	var ajaxurl = cult_talk_list_section.attr("data-ajaxurl");
946	var per_page = cult_talk_list_section.attr("data-perpage");
947	var taxonomy_id = cult_talk_list_section.find('.talk_category_list').val();
948	var keyword = cult_talk_list_section.find('.cult-talk-keyword').val();
949	//console.log("keyword" + keyword);
950
951	var current_date = new Date();
952
953	jQuery.ajax({
954		url: ajaxurl,
955		data: {
956			action: 'get_cult_talk_list',
957			current_page: current_page,
958			per_page: per_page,
959			taxonomy_id: taxonomy_id,
960			keyword: keyword
961
962		},
963		dataType: 'JSON',
964		type: 'POST',
965		success: function (result) {
966			var html = '';
967			var total_page = result.total_pages;
968			//console.log(result);
969			//console.log("total_page" + total_page);
970			$('.cult-talk-list-button').show();
971
972			if (result.data != undefined) {
973				for (var item of result.data) {
974					var videoId = "";
975					
976
977					html += '<div class="col col-12 col-md-6 col-lg-4 cult-talk-modal">';
978					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
979					html += '<div class="talk-title" style="display: none">' + item.title + '</div>';
980					html += '<div class="talk-thumbnail" style="display: none">' + item.thumbnail + '</div>';
981					html += '<div class="talk-description" style="display: none">' + item.description + '</div>';
982					html += '<div class="talk-presenter" style="display: none">' + item.presenter + '</div>';
983
984					if (item.video_repeater != undefined) {
985						for (var videoItem of item.video_repeater) {
986							html += '<div class="video-item">';
987							html += '<div class="video" style="display: none">' + videoItem.video + '</div>';
988							html += '<div class="video-description" style="display: none">' + videoItem.video_description + '</div>';
989							html += '</div>';
990						}
991					}
992					html += '<div class="b-card b-card-video"><div class="box-img-title">';
993
994					if (item.video_repeater) {
995						var videoIdMatch = videoItem.video.match(/embed\/([^?"']+)/);
996						if (videoIdMatch && videoIdMatch[1]) {
997							videoId = videoIdMatch[1];
998							html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
999						}
1000
1001					} else {
1002						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.thumbnail + '></div>';
1003					}
1004					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
1005					html += '<div class="ico ico-video"></div></div></div>';
1006					html += '<div class="txt txt-card-desc">' + item.presenter + '</div>';
1007					html += '</div></a></div>';
1008
1009				}
1010
1011				$('.cult-talk-list .row-list').append(html);
1012				$('.cult-talk-list').attr('data-page', current_page);
1013
1014				$('[data-modaal-type="inline"]').modaal();
1015				if (current_page === total_page) {
1016					$('.cult-talk-list-button').hide();
1017				}
1018			}
1019		},
1020		error: function (result) {
1021			console.log('error from admin-ajax.js', result);
1022		}
1023	});
1024}
1025
1026//cult-talk open modal
1027jQuery(document).ready(function ($) {
1028	$(document).on('click', '.cult-talk-modal', function (e) {
1029		//console.log("clicked");
1030		e.preventDefault();
1031
1032		var title = $(this).find('.talk-title').text();
1033		var description = $(this).find('.talk-description').text();
1034		var presenter = $(this).find('.talk-presenter').text();
1035
1036		//console.log(title);
1037		//console.log(description);
1038		//console.log(presenter);
1039
1040		//$('.b-video').html(video);
1041
1042		$('.cult-talk-popup .txt-subtitle-line').text(title);
1043		$('.cult-talk-popup .txt-desc').text(presenter);
1044		$('.cult-talk-popup .txt-desc').text(description);
1045
1046		var swiperWrapper = $('.cult-talk-wrapper');
1047		swiperWrapper.empty();
1048
1049		$(this).find('.video-item').each(function () {
1050			var repeaterWrapper = $(this);
1051
1052			var videoItem = repeaterWrapper.find('.video');
1053			var videoDescriptionItem = repeaterWrapper.find('.video-description');
1054			var video = videoItem.html();
1055			var videoDescription = videoDescriptionItem.text();
1056
1057			//console.log("video: " + video);
1058			//console.log("video secription: " + videoDescription);
1059
1060
1061
1062			var slideHTML = '<div class="swiper-slide">' +
1063				'<div class="b-video">' + video + '</div>' +
1064				'<div class="txt-video-name">' + videoDescription + '</div></div>';
1065
1066
1067			swiperWrapper.append(slideHTML);
1068
1069		});
1070
1071
1072		/* 		$.modaal({
1073					content_source: '.cult-talk-popup',
1074					type: 'inline',
1075					animation: 'fade'
1076				}); */
1077	});
1078});
1079
1080
1081
1082//cult talk show more
1083$(document).on('click', '.cult-talk-list-button', function (e) {
1084	e.preventDefault();
1085	var target_page = $('.cult-talk-list').attr('data-page');
1086	//$('.god-list').attr('data-page', target_page);
1087	target_page = parseInt(target_page) + 1;
1088	var cult_talk_section = $(this).parents(".cult-talk-list");
1089
1090	get_cult_talk_list(cult_talk_section, parseInt(target_page));
1091
1092});
1093
1094
1095
1096
1097
1098
1099
1100function get_song_list(song_list_section, current_page = 1) {
1101
1102	//console.log("get_song");
1103
1104	//console.log(current_page);
1105	var ajaxurl = song_list_section.attr("data-ajaxurl");
1106	var per_page = song_list_section.attr("data-perpage");
1107	var taxonomy_id = song_list_section.find('.song_list').val();
1108	// var keyword = song_list_section.find('.cult-talk-keyword').val();
1109	// console.log("keyword" + keyword);
1110
1111	var current_date = new Date();
1112
1113	jQuery.ajax({
1114		url: ajaxurl,
1115		data: {
1116			action: 'get_song_list',
1117			current_page: current_page,
1118			per_page: per_page,
1119			taxonomy_id: taxonomy_id,
1120
1121		},
1122		dataType: 'JSON',
1123		type: 'POST',
1124		success: function (result) {
1125			var html = '';
1126			var total_page = result.total_pages;
1127			//console.log(result);
1128			//console.log("total_page" + total_page);
1129			$('.song-list-button').show();
1130
1131			if (result.data != undefined) {
1132				for (var item of result.data) {
1133					html += '<div class="col col-12 col-md-6 col-lg-4 song-modal">';
1134					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
1135					html += '<div class="song-title" style="display: none">' + item.title + '</div>';
1136					html += '<div class="song-thumbnail" style="display: none">' + item.thumbnail + '</div>';
1137					html += '<div class="song-description" style="display: none">' + item.description + '</div>';
1138					// html += '<div class="talk-presenter" style="display: none">' + item.presenter + '</div>';
1139
1140					if (item.video_repeater != undefined) {
1141						for (var videoItem of item.video_repeater) {
1142							html += '<div class="video-item">';
1143							html += '<div class="video" style="display: none">' + videoItem.video + '</div>';
1144							html += '<div class="video-description" style="display: none">' + videoItem.video_description + '</div>';
1145							html += '</div>';
1146						}
1147					}
1148					html += '<div class="b-card b-card-video"><div class="box-img-title">';
1149
1150
1151					
1152						if (item.video_repeater) {
1153							if (item.video_repeater[0].video && item.video_repeater[0].video.match(/\/embed\/([^?"']+)/)) {
1154								var videoId = item.video_repeater[0].video.match(/\/embed\/([^?"']+)/)[1];
1155								//console.log("videoId: " + videoId);
1156								html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
1157							} else {
1158								html += '<div class="img-card"><img alt="' + item.title + '" src="' + item.default_thumbnail + '" /></div>';
1159							}
1160						
1161						
1162					} else {
1163						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.thumbnail + '></div>';
1164					}
1165
1166					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
1167					html += '<div class="ico ico-video"></div></div></div>';
1168					// html += '<div class="txt txt-card-desc">' + item.presenter + '</div>';
1169					html += '</div></a></div>';
1170
1171				}
1172
1173				$('.song-list .row-list').append(html);
1174				$('.song-list').attr('data-page', current_page);
1175
1176				$('[data-modaal-type="inline"]').modaal();
1177				if (current_page === total_page) {
1178					$('.song-list-button').hide();
1179				}
1180			}
1181		},
1182		error: function (result) {
1183			console.log('error from admin-ajax.js', result);
1184		}
1185	});
1186}
1187
1188//song open modal
1189jQuery(document).ready(function ($) {
1190	$(document).on('click', '.song-modal', function (e) {
1191		//console.log("clicked");
1192		e.preventDefault();
1193
1194		var title = $(this).find('.song-title').text();
1195		var description = $(this).find('.song-description').text();
1196		// var presenter = $(this).find('.talk-presenter').text();
1197
1198		//console.log(title);
1199		//console.log(description);
1200		// console.log(presenter);
1201
1202		//$('.b-video').html(video);
1203
1204		$('.song-popup .txt-subtitle-line').text(title);
1205		// $('.cult-talk-popup .txt-desc').text(presenter);
1206		$('.song-popup .txt-desc').text(description);
1207
1208		var swiperWrapper = $('.song-wrapper');
1209		swiperWrapper.empty();
1210
1211		$(this).find('.video-item').each(function () {
1212			var repeaterWrapper = $(this);
1213
1214			var videoItem = repeaterWrapper.find('.video');
1215			var videoDescriptionItem = repeaterWrapper.find('.video-description');
1216			var video = videoItem.html();
1217			var videoDescription = videoDescriptionItem.text();
1218
1219			//console.log("video: " + video);
1220			//console.log("video secription: " + videoDescription);
1221
1222
1223
1224			var slideHTML = '<div class="swiper-slide">' +
1225				'<div class="b-video">' + video + '</div>' +
1226				'<div class="txt-video-name">' + videoDescription + '</div></div>';
1227
1228
1229			swiperWrapper.append(slideHTML);
1230
1231		});
1232
1233
1234		/* 		$.modaal({
1235					content_source: '.song-popup',
1236					type: 'inline',
1237					animation: 'fade'
1238				}); */
1239	});
1240});
1241
1242
1243
1244//cult talk show more
1245$(document).on('click', '.song-list-button', function (e) {
1246	e.preventDefault();
1247	var target_page = $('.song-list').attr('data-page');
1248	//$('.god-list').attr('data-page', target_page);
1249	target_page = parseInt(target_page) + 1;
1250	var song_section = $(this).parents(".song-list");
1251
1252	get_song_list(song_section, parseInt(target_page));
1253
1254});
1255
1256
1257//tour open modal
1258jQuery(document).ready(function ($) {
1259	$(document).on('click', '.tour-modal', function (e) {
1260		//console.log("clicked");
1261		e.preventDefault();
1262
1263		var title = $(this).find('.tour-title').text();
1264		var description = $(this).find('.tour-description').text();
1265		var video = $(this).find('.tour-video').html();
1266		var provided_by = $(this).find('.tour-provided_by').text();
1267		$('.tour-popup .video-provider').text("");
1268
1269
1270		$('.b-video').html(video);
1271
1272		$('.tour-popup .txt-subtitle-line').text(title);
1273		$('.tour-popup .txt-desc').html(description);
1274
1275		if (provided_by && provided_by !== "null") {
1276			$('.tour-popup .video-provider').text(provided_by);
1277		}
1278
1279
1280		/* 		$.modaal({
1281					content_source: '.tour-popup',
1282					type: 'inline',
1283					animation: 'fade'
1284				}); */
1285	});
1286});
1287
1288
1289
1290//tour show more
1291$(document).on('click', '.tour-list-button', function () {
1292	var target_page = $('.tour-list').attr('data-page');
1293	//$('.god-list').attr('data-page', target_page);
1294	target_page = parseInt(target_page) + 1;
1295	var tour_section = $(this).parents(".tour-list");
1296
1297	get_tour_list(tour_section, parseInt(target_page));
1298
1299});
1300
1301
1302
1303function get_tour_list(tour_list_section, current_page = 1) {
1304
1305	console.log("get_tour");
1306
1307	console.log(current_page);
1308	var ajaxurl = tour_list_section.attr("data-ajaxurl");
1309	var per_page = tour_list_section.attr("data-perpage");
1310
1311	var current_date = new Date();
1312
1313	jQuery.ajax({
1314		url: ajaxurl,
1315		data: {
1316			action: 'get_tour_list',
1317			current_page: current_page,
1318			per_page: per_page,
1319		},
1320		dataType: 'JSON',
1321		type: 'POST',
1322		success: function (result) {
1323			var html = '';
1324			var total_page = result.total_pages;
1325			//console.log(result);
1326			//console.log("total_page" + total_page);
1327
1328			if (result.data != undefined) {
1329				for (var item of result.data) {
1330
1331
1332					html += '<div class="col col-12 col-md-6 col-lg-4 tour-modal">';
1333					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
1334					html += '<div class="tour-title" style="display: none">' + item.title + '</div>';
1335					html += '<div class="tour-description" style="display: none">' + item.description + '</div>';
1336					html += '<div class="tour-video" style="display: none">' + item.video + '</div>';
1337					//html += '<div class="tour-provided_by" style="display: none">' + item.provided_by + '</div>';
1338					html += '<div class="b-card b-card-video"><div class="box-img-title">';
1339					if (!item.image) {
1340						if (item.video && item.video.match(/embed\/([^?"']+)/)) {
1341							var videoId = item.video.match(/embed\/([^?"']+)/)[1];
1342							//console.log("videoId" + videoId);
1343							html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
1344						} else {
1345
1346							html += '<div class="img-card"><img alt="' + item.title + '" src="' + item.default_thumbnail + '" /></div>';
1347						}
1348					} else {
1349						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.image + '></div>';
1350					}
1351
1352					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
1353					html += '<div class="ico ico-video"></div></div></div>';
1354					html += '<div class="txt txt-card-desc">' + item.description + '</div>';
1355					html += '</div></a></div>';
1356				}
1357
1358				$('.tour-list .row-list').append(html);
1359				$('.tour-list').attr('data-page', current_page);
1360
1361				$('[data-modaal-type="inline"]').modaal();
1362
1363				if (current_page === total_page) {
1364					$('.tour-list-button').hide();
1365				}
1366			}
1367		},
1368		error: function (result) {
1369			console.log('error from admin-ajax.js', result);
1370		}
1371	});
1372}
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383// menu committee link
1384const urlParams = new URLSearchParams(window.location.search);
1385const tab = urlParams.get('tab');
1386
1387if (tab) {
1388	const tabs = document.querySelectorAll('.txt-tab');
1389	tabs.forEach(tab => tab.classList.remove('active'));
1390
1391	const activeTab = document.querySelector(`[data-tab-id="${tab}"]`);
1392	if (activeTab) {
1393		activeTab.classList.add('active');
1394	}
1395}
1396
1397
1398function updateCommitteeBreadcumb() {
1399
1400	if (window.location.href.includes('committee-intro')) {
1401		const activeTab = document.querySelector('.txt-tab.active');
1402		const breadcrumb = document.querySelector('.nav-breadcrumb');
1403
1404		if (activeTab && breadcrumb) {
1405			const lastBreadcrumbItem = breadcrumb.lastElementChild;
1406			const activeTabDataTabId = activeTab.getAttribute('data-tab-id');
1407			const base_url = window.location.href.split("?")[0];
1408			const url = base_url + '?tab=' + activeTabDataTabId;
1409			lastBreadcrumbItem.textContent = activeTab.textContent;
1410
1411			const link = document.createElement('a');
1412			link.href = url;
1413			link.textContent = activeTab.textContent;
1414
1415			lastBreadcrumbItem.innerHTML = '';
1416			lastBreadcrumbItem.appendChild(link);
1417		}
1418	} else {
1419		return;
1420	}
1421
1422}
1423
1424updateCommitteeBreadcumb();
1425
1426const tabs = document.querySelectorAll('.txt-tab');
1427
1428tabs.forEach(tab => {
1429	tab.addEventListener('click', e => {
1430		setTimeout(() => {
1431			updateCommitteeBreadcumb();
1432		}, 0);
1433	});
1434});
1435
1436var map_swiper = new Swiper('.map-swiper-container', {
1437});
1438
1439
1440//graphic map open modal
1441jQuery(document).ready(function ($) {
1442	$(document).on('click', '.graphic-map', function (e) {
1443		//console.log("clicked");
1444		e.preventDefault();
1445
1446		/* 		$.modaal({
1447					content_source: '.graphic-map-popup',
1448					type: 'inline',
1449					animation: 'fade'
1450				}); */
1451	});
1452});
1453
1454
1455
1456
1457var graphic_map = document.querySelector('.page-template-page-temple-list .graphic-map-image');
1458var clicked = false;
1459
1460if (graphic_map) {
1461	graphic_map.addEventListener('click', function () {
1462		//console.log("map clicked");
1463		var container = document.querySelector('.page-template-page-temple-list .modaal-container');
1464		var img = document.querySelector('.page-template-page-temple-list .modaal-container img');
1465
1466		if (!clicked) {
1467			container.style.maxWidth = '100%';
1468			img.style.width = '100%';
1469			img.style.cursor = '-webkit-zoom-out';
1470			img.style.cursor = 'zoom-out';
1471
1472			clicked = true;
1473		} else {
1474			container.style.maxWidth = '80%';
1475			img.style.width = '70%';
1476			img.style.cursor = '-webkit-zoom-in';
1477			img.style.cursor = 'zoom-in';
1478			clicked = false;
1479		}
1480	});
1481}
1482
1483
1484
1485
1486
1487document.querySelectorAll('.suggest-temple').forEach(function (button) {
1488	button.addEventListener('click', function () {
1489		var inputField = document.querySelector('.search-temple-form .form-input');
1490		//console.log(inputField.value);
1491		var temple_name = this.querySelector('.suggest-temple-name');
1492		inputField.value = temple_name.textContent;
1493	});
1494});
1495
1496
1497
1498	
1499
1500
1501//aerial open modal
1502jQuery(document).ready(function ($) {
1503	$(document).on('click', '.aerial-modal', function (e) {
1504		console.log("clicked");
1505		e.preventDefault();
1506
1507		var title = $(this).find('.aerial-title').text();
1508		//console.log(title);
1509		var description = $(this).find('.aerial-description').text();
1510		//console.log(description);
1511		var video = $(this).find('.aerial-video').html();
1512		var provided_by = $(this).find('.aerial-provided_by').text();
1513		$('.aerial-popup .video-provider').text("");
1514
1515		//console.log(('.aerial-txt-subtitle-line'));
1516		$('.b-video').html(video);
1517
1518		$('.txt-subtitle-line').text(title);
1519		$('.txt-desc').html(description);
1520
1521		if (provided_by && provided_by !== "null") {
1522			$('.aerial-popup .video-provider').text(provided_by);
1523		}
1524
1525
1526		/* 		$.modaal({
1527					content_source: '.tour-popup',
1528					type: 'inline',
1529					animation: 'fade'
1530				}); */
1531	});
1532});
1533
1534
1535
1536//aerial show more
1537$(document).on('click', '.aerial-list-button', function () {
1538	var target_page = $('.aerial-list').attr('data-page');
1539	//$('.god-list').attr('data-page', target_page);
1540	target_page = parseInt(target_page) + 1;
1541	var aerial_section = $(this).parents(".aerial-list");
1542
1543	get_aerial_list(aerial_section, parseInt(target_page));
1544
1545});
1546
1547
1548
1549function get_aerial_list(aerial_list_section, current_page = 1) {
1550
1551	//console.log("get_aerial");
1552
1553	//console.log(current_page);
1554	var ajaxurl = aerial_list_section.attr("data-ajaxurl-aerial");
1555	var per_page = aerial_list_section.attr("data-perpage-aerial");
1556
1557	var current_date = new Date();
1558
1559	jQuery.ajax({
1560		url: ajaxurl,
1561		data: {
1562			action: 'get_aerial_list',
1563			current_page: current_page,
1564			per_page: per_page,
1565		},
1566		dataType: 'JSON',
1567		type: 'POST',
1568		success: function (result) {
1569			var html = '';
1570			var total_page = result.total_pages;
1571			//console.log(result);
1572			//console.log("total_page" + total_page);
1573
1574			if (result.data != undefined) {
1575				for (var item of result.data) {
1576
1577
1578					html += '<div class="col col-12 col-md-6 col-lg-4 aerial-modal">';
1579					html += '<a href="#popup_video" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">';
1580					html += '<div class="aerial-title" style="display: none">' + item.title + '</div>';
1581					html += '<div class="aerial-description" style="display: none">' + item.description + '</div>';
1582					html += '<div class="aerial-video" style="display: none">' + item.video + '</div>';
1583					//html += '<div class="tour-provided_by" style="display: none">' + item.provided_by + '</div>';
1584					html += '<div class="b-card b-card-video"><div class="box-img-title">';
1585					if (!item.image) {
1586						if (item.video && item.video.match(/embed\/([^?"']+)/)) {
1587							var videoId = item.video.match(/embed\/([^?"']+)/)[1];
1588							//console.log("videoId" + videoId);
1589							html += '<div class="img-card"><img alt="' + item.title + '" src="https://img.youtube.com/vi/' + videoId + '/mqdefault.jpg" /></div>';
1590						} else {
1591
1592							html += '<div class="img-card"><img alt="' + item.title + '" src="' + item.default_thumbnail + '" /></div>';
1593						}
1594					} else {
1595						html += '<div class="img-card"><img alt="' + item.title + '" src=' + item.image + '></div>';
1596					}
1597
1598					html += '<div class="box-ctx"><div class="txt txt-card-title">' + item.title + '</div>';
1599					html += '<div class="ico ico-video"></div></div></div>';
1600					html += '<div class="txt txt-card-desc">' + item.description + '</div>';
1601					html += '</div></a></div>';
1602				}
1603
1604				$('.aerial-list .row-list').append(html);
1605				$('.aerial-list').attr('data-page', current_page);
1606
1607				$('[data-modaal-type="inline"]').modaal();
1608
1609				if (current_page === total_page) {
1610					$('.aerial-list-button').hide();
1611				}
1612			}
1613		},
1614		error: function (result) {
1615			console.log('error from admin-ajax.js', result);
1616		}
1617	});
1618}
1619
1620$( document ).ready(function() {
1621$('.s-header .row-ctrl .btn-search').on("click", function() {
1622	//console.log("clicked");
1623	document.getElementsByName("keyword")[0].focus();
1624})
1625
1626})
1627
1628document.addEventListener('DOMContentLoaded', function() {
1629    let wpadminbar_elements = document.querySelectorAll('#wpadminbar *');
1630    for (let i = 0; i < wpadminbar_elements.length; i++) {
1631        wpadminbar_elements[i].setAttribute('tabindex', '-1');
1632    }
1633
1634
1635
1636//change comma style in sc home banner 
1637	var htmlTag = document.documentElement;
1638if (htmlTag.getAttribute('lang') == 'zh-Hans') {
1639    var box_txt = document.querySelector('.s-banner .txt2')
1640    if(box_txt) {
1641        var box_txt_text = box_txt.innerText;
1642        var modified_text = '';
1643        for (var i = 0; i < box_txt_text.length; i++) {
1644            var char = box_txt_text[i];
1645            if (char === ',') {
1646                modified_text += '<span class="comma">,</span>';
1647            } else {
1648                modified_text += char;
1649            }
1650        }
1651        box_txt.innerHTML = modified_text;
1652    }
1653}
1654});
1655
1656$(document).ready(function() {
1657    $('#wp-admin-bar-elementor_edit_page a').attr('tabindex', '-1');
1658	
1659	$(".popmake-content p:has(> img)").css({
1660		"text-align": "center"
1661	});
1662
1663/* 	const printButton = document.querySelector('.btn-print');
1664	printButton.addEventListener('click', () => {
1665	  window.print();
1666	}); */
1667});
1668
1669
1670
1671
1672

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.