PageSourceSearch

https://capsa.ca/2023/wp-content/plugins/wp-team-pro/src/Frontend/js/script.js?ver=3.2.4

js capsa.ca collected 2026-10-03 20:26:37 UTC 70,372 bytes, 1,827 lines download raw bytes

1jQuery(document).ready(function ($) {
2	if ($('.sp-team-pro').length > 0) {
3
4		function SwiperSlide(selector, options) {
5			if (parseInt(sptp_vars.sptp_swiper) === 1) {
6				return new SPTPSwiper(selector, options);
7			} else {
8				return new Swiper(selector, options);
9			}
10
11		}
12		// Lazy-load scripts.
13		function wpteam_lazyload() {
14			// Find all images with the class 'wpteam_lazyload'.
15			var $lazyImages = $("img.wpteam_lazyload");
16
17			// Check if there are any lazy-loaded images.
18			if ($lazyImages.length > 0) {
19				$lazyImages.each(function () {
20					var $image = $(this);
21					// Apply lazy loading with fadeIn effect.
22					$image.wp_team_lazyload({
23						effect: "fadeIn",
24						effectTime: 2000,
25						appear: function () {
26							// Set the 'srcset' attribute to the 'data-wpteam_srcset' value and remove the 'data-wpteam_srcset' attribute since it's no longer needed.
27							$(this).attr('srcset', $(this).attr('data-wpteam_srcset')).removeAttr('data-wpteam_srcset');
28
29							// Add the 'wpteam_lazyloaded' class after the image is loaded and appeared.
30							$(this).removeClass('wpteam_lazyload').addClass('wpteam_lazyloaded');
31						}
32					});
33				});
34			}
35		}
36
37		// Team stuffs init
38		$('.sp-team-pro').each(function () {
39			var sptp_container = $(this),
40				sptp_container_id = sptp_container.attr('id'),
41				sptp_Wrapper_ID = '#' + sptp_container_id,
42				sptpSwiper,
43				sptpTicker;
44			// Carousel.
45			function carouselSlide() {
46				// Carousel ticker init.
47				if (sptpCarousel.mode === "ticker") {
48					var ticker_carousel_items = $(".sptp-main-carousel .swiper-wrapper", sptp_Wrapper_ID).find('.sp-team-pro-item').length;
49					var tickerSpeed = sptpCarousel.speed * ticker_carousel_items;
50					// Ticker Direction class add.
51					if ($('body').hasClass('rtl')) {
52						$(sptp_Wrapper_ID + " .swiper-container").addClass('sptp-dir');
53					}
54					sptpTicker = $(".sptp-main-carousel .swiper-wrapper", sptp_Wrapper_ID).bxSlider({
55						ticker: true,
56						tickerHover: sptpCarousel.stop_onhover,
57						speed: tickerSpeed,
58						easing: null,
59						slideWidth: 280,
60						slideMargin: sptpCarousel.spaceBetween,
61						minSlides: sptpCarousel.min_item,
62						maxSlides: sptpCarousel.items,
63						moveSlides: sptpCarousel.items,
64						shrinkItems: false,
65						auto: false,
66						autoDirection: sptpCarousel.direction,
67					});
68					$('.sptp-main-carousel', sptp_Wrapper_ID).css('opacity', 1);
69					$(sptp_Wrapper_ID + ' .bx-wrapper .sptp-member-avatar-img-area img').removeAttr('loading');
70				}
71				// Carousel standard.
72				if (sptpCarousel.mode !== "ticker") {
73					var carousel_items = $(sptp_Wrapper_ID).find('.swiper-slide:not(.swiper-slide-duplicate)').length,
74						dragScrollSize = (($(sptp_Wrapper_ID).width()) / carousel_items),
75						type = {};
76					if (sptpCarousel.pagination_type === 'fraction') {
77						type = {
78							type: 'fraction',
79						}
80					}
81
82					var desktopScreen = sptpCarousel.breakpoints.desktop_screen_size,
83						laptopScreen = sptpCarousel.breakpoints.laptop_screen_size,
84						tabletScreen = sptpCarousel.breakpoints.tablet_screen_size,
85						mobileScreen = sptpCarousel.breakpoints.mobile_screen_size,
86						fade_mode = (sptpCarousel.fade_mode == 1) && (sptpCarousel.mode === 'standard') ? 'fade' : 'slider',
87						fade_mode = sptpCarousel.mode === 'thumbnails-slider' ? 'thumbnails-slider' : fade_mode;
88
89					if ('slider' === fade_mode) {
90						sptpSwiper = SwiperSlide(sptp_Wrapper_ID + " .sptp-main-carousel", {
91							speed: sptpCarousel.speed,
92							slidesPerView: sptpCarousel.breakpoints.mobile,
93							slidesPerGroup: sptpCarousel.breakpoints.mobile_pSlide,
94							spaceBetween: sptpCarousel.spaceBetween,
95							grid: {
96								rows: sptpCarousel.breakpoints.mobile_row,
97								fill: 'row',
98							},
99							autoplay: sptpCarousel.autoplay ? ({ delay: sptpCarousel.autoplay_speed, disableOnInteraction: false }) : false,
100							preloadImages: false,
101							freeMode: sptpCarousel.freeMode,
102							observer: true,
103							observeParents: true,
104							runCallbacksOnInit: false,
105							initialSlide: 0,
106							loop: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.loop,
107							mousewheel: sptpCarousel.mouse_wheel,
108							simulateTouch: sptpCarousel.simulateTouch,
109							allowTouchMove: sptpCarousel.allowTouchMove,
110							autoHeight: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.autoHeight,
111							centeredSlides: sptpCarousel.mode === 'center' ? true : false,
112							// If we need pagination
113							pagination: sptpCarousel.pagination_type !== 'scrollbar' ? {
114								el: sptp_Wrapper_ID + " .sptp-main-carousel .swiper-pagination",
115								clickable: true,
116								dynamicBullets: 'dynamic' == sptpCarousel.pagination_type ? true : false,
117								renderBullet: sptpCarousel.pagination_type === 'numbers' ? function (index, className) {
118									return '<span class="' + className + '"><span class="number">' + (index + 1) + "</span> </span>";
119								} : '',
120								...type,
121								renderFraction: sptpCarousel.pagination_type === 'fraction' ? function (currentClass, totalClass) {
122									return '<div class="sptp-swiper-pagination-fraction"><span class="' + currentClass + '"></span>' +
123										' / ' +
124										'<span class="' + totalClass + '"></span></div>';
125								} : '',
126							} : false,
127							scrollbar: {
128								el: sptp_Wrapper_ID + " .sptp-pagination-scrollbar",
129								draggable: true,
130								dragSize: dragScrollSize,
131							},
132							navigation: {
133								nextEl: sptp_Wrapper_ID + " .sptp-main-carousel .sptp-button-next",
134								prevEl: sptp_Wrapper_ID + " .sptp-main-carousel  .sptp-button-prev"
135							},
136							breakpoints: {
137								[mobileScreen]: {
138									slidesPerView: sptpCarousel.breakpoints.mobile,
139									slidesPerGroup: sptpCarousel.breakpoints.mobile_pSlide,
140									grid: {
141										rows: sptpCarousel.breakpoints.mobile_row,
142										fill: 'row',
143									},
144								},
145								[tabletScreen]: {
146									slidesPerView: sptpCarousel.breakpoints.tablet,
147									slidesPerGroup: sptpCarousel.breakpoints.tablet_pSlide,
148									grid: {
149										rows: sptpCarousel.breakpoints.tablet_row,
150										fill: 'row',
151									},
152								},
153								[laptopScreen]: {
154									slidesPerView: sptpCarousel.breakpoints.laptop,
155									slidesPerGroup: sptpCarousel.breakpoints.laptop_pSlide,
156									grid: {
157										rows: sptpCarousel.breakpoints.laptop_row,
158										fill: 'row',
159									},
160								},
161								[desktopScreen]: {
162									slidesPerView: sptpCarousel.breakpoints.desktop,
163									slidesPerGroup: sptpCarousel.breakpoints.desktop_pSlide,
164									grid: {
165										rows: sptpCarousel.breakpoints.desktop_row,
166										fill: 'row',
167									},
168								}
169							},
170							ally: {
171								enabled: sptpCarousel.enabled,
172								prevSlideMessage: sptpCarousel.prevSlideMessage,
173								nextSlideMessage: sptpCarousel.nextSlideMessage,
174								firstSlideMessage: sptpCarousel.firstSlideMessage,
175								lastSlideMessage: sptpCarousel.lastSlideMessage,
176								paginationBulletMessage: sptpCarousel.paginationBulletMessage
177							},
178							keyboard: {
179								enabled: true
180							}
181						});
182					} else if ('thumbnails-slider' === fade_mode) {
183						if (!$(sptp_Wrapper_ID + ' .sptp-main-carousel').hasClass('swiper-initialized')) {
184							var contentCarousel = $(sptp_Wrapper_ID + ' .sptp-thumbnail-slider-content-section');
185							var item = contentCarousel.find(".swiper-wrapper .sp-team-pro-item:not(.swiper-slide-duplicate)").length;
186							var galleryThumbs = SwiperSlide(sptp_Wrapper_ID + " .sptp-thumbnail-slider-thumb-section", {
187								slidesPerView: sptpCarousel.items,
188								spaceBetween: sptpCarousel.spaceBetween,
189								preloadImages: false,
190								autoplay: false,
191								freeMode: sptpCarousel.freeMode,
192								observer: true,
193								watchSlidesProgress: true,
194								slidesPerGroup: 1,
195								loop: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.loop,
196								mousewheel: sptpCarousel.mouse_wheel,
197								simulateTouch: sptpCarousel.simulateTouch,
198								allowTouchMove: sptpCarousel.allowTouchMove,
199								centeredSlides: true,
200								loopedSlides: item,
201								slideToClickedSlide: true,
202								// If we need pagination
203								navigation: false,
204								pagination: false,
205								breakpoints: {
206									[mobileScreen]: {
207										slidesPerView: sptpCarousel.breakpoints.mobile,
208									},
209									[tabletScreen]: {
210										slidesPerView: sptpCarousel.breakpoints.tablet,
211									},
212									[laptopScreen]: {
213										slidesPerView: sptpCarousel.breakpoints.laptop,
214									},
215									[desktopScreen]: {
216										slidesPerView: sptpCarousel.breakpoints.desktop,
217									}
218								},
219							});
220							var galleryContent = SwiperSlide(sptp_Wrapper_ID + " .sptp-thumbnail-slider-content-section", {
221								speed: sptpCarousel.speed,
222								slidesPerView: 1,
223								slidesPerGroup: 1,
224								spaceBetween: sptpCarousel.spaceBetween,
225								loop: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.loop,
226								loopedSlides: item,
227								grabCursor: true,
228								centeredSlides: true,
229								autoplay: sptpCarousel.autoplay ? ({ delay: sptpCarousel.autoplay_speed, disableOnInteraction: false }) : false,
230								preloadImages: false,
231								freeMode: sptpCarousel.freeMode,
232								observer: true,
233								runCallbacksOnInit: false,
234								slidesPerGroup: sptpCarousel.per_slide,
235								initialSlide: 0,
236								loop: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.loop,
237								mousewheel: sptpCarousel.mouse_wheel,
238								simulateTouch: sptpCarousel.simulateTouch,
239								allowTouchMove: sptpCarousel.allowTouchMove,
240								autoHeight: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.autoHeight,
241								// If we need pagination
242								pagination: sptpCarousel.pagination_type !== 'scrollbar' ? {
243									el: sptp_Wrapper_ID + " .sptp-main-carousel .swiper-pagination",
244									clickable: true,
245									dynamicBullets: 'dynamic' == sptpCarousel.pagination_type ? true : false,
246									renderBullet: sptpCarousel.pagination_type === 'numbers' ? function (index, className) {
247										return '<span class="' + className + '"><span class="number">' + (index + 1) + "</span> </span>";
248									} : '',
249									...type,
250									renderFraction: sptpCarousel.pagination_type === 'fraction' ? function (currentClass, totalClass) {
251										return '<div class="sptp-swiper-pagination-fraction"><span class="' + currentClass + '"></span>' +
252											' / ' +
253											'<span class="' + totalClass + '"></span></div>';
254									} : '',
255								} : false,
256								scrollbar: {
257									el: sptp_Wrapper_ID + " .sptp-pagination-scrollbar",
258									draggable: true,
259									dragSize: dragScrollSize,
260								},
261								navigation: {
262									nextEl: sptp_Wrapper_ID + " .sptp-main-carousel .sptp-button-next",
263									prevEl: sptp_Wrapper_ID + " .sptp-main-carousel  .sptp-button-prev"
264								},
265								ally: {
266									enabled: sptpCarousel.enabled,
267									prevSlideMessage: sptpCarousel.prevSlideMessage,
268									nextSlideMessage: sptpCarousel.nextSlideMessage,
269									firstSlideMessage: sptpCarousel.firstSlideMessage,
270									lastSlideMessage: sptpCarousel.lastSlideMessage,
271									paginationBulletMessage: sptpCarousel.paginationBulletMessage
272								},
273								keyboard: {
274									enabled: true
275								},
276								fadeEffect: {
277									crossFade: true,
278								},
279
280							});
281
282							galleryContent.controller.control = galleryThumbs;
283							galleryThumbs.controller.control = galleryContent;
284							if (sptpCarousel.autoplay === false) {
285								galleryThumbs.autoplay.stop()
286								galleryContent.autoplay.stop()
287							}
288							if (sptpCarousel.stop_onhover && sptpCarousel.autoplay) {
289								$(contentCarousel).on({
290									mouseenter: function () {
291										galleryContent.autoplay.stop()
292										galleryThumbs.autoplay.stop()
293									},
294									mouseleave: function () {
295										galleryContent.autoplay.start()
296										galleryThumbs.autoplay.start()
297									}
298								});
299							}
300						}
301					} else if ('fade' === fade_mode) {
302						var sptpFadeItem = $(sptp_Wrapper_ID + " .sptp-fade-carousel").data("responsive");
303						var slidePerView = sptpFadeItem.desktop
304						if ($(window).width() > desktopScreen) {
305							slidePerView = sptpFadeItem.desktop
306						} else if ($(window).width() > laptopScreen) {
307							slidePerView = sptpFadeItem.laptop
308						} else if ($(window).width() > tabletScreen) {
309							slidePerView = sptpFadeItem.tablet
310						} else if ($(window).width() > 0) {
311							slidePerView = sptpFadeItem.mobile
312						}
313						$(sptp_Wrapper_ID + " .sptp-fade-carousel .sp-team-pro-item").css('width', 100 / slidePerView + '%');
314
315						var fade_items = $(sptp_Wrapper_ID + " .sptp-fade-carousel .swiper-wrapper >.sp-team-pro-item");
316						for (var i = 0; i < fade_items.length; i += slidePerView) {
317							fade_items.slice(i, i + slidePerView).wrapAll('<div class="swiper-slide"></div>');
318						}
319						var carousel_items = $(sptp_Wrapper_ID).find('.swiper-slide').length,
320							dragScrollSize = (($(sptp_Wrapper_ID).width()) / carousel_items);
321						sptpSwiper = SwiperSlide(sptp_Wrapper_ID + " .sptp-fade-carousel", {
322							speed: sptpCarousel.speed,
323							autoplay: sptpCarousel.autoplay ? ({ delay: sptpCarousel.autoplay_speed }) : false,
324							preloadImages: false,
325							observer: true,
326							runCallbacksOnInit: false,
327							effect: 'fade',
328							fadeEffect: {
329								crossFade: true
330							},
331							initialSlide: 0,
332							loop: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.loop,
333							mousewheel: sptpCarousel.mouse_wheel,
334							simulateTouch: sptpCarousel.simulateTouch,
335							allowTouchMove: sptpCarousel.allowTouchMove,
336							autoHeight: (sptpCarousel.breakpoints.desktop_row > '1' || sptpCarousel.breakpoints.laptop_row > '1' || sptpCarousel.breakpoints.tablet_row > '1' || sptpCarousel.breakpoints.mobile_row > '1') ? false : sptpCarousel.autoHeight,
337							centeredSlides: sptpCarousel.mode === 'center' ? true : false,
338							pagination: sptpCarousel.pagination_type !== 'scrollbar' ? {
339								el: sptp_Wrapper_ID + " .sptp-main-carousel .swiper-pagination",
340								clickable: true,
341								dynamicBullets: 'dynamic' == sptpCarousel.pagination_type ? true : false,
342								renderBullet: sptpCarousel.pagination_type === 'numbers' ? function (index, className) {
343									return '<span class="' + className + '"><span class="number">' + (index + 1) + "</span> </span>";
344								} : '',
345								...type,
346								renderFraction: sptpCarousel.pagination_type === 'fraction' ? function (currentClass, totalClass) {
347									return '<div class="sptp-swiper-pagination-fraction"><span class="' + currentClass + '"></span>' +
348										' / ' +
349										'<span class="' + totalClass + '"></span></div>';
350								} : '',
351							} : false,
352							scrollbar: {
353								el: sptp_Wrapper_ID + " .sptp-pagination-scrollbar",
354								draggable: true,
355								dragSize: dragScrollSize,
356							},
357							navigation: {
358								nextEl: sptp_Wrapper_ID + " .sptp-main-carousel .sptp-button-next",
359								prevEl: sptp_Wrapper_ID + " .sptp-main-carousel  .sptp-button-prev"
360							},
361							ally: {
362								enabled: sptpCarousel.enabled,
363								prevSlideMessage: sptpCarousel.prevSlideMessage,
364								nextSlideMessage: sptpCarousel.nextSlideMessage,
365								firstSlideMessage: sptpCarousel.firstSlideMessage,
366								lastSlideMessage: sptpCarousel.lastSlideMessage,
367								paginationBulletMessage: sptpCarousel.paginationBulletMessage
368							},
369							keyboard: {
370								enabled: true
371							}
372						});
373						sptp_item_same_height()
374					}
375
376					$('.sptp-main-carousel', sptp_Wrapper_ID).css('opacity', 1);
377					// Carousel stop on hover.
378					if ('thumbnails-slider' !== fade_mode) {
379						if (sptpCarousel.stop_onhover && sptpCarousel.autoplay) {
380							$(sptp_Wrapper_ID + " .sptp-main-carousel").on({
381								mouseenter: function () {
382									sptpSwiper.autoplay.stop();
383								},
384								mouseleave: function () {
385									sptpSwiper.autoplay.start();
386								}
387							});
388						}
389						sptpSwiper.on('slideChange', function () {
390							$(window).trigger('resize');
391						})
392					}
393				}
394
395			}
396			if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
397				var sptpCarousel = $('.sptp-main-carousel', sptp_Wrapper_ID).data(
398					"carousel"
399				);
400				carouselSlide();
401			}
402
403			// Team stuffs init
404			function accordion_init() {
405				$(sptp_Wrapper_ID + ' .sptp-accordion-single-title').off('click').on('click', function () {
406					var currentItem = $(this).parent();
407					var isOpen = currentItem.hasClass('is-open');
408					$(sptp_Wrapper_ID + ' .sptp-accordion-single-item').not(currentItem).removeClass('is-open').find('.sptp-accordion-single-content').slideUp();
409					if (!isOpen) {
410						currentItem.addClass('is-open').find('.sptp-accordion-single-content').slideDown();
411					} else {
412						currentItem.removeClass('is-open').find('.sptp-accordion-single-content').slideUp();
413					}
414				});
415			}
416			if ($(sptp_Wrapper_ID + " .sptp-accordion").length > 0) {
417				accordion_init();
418			}
419
420			// Same height option
421			function sptp_item_same_height() {
422				var maxHeight = 0;
423				$(sptp_Wrapper_ID + '.sptp_item_same_height .sp-team-pro-item').each(function () {
424					if ($(this).find('.sptp-member').height() > maxHeight) {
425						maxHeight = $(this).find('.sptp-member').height();
426					}
427				})
428				$(sptp_Wrapper_ID + '.sptp_item_same_height .sptp-member').height(maxHeight);
429			}
430			sptp_item_same_height();
431
432			// Progress bar animation on loading.
433			function progressBarAnimation() {
434				$(".sptp-progress-container", sptp_Wrapper_ID).each(function () {
435					var percent = $(this).data("title");
436					$(this)
437						.find(".sptp-progress-bar")
438						.animate({
439							width: percent
440						},
441							1000
442						);
443					var percentInt = parseInt(percent);
444					if (percentInt >= 95) {
445						$(this)
446							.find(".sptp-top")
447							.css("right", 0);
448					}
449					if (percentInt === 100) {
450						$(this)
451							.find(".sptp-top")
452							.css("width", "40px");
453					}
454				});
455			}
456			// Icon on hover.
457			function iconOnImage() {
458				$(document).on({
459					mouseenter: function () {
460						$(this)
461							.find(".sptp-icon")
462							.animate({
463								opacity: 1
464							},
465								50
466							);
467					},
468					mouseleave: function () {
469						$(this)
470							.find(".sptp-icon")
471							.animate({
472								opacity: 0
473							},
474								50
475							);
476					}
477				},
478					".sptp-icon-on-image"
479				);
480			}
481			// Content over image animation class adding function.
482			function contentOverImage() {
483				$(".sptp-content-on-image", sptp_Wrapper_ID).on({
484					mouseenter: function () {
485						$(this)
486							.find(".sptp-content")
487							.addClass("animation");
488					},
489					mouseleave: function () {
490						$(this)
491							.find(".sptp-content")
492							.removeClass("animation");
493					}
494				});
495			}
496			// Run progress bar animation.
497			progressBarAnimation();
498			// iconOnImage();
499			contentOverImage();
500
501			// REMOVE AND ADD CLICK EVENT
502			$(".doAddItem").on("click", function () {
503				$(".gridder")
504					.data("gridderExpander")
505					.gridderAddItem("TEST");
506			});
507
508			// Gridder init function.
509			function sptp_gridder_init() {
510				var firstDrawerAttr = $(".gridder", sptp_Wrapper_ID).find('.sp-team-pro-item').data('first-drawer');
511				if ($(".gridder", sptp_Wrapper_ID).length > 0) {
512					$(".gridder", sptp_Wrapper_ID).gridderExpander({
513						scrollOffset: 60,
514						scrollTo: "panel", // "panel" or "listitem"
515						animationSpeed: 400,
516						animationEasing: "easeInOutExpo",
517						nextText: "<i class='fa fa-angle-right'></i>", // Next button text
518						prevText: "<i class='fa fa-angle-left'></i>", // Previous button text
519						closeText: "",
520						onContent: function (object) {
521							$(object).find(".sptp-left-content");
522						},
523						onExpanded: function (object) { },
524						onChanged: function (object) { },
525						onClosed: function () { }
526					});
527				}
528
529				if ('1' == firstDrawerAttr) {
530					$(sptp_Wrapper_ID + " .sptp-row.gridder").css("display", "inline-block");
531					var button = $(".gridder", sptp_Wrapper_ID).find(".gridder-list:nth-child(1)");
532					$(button).trigger('click', false);
533					// Run progress bar animation.
534					progressBarAnimation();
535				}
536			}
537			sptp_gridder_init()
538
539			// Masonry initialize.
540			function sptp_masonry_init() {
541				var masonry = $(sptp_Wrapper_ID + ".sptp-masonry .sptp-row");
542				if (masonry.length > 0 && $.fn.masonry) {
543					masonry.masonry(); // Masonry
544					masonry.imagesLoaded(function () {
545						masonry.masonry(); // Masonry
546					});
547				}
548			};
549			sptp_masonry_init();
550
551			// Filter Layout.
552			var $sptpgrid;
553			if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
554				$(sptp_Wrapper_ID + ".sptp-filter").each(function () {
555					var sptpGeneratorID = $(this).attr("id");
556					var isopope_selector = $(sptp_Wrapper_ID + ' .sptp-filter-grid');
557					var filter_style = isopope_selector.data('layout_mode');
558					var layoutMode = 'fitRows';
559					if (filter_style == 'masonry') {
560						layoutMode = 'masonry';
561					}
562					$sptpgrid = isopope_selector.isotope({
563						// itemSelector: '.element-item',
564						layoutMode: layoutMode,
565						stamp: '.element-item--static',
566						itemSelector: '[data-category]'
567					});
568
569					function isotope_init() {
570						$(window).on('load', function () {
571							$sptpgrid.isotope('layout');
572						});
573						isopope_selector.imagesLoaded(function () {
574							$sptpgrid.isotope('layout');
575						});
576
577					}
578
579					// Flatten object by concatenation values.
580					function concatValues(obj) {
581						var value = ''
582						for (var prop in obj) {
583							value += obj[prop]
584						}
585						return value;
586					}
587					// bind filter button click
588					var filters = {}
589					$(sptp_Wrapper_ID + ' .filters-button-group').on('click', 'button', function (event) {
590						var $button = $(event.currentTarget);
591						var $taxonomyGroup = $button.parents('.filters-button-group')
592						var filterGroup = $taxonomyGroup.attr('data-filter-group')
593
594						filters[filterGroup] = $button.attr('data-filter')
595						// Combine filters
596						var filterValue = concatValues(filters);
597						// set filter for Isotope and update the count after filtering is done and filtering data.
598						let loadMoreClicked = false;
599						$sptpgrid.isotope({
600							filter: filterValue
601						}).one('arrangeComplete', function () {
602							const visibleCount = $(sptp_Wrapper_ID + ' .filter-item:visible').length;
603
604							if (visibleCount === 0 && filterValue !== '*') {
605								const $loadMoreButton = $(sptp_Wrapper_ID + ' .filter-item')
606									.parents('.sptp-filter')
607									.find('.sptp-post-load-more:not(.hidden) span');
608
609								if ($loadMoreButton.length) {
610									$loadMoreButton.trigger('click');
611								}
612							}
613						});
614					});
615					// Filter select.
616					$(sptp_Wrapper_ID + ".sptp-filter .filterSelect").on(
617						'change',
618						function (event) {
619							var $select = $(event.target);
620							// get group key
621							var filterGroup = $select.attr('data-filter-group');
622							filters[filterGroup] = event.target.value;
623							// Combine filters
624							var filterValue = concatValues(filters);
625							// set filter for Isotope and update the count after filtering is done and filtering data.
626							$sptpgrid.isotope({
627								filter: filterValue
628							}).one('arrangeComplete', function () {
629								const selectVisibleCount = $(sptp_Wrapper_ID + ' .filter-item:visible').length;
630
631								if (selectVisibleCount === 0 && filterValue !== '*') {
632									const $selectLoadMoreButton = $(sptp_Wrapper_ID + ' .filter-item')
633										.parents('.sptp-filter')
634										.find('.sptp-post-load-more:not(.hidden) span');
635
636									if ($selectLoadMoreButton.length) {
637										$selectLoadMoreButton.trigger('click');
638									}
639								}
640							});
641						});
642
643					// Change active class on buttons
644					$(sptp_Wrapper_ID + ' .filters-button-group').each(function (i, buttonGroup) {
645						const $buttonGroup = $(buttonGroup);
646						const $find_active_button = $buttonGroup.find('.is-checked');
647						const $activeSlug = $find_active_button.data('filter');
648						if ('*' !== $activeSlug) {
649							$find_active_button.trigger('click');
650						}
651						$buttonGroup.on('click', 'button', function () {
652							$buttonGroup.find('.is-checked').removeClass('is-checked');
653							$(this).addClass('is-checked');
654						});
655					});
656				})
657			}
658
659			// Thumbnail pager.
660			if ($(sptp_Wrapper_ID + ' .sptp-thumbnail-pager').length > 0) {
661				var galleryThumbs = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-thumbs', {
662					spaceBetween: 0,
663					slidesPerView: 10,
664					loop: false,
665					allowTouchMove: false,
666				});
667				var galleryTop = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-sidebar', {
668					loop: false,
669					allowTouchMove: false,
670					effect: 'fade',
671					autoHeight: true,
672					thumbs: {
673						swiper: galleryThumbs,
674					}
675				});
676			}
677
678			/* After pagination load event init */
679			function sptp_event_init(sptp_Wrapper_ID) {
680				$(document).on("click", ".gridder-close", function (e) {
681					e.preventDefault();
682					e.stopPropagation();
683					$(this)
684						.closest(".gridder-show")
685						.remove();
686				});
687				$(document).on("click", sptp_Wrapper_ID + " .gridder-list", function (e) {
688					if (!$(e.target).closest('.sptp-member-social').hasClass('sptp-member-social')) {
689						var totalGridder = $(".gridder-list", sptp_Wrapper_ID).length;
690						var position = $(".gridder-list", sptp_Wrapper_ID).index($(this)) + 1;
691						if (position == totalGridder) {
692							$(".sptp-drawer .gridder-nav.next", sptp_Wrapper_ID).hide();
693						}
694						if (position == 1) {
695							$(".sptp-drawer .gridder-nav.prev", sptp_Wrapper_ID).hide();
696						}
697					}
698				});
699			}
700			sptp_event_init(sptp_Wrapper_ID);
701
702			/* Popup slider init */
703			function sptp_popup_swiper_init() {
704				$(sptp_Wrapper_ID + " .sptp-popup-item").each(function () {
705					var _this = $(this);
706					var sptp_sw_container = _this.find('.swiper-container');
707					var swiperItem = sptp_sw_container.find(".swiper-slide").length;
708					if (swiperItem < 2) {
709						sptp_sw_container.find(".sptp-pagination, .sptp-button-next, .sptp-button-prev").hide();
710					}
711					if (!$(sptp_sw_container).hasClass('swiper-container-initialized')) {
712						swiper = SwiperSlide(sptp_Wrapper_ID + " .sptp-popup-item .swiper-container", {
713							loop: false,
714							slidesPerView: 1,
715							autoHeight: true,
716							observer: true,
717							observeParents: true,
718							pagination: {
719								el: ".swiper-pagination",
720								clickable: true
721							},
722							navigation: {
723								nextEl: ".swiper-button-next",
724								prevEl: ".swiper-button-prev"
725							}
726						});
727					}
728				})
729			}
730			sptp_popup_swiper_init();
731
732			$(document).ajaxComplete(function () {
733				progressBarAnimation();
734				$('.pagination-disable').css('pointer-events', 'none');
735
736				$(".sp-team-pro-page-loading-image").css("visibility", "hidden");
737			});
738			$(".sp-team-pro-page-loading-image").css("visibility", "hidden");
739
740			// Ajax all filter action.
741			var filter_slug = $(sptp_Wrapper_ID + '.sp-team-pro .sptp-live-filter .fltr-controls.is-checked').data('slug');
742			var sptp_search_value = '';
743			var sptp_filter_slug = filter_slug ? filter_slug : '';
744			var shortcodeId = $(sptp_Wrapper_ID + '.sp-team-pro').attr('id');
745			function sptp_ajax_actions(sptp_Wrapper_ID) {
746				$.ajax({
747					type: 'POST',
748					url: sptp_vars.ajax_url,
749					data: {
750						value: sptp_search_value,
751						slug: sptp_filter_slug,
752						generator_id: shortcodeId,
753						action: 'team_pro_search_member',
754						page: 1,
755						nonce: sptp_vars.nonce,
756					},
757					success: function (response) {
758						var $data = response ? $(response) : `<h4 style="text-align:center;width:100%">${sptp_vars.not_found}</h4>`;
759						var member_data = $(sptp_Wrapper_ID + ' .sptp-grid > .sptp-row, ' + sptp_Wrapper_ID + '  table tbody, ' + sptp_Wrapper_ID + ' .swiper-wrapper, ' + sptp_Wrapper_ID + '.sptp-filter .sptp-filter-grid.sptp-row,' + sptp_Wrapper_ID + ' .sptp-accordion-items').css('opacity', 0);
760						// Carousel destroy.
761						if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
762							var sptpCarousel = $('.sptp-main-carousel', sptp_Wrapper_ID).data(
763								"carousel"
764							);
765							if (sptpCarousel.mode === "ticker") {
766								sptpTicker.destroySlider();
767							} else {
768								sptpSwiper.destroy();
769							}
770						}
771						member_data.html($data);
772						// Masonry layout.
773						if ($(sptp_Wrapper_ID).hasClass("sptp-masonry")) {
774							var $post_wrapper = $(".sptp-row", sptp_Wrapper_ID);
775							$post_wrapper.masonry("destroy");
776							$post_wrapper.html($data).imagesLoaded(function () {
777								$post_wrapper.masonry();
778							});
779						}
780						// Carousel.
781						if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
782							var sptpCarousel = $('.sptp-main-carousel', sptp_Wrapper_ID).data(
783								"carousel"
784							);
785							carouselSlide();
786						}
787						if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
788							$sptpgrid.isotope('remove', $sptpgrid.isotope('getItemElements'));
789							$sptpgrid.html($data).imagesLoaded(function () {
790								$sptpgrid.isotope('insert', $data);
791								$sptpgrid.isotope('layout');
792							})
793							// $sptpgrid.isotope('insert', $data);
794						}
795						sptp_item_same_height();
796						accordion_init();
797						if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
798							$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
799								var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
800								if ($parent.length) {
801									$parent.css('overflow', 'visible');
802								}
803							});
804						}
805						//  setTimeout(() => {
806						member_data.animate({
807							opacity: '1',
808						}, "slow");
809						// }, 10);
810						wpteam_lazyload();
811					}
812				});
813				if ($(sptp_Wrapper_ID + ".pagination_btn").length > 0 || $(sptp_Wrapper_ID + ".pagination_scrl").length > 0 || $(sptp_Wrapper_ID + ".pagination_number").length > 0) {
814					$.ajax({
815						type: 'POST',
816						url: sptp_vars.ajax_url,
817						data: {
818							value: sptp_search_value,
819							slug: sptp_filter_slug,
820							generator_id: shortcodeId,
821							action: 'team_pro_pagination',
822							nonce: sptp_vars.nonce,
823						},
824						success: function (response) {
825							var $data = $(response);
826							var member_data = $(sptp_Wrapper_ID + ' .sptp-post-pagination');
827							if ($data && member_data.length > 0) {
828								member_data.html($data);
829							}
830
831							if ($(sptp_Wrapper_ID + ' .sptp-post-pagination a').length) {
832								$(sptp_Wrapper_ID + ' .sptp-post-load-more').show();
833								$(sptp_Wrapper_ID + ' .infinite-scroll-last').hide();
834								$('.sptp-post-load-more', sptp_Wrapper_ID).html('<span> ' + LoadMoreButton_text + ' </span>');
835							} else {
836								$(sptp_Wrapper_ID + ' .sptp-post-load-more').hide();
837								$(sptp_Wrapper_ID + ' .infinite-scroll-last').show();
838								$('.sptp-post-load-more span', sptp_Wrapper_ID + '.pagination_scrl').remove();
839							}
840						}
841					});
842				}
843
844				if ($(sptp_Wrapper_ID + ' .sptp-row').hasClass('gridder')) {
845					$.ajax({
846						type: 'POST',
847						url: sptp_vars.ajax_url,
848						data: {
849							value: sptp_search_value,
850							slug: sptp_filter_slug,
851							page: 1,
852							generator_id: shortcodeId,
853							action: 'team_pro_drawer_content',
854							nonce: sptp_vars.nonce,
855						},
856						success: function (response) {
857							var $data = $(response);
858							var member_data = $('#' + shortcodeId + ' .sptp-drawer-items');
859							member_data.html($data);
860						}
861					});
862				}
863			}
864			// Ajax filter first button click when all button is hidden.
865			// var $buttonGroup = $(sptp_Wrapper_ID + ' .filters-button-group .fltr-control
865s:nth-child(1).is-checked');
866			// setTimeout(function () {
867			// 	$buttonGroup.trigger('click');
868			// }, 300);
869
870			// Ajax filter with button style.
871			$(sptp_Wrapper_ID + ' .sptp-live-filter.filters-button-group').on('click', 'button', function (event) {
872				var $buttonGroup = $(sptp_Wrapper_ID + ' .filters-button-group');
873				$buttonGroup.find('.is-checked').removeClass('is-checked');
874				$(this).addClass('is-checked');
875				sptp_filter_slug = $(this).data('slug');
876				sptp_ajax_actions(sptp_Wrapper_ID);
877			});
878			// Live filter with dropdown style.
879			$(sptp_Wrapper_ID + " .sptp-live-filter .filterSelect").on(
880				'change',
881				function (e) {
882					e.preventDefault();
883					e.stopPropagation();
884					sptp_filter_slug = $(this).val();
885					sptp_ajax_actions(sptp_Wrapper_ID);
886				});
887
888			function makeDelay(fn, ms) {
889				let timer = 0
890				return function (...args) {
891					clearTimeout(timer)
892					timer = setTimeout(fn.bind(this, ...args), ms || 0)
893				}
894			}
895			// Ajax member Search.
896			$(document).on('keyup', '#member_search-' + sptp_container_id, makeDelay(function () {
897
898				// Read dropdown selected value
899				let activeSelect = $(sptp_Wrapper_ID + " .filterSelect");
900				if (activeSelect.length > 0) {
901					const value = activeSelect.val();
902					sptp_filter_slug = value === "all" ? "" : value;
903				}
904
905				// Read button-group selected value
906				let activeBtn = $(sptp_Wrapper_ID + ' .filters-button-group .is-checked');
907				if (activeBtn.length > 0) {
908					const slug = activeBtn.data('slug');
909					sptp_filter_slug = slug === "all" ? "" : slug;
910				}
911
912				sptp_search_value = $(this).val();
913				sptp_ajax_actions('#' + sptp_container_id);
914			}, 500));
915
916			// Ajax number pagination.
917			if ($(sptp_Wrapper_ID + ".pagination_number").length > 0) {
918				$(sptp_Wrapper_ID + ".pagination_number").on('click', '.sptp-post-pagination a', function (e) {
919					e.preventDefault();
920					e.stopPropagation();
921					var that = $(this);
922					var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID)
923						.length,
924						currentPage = parseInt(
925							$('.sptp-post-pagination .current:not(.next, .prev)', sptp_Wrapper_ID).data('page')),
926						page = parseInt(that.data('page'));
927					if (that.hasClass('next')) {
928						if (totalPage > currentPage) {
929							var page = currentPage + 1
930						} else {
931							return
932						}
933					}
934					if (that.hasClass('prev')) {
935						if (currentPage > 1) {
936							var page = currentPage - 1
937						} else {
938							return
939						}
940					}
941					$.ajax({
942						type: 'POST',
943						url: sptp_vars.ajax_url,
944						data: {
945							value: sptp_search_value,
946							slug: sptp_filter_slug,
947							page: page,
948							generator_id: shortcodeId,
949							action: 'team_pro_search_member',
950							nonce: sptp_vars.nonce,
951						},
952						success: function (response) {
953							var $data = $(response);
954							var member_data = $(sptp_Wrapper_ID + ' .sptp-grid > .sptp-row, ' + sptp_Wrapper_ID + '  table tbody, ' + sptp_Wrapper_ID + ' .swiper-wrapper, ' + sptp_Wrapper_ID + '.sptp-filter .sptp-filter-grid.sptp-row,' + sptp_Wrapper_ID + ' .sptp-accordion-items').css('opacity', 0);
955
956							member_data.html($data);
957							// Carousel.
958							if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
959								carouselSlide();
960							}
961							// Masonry layout.
962							if ($(sptp_Wrapper_ID).hasClass("sptp-masonry")) {
963								var $post_wrapper = $(".sptp-row", sptp_Wrapper_ID);
964								$post_wrapper.masonry("destroy");
965								$post_wrapper.html($data).imagesLoaded(function () {
966									$post_wrapper.masonry();
967								});
968							}
969
970							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
971								$sptpgrid.isotope('insert', $data);
972							}
973							accordion_init();
974							// sptp_gridder_init();
975							sptp_item_same_height()
976							if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
977								$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
978									var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
979									if ($parent.length) {
980										$parent.css('overflow', 'visible');
981									}
982								});
983							}
984							// Thumbnail pager.
985							if ((sptp_Wrapper_ID + ' .sptp-thumbnail-page').length > 1) {
986								var galleryThumbs = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-thumbs', {
987									spaceBetween: 0,
988									slidesPerView: 10,
989									loop: false,
990									allowTouchMove: false,
991								});
992								var galleryTop = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-sidebar', {
993									loop: false,
994									allowTouchMove: false,
995									effect: 'fade',
996									autoHeight: true,
997									thumbs: {
998										swiper: galleryThumbs,
999									}
1000								});
1001							}
1002
1003							var headerH = ($('body').hasClass('logged-in admin-bar')) ? 32 : 0;
1004							var targetToID = $($data).parents('.sp-wp-team-pro-wrapper').offset().top - headerH;
1005							$('html, body').animate({
1006								scrollTop: targetToID + "px"
1007							}, 500);
1008
1009							$('.page-numbers', sptp_Wrapper_ID).removeClass('current');
1010							$('.page-numbers', sptp_Wrapper_ID).each(function () {
1011								$('.sptp-post-pagination  a[data-page=' + page + ']', sptp_Wrapper_ID).addClass(
1012									'current'
1013								)
1014							});
1015
1016							$('.next', sptp_Wrapper_ID).removeClass('current')
1017							$('.prev', sptp_Wrapper_ID).removeClass('current')
1018							$('.sptp-post-pagination a.current', sptp_Wrapper_ID).each(function () {
1019
1020								if (parseInt($(this).data('page')) === totalPage) {
1021									$('.next', sptp_Wrapper_ID).addClass('current');
1022								}
1023								if (parseInt($(this).data('page')) === 1) {
1024									$('.prev', sptp_Wrapper_ID).addClass('current');
1025								}
1026							})
1027							member_data.css('opacity', 1);
1028							wpteam_lazyload();
1029						}
1030					});
1031					if ($(sptp_Wrapper_ID + ' .sptp-row').hasClass('gridder')) {
1032						$.ajax({
1033							type: 'POST',
1034							url: sptp_vars.ajax_url,
1035							data: {
1036								value: sptp_search_value,
1037								slug: sptp_filter_slug,
1038								page: page,
1039								generator_id: shortcodeId,
1040								action: 'team_pro_drawer_content',
1041								nonce: sptp_vars.nonce,
1042							},
1043							success: function (response) {
1044								var $data = $(response);
1045								var member_data = $(sptp_Wrapper_ID + ' .sptp-drawer-items');
1046								member_data.html($data);
1047							}
1048						});
1049					}
1050				});
1051			}
1052			// Ajax load more and infinite scroll.
1053			var LoadMoreButton_text;
1054			if ($(sptp_Wrapper_ID + ".pagination_btn").length > 0 || $(sptp_Wrapper_ID + ".pagination_scrl").length > 0) {
1055				var EndingMessage = $(sptp_Wrapper_ID).find('.infinite-scroll-last');
1056				var ErrorMessage = $(sptp_Wrapper_ID).find('.infinite-scroll-error');
1057				var PageLoadStatus = $(sptp_Wrapper_ID).find('.page-load-status .loader-ellips.infinite-scroll-request');
1058				LoadMoreButton_text = $(sptp_Wrapper_ID).find('.sptp-post-load-more').data('buttontext')
1059				$('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing', 0);
1060				$(sptp_Wrapper_ID + ".pagination_btn, " + sptp_Wrapper_ID + ".pagination_scrl").on('click', '.sptp-post-load-more span', function (e) {
1061					e.preventDefault();
1062					e.stopPropagation();
1063					e.stopImmediatePropagation();
1064					PageLoadStatus.show();
1065					var that = $(this);
1066					var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID).length;
1067					var currentPage = parseInt($('.sptp-post-pagination .current:not(.next, .prev)', sptp_Wrapper_ID).data('page'));
1068					var page = currentPage + 1;
1069					$('.sptp-post-load-more', sptp_Wrapper_ID + '.pagination_scrl').attr('data-processing', 1);
1070					$.ajax({
1071						type: 'POST',
1072						url: sptp_vars.ajax_url,
1073						data: {
1074							value: sptp_search_value,
1075							slug: sptp_filter_slug,
1076							page: page,
1077							generator_id: shortcodeId,
1078							action: 'team_pro_search_member',
1079							nonce: sptp_vars.nonce,
1080						},
1081						success: function (response) {
1082							var $data = $(response);
1083							var member_data = $(sptp_Wrapper_ID + ' .sptp-grid > .sptp-row, ' + sptp_Wrapper_ID + '  table tbody, ' + sptp_Wrapper_ID + ' .swiper-wrapper, ' + sptp_Wrapper_ID + '.sptp-filter .sptp-filter-grid.sptp-row, ' + sptp_Wrapper_ID + ' .sptp-accordion-items');
1084							member_data.append($data);
1085							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
1086								$sptpgrid.isotope('appended', $data);
1087							}
1088							// Masonry Layout.
1089
1090							if ($(sptp_Wrapper_ID).hasClass("sptp-masonry")) {
1091								// Save current scroll position
1092								var scrollTop = $(window).scrollTop();
1093								var $post_wrapper = $(".sptp-row", sptp_Wrapper_ID);
1094								$post_wrapper.masonry("destroy");
1095								$post_wrapper.append($data).imagesLoaded(function () {
1096									$post_wrapper.masonry();
1097									// Restore scroll position after Masonry reinitialization.
1098									$(window).scrollTop(scrollTop);
1099								});
1100							}
1101							// Carousel.
1102							if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
1103								carouselSlide();
1104							}
1105							accordion_init();
1106							sptp_item_same_height();
1107							if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
1108								$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1109									var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
1110									if ($parent.length) {
1111										$parent.css('overflow', 'visible');
1112									}
1113								});
1114							}
1115							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
1116								$sptpgrid.isotope('layout');
1117							}
1118
1119							$('.page-numbers', sptp_Wrapper_ID).removeClass('current');
1120							$('.page-numbers', sptp_Wrapper_ID).each(function () {
1121								$('.sptp-post-pagination  a[data-page=' + page + ']', sptp_Wrapper_ID).addClass(
1122									'current'
1123								)
1124							});
1125
1126							$('.next', sptp_Wrapper_ID).removeClass('current')
1127							$('.prev', sptp_Wrapper_ID).removeClass('current')
1128							$('.sptp-post-pagination a.current', sptp_Wrapper_ID).each(function () {
1129
1130								if (parseInt($(this).data('page')) === totalPage) {
1131									$('.next', sptp_Wrapper_ID).addClass('current');
1132								}
1133								if (parseInt($(this).data('page')) === 1) {
1134									$('.prev', sptp_Wrapper_ID).addClass('current');
1135								}
1136							})
1137							if (totalPage == page) {
1138								$('.sptp-post-load-more span', sptp_Wrapper_ID).remove();
1139								EndingMessage.show();
1140							}
1141							PageLoadStatus.hide();
1142							$('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing', 0);
1143							wpteam_lazyload();
1144						}
1145					});
1146					if ($(sptp_Wrapper_ID + ' .sptp-row').hasClass('gridder')) {
1147						$.ajax({
1148							type: 'POST',
1149							url: sptp_vars.ajax_url,
1150							data: {
1151								value: sptp_search_value,
1152								slug: sptp_filter_slug,
1153								page: page,
1154								generator_id: shortcodeId,
1155								action: 'team_pro_drawer_content',
1156								nonce: sptp_vars.nonce,
1157							},
1158							success: function (response) {
1159								var $data = $(response);
1160								var member_data = $(sptp_Wrapper_ID + ' .sptp-drawer-items');
1161								member_data.append($data);
1162							}
1163						});
1164					}
1165				});
1166			}
1167			if ($(sptp_Wrapper_ID + ".pagination_scrl").length > 0) {
1168				var bufferBefore = Math.abs(10);
1169				var row = $('.sptp-row, table tbody, .sptp-accordion-items', sptp_Wrapper_ID);
1170				if (row.length) {
1171					$(window).on('scroll', function (e) {
1172						e.preventDefault();
1173						var TopAndContent = row.offset().top + row.outerHeight();
1174						var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID).length;
1175						var areaLeft = TopAndContent - $(window).scrollTop();
1176						totalPage = totalPage + 1;
1177						if (areaLeft - bufferBefore < $(window).height()) {
1178							if ($('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing') == 0) {
1179								$('.sptp-post-load-more span', sptp_Wrapper_ID).trigger('click');
1180							}
1181						}
1182					})
1183				}
1184			}
1185			if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
1186				$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1187					var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
1188					if ($parent.length) {
1189						$parent.css('overflow', 'visible');
1190					}
1191				});
1192			}
1193		})
1194
1195
1196		// Gallery caption image;
1197		function gallery_caption_hover(shortcodeId) {
1198			var sptp_gallery = $('#' + shortcodeId + " .swiper-slide");
1199			sptp_gallery.on('mousemove',
1200				function () {
1201					if ($(this).find('.sptp_gallery_image_caption').hasClass('sptp_gallery_image_caption')) {
1202						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1203							'bottom': '60px'
1204						})
1205					} else {
1206						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1207							'bottom': '10px'
1208						})
1209					}
1210				}
1211			);
1212			var sptp_gallery = $('#' + shortcodeId + " .sptp-member-avatar-area");
1213			sptp_gallery.on('mouseleave',
1214				function () {
1215					if ($(this).find('.sptp_gallery_image_caption').hasClass('sptp_gallery_image_caption')) {
1216						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1217							'bottom': '10px'
1218						})
1219					}
1220				}
1221			);
1222		}
1223
1224		function sptp_post_id_list(selector) {
1225			var list = new Array()
1226			selector.find('.sp-team-pro-item')
1227				.each(function (index) {
1228					list.push($(this).data('member'))
1229				})
1230			return list
1231		}
1232		// Return array key number of a value.
1233		function sptp_val2key(val, array) {
1234			for (var all_key in array) {
1235				if (array[all_key] == val) {
1236					return all_key
1237				}
1238			}
1239			return false
1240		}
1241
1242		// Go to previous array key.
1243		function sptp_array_key_next(all_key, sptp_id_length) {
1244			all_key--
1245			if (all_key < 0) {
1246				all_key = sptp_id_length - 1
1247			}
1248			return all_key
1249		}
1250
1251		// Go to next array key.
1252		function sptp_array_key_prev(all_key, sptp_id_length) {
1253			all_key++
1254			if (all_key > sptp_id_length - 1) {
1255				all_key = 0
1256			}
1257			return all_key
1258		}
1259		// Progress bar animation on loading.
1260		function progressBarAnimation() {
1261			$(".sptp-progress-container").each(function () {
1262				var percent = $(this).data("title");
1263				$(this)
1264					.find(".sptp-progress-bar")
1265					.animate({
1266						width: percent
1267					},
1268						1000
1269					);
1270				var percentInt = parseInt(percent);
1271				if (percentInt >= 95) {
1272					$(this)
1273						.find(".sptp-top")
1274						.css("right", 0);
1275				}
1276				if (percentInt === 100) {
1277					$(this)
1278						.find(".sptp-top")
1279						.css("width", "40px");
1280				}
1281			});
1282		}
1283
1284		// Change Popup content on next prev button click.
1285		function popup_next_prev($data, shortcode_id, load_type, sptp_Wrapper_ID = '') {
1286			var selector = $('#' + shortcode_id + '.sptp-modal');
1287			var icon_shape = selector.data('icon');
1288			var modalshow = selector.data('modalshow');
1289			var modalshow = modalshow.split(',');
1290			if ('true' == load_type) {
1291				var $data = modal_json_to_plain_html($data, modalshow, icon_shape, sptp_Wrapper_ID);
1292			}
1293			var nextPrevContent = $('.sptp-popup-item');
1294			nextPrevContent.html($data);
1295			setTimeout(() => {
1296				var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1297				var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1298				var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1299				var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1300					loop: loop,
1301					autoplay: autoplay ? ({ delay: 5000 }) : false,
1302					navigation: {
1303						nextEl: '.sptp-button-next.swiper-button-next',
1304						prevEl: '.sptp-button-prev.swiper-button-prev',
1305					},
1306					autoHeight: true,
1307					pagination: {
1308						el: '.sptp-pagination.swiper-pagination',
1309						clickable: true,
1310					}
1311				});
1312				$('.sptp-popup-content-main.text-center').css({
1313					'opacity': '1',
1314					'transform': 'translateY(0px)',
1315					'transition': '.6s'
1316				})
1317
1318				$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1319					'transform': 'translate(-50%, -45%)',
1320					'opacity': '0',
1321					'visibility': 'hidden',
1322					'transition': '.2s'
1323				});
1324				var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1325				if (sptpPaginationSingle < 2) {
1326					$('.popup-open .sptp-pagination.swiper-pagination').hide();
1327				}
1328			}, 0);
1329
1330			setTimeout(() => {
1331				$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1332					'transform': 'translate(-50%, -50%)',
1333					'opacity': '1',
1334					'visibility': 'visible',
1335					'transition': '.4s'
1336				});
1337			}, 300);
1338			progressBarAnimation();
1339		}
1340
1341		// Modal option init with this function.
1342		function modal_json_to_plain_html(item, modalshow, icon_shape, sptp_Wrapper_ID) {
1343			var skeleton = $(sptp_Wrapper_ID + '+.sptp-skeleton').data('skeleton');
1344			var customdiv = document.createElement('div');
1345			customdiv.innerHTML = skeleton;
1346			// Member image.
1347			if ($.inArray("img", modalshow) != -1 && (typeof item.thumbs != "undefined") && item.thumbs.length > 1) {
1348				$(customdiv).find('.sptp-member-avatar-area .swiper-wrapper').append(item.thumbs)
1349			} else {
1350				$(customdiv).find('.sptp-member-avatar-area').remove();
1351			}
1352			// Member name.
1353			if ($.inArray("name", modalshow) != -1 && (typeof item.name != "undefined") && item.name.length > 1) {
1354				$(customdiv).find('.sptp-member-name .sptp-name').append(item.name);
1355			} else {
1356				$(customdiv).find('.sptp-member-name').remove();
1357			}
1358			// Member profession.
1359			if ($.inArray("position", modalshow) != -1 && (typeof item.job_title != "undefined") && item.job_title.length > 1) {
1360				$(customdiv).find('.sptp-member-profession .sptp-profession-text').append(item.job_title);
1361			} else {
1362				$(customdiv).find('.sptp-member-profession').remove();
1363			}
1364			// Member Description.
1365			if ($.inArray("desc", modalshow) != -1 && (typeof item.desc != "undefined") && item.desc.length > 1) {
1366				$(customdiv).find('.sptp-member-desc').append(item.desc);
1367			} else {
1368				$(customdiv).find('.sptp-member-desc').remove();
1369			}
1370			// Member Email.
1371			if ($.inArray("email", modalshow) != -1 && (typeof item.email != "undefined") && item.email.length > 1) {
1372				$(customdiv).find('.sptp-member-email').append(item.email);
1373			} else {
1374				$(customdiv).find('.sptp-member-email').remove();
1375			}
1376			// Member mobile.
1377			if ($.inArray("mobile", modalshow) != -1 && (typeof item.mobile != "undefined") && item.mobile.length > 1) {
1378				$(customdiv).find('.sptp-member-mobile').append(item.mobile);
1379			} else {
1380				$(customdiv).find('.sptp-member-mobile').remove();
1381			}
1382			// Member phone number.
1383			if ($.inArray("phone", modalshow) != -1 && (typeof item.phone != "undefined") && item.phone.length > 1) {
1384				$(customdiv).find('.sptp-member-phone').append(item.phone);
1385			} else {
1386				$(customdiv).find('.sptp-member-phone').remove();
1387			}
1388			// Member experience.
1389			if ($.inArray("experience", modalshow) != -1 && (typeof item.experience != "undefined") && item.experience.length > 1) {
1390				$(customdiv).find('.sptp-member-experience').append(item.experience);
1391			} else {
1392				$(customdiv).find('.sptp-member-experience').remove();
1393			}
1394			// Member location.
1395			if ($.inArray("location", modalshow) != -1 && (typeof item.location != "undefined") && item.location.length > 1) {
1396				$(customdiv).find('.sptp-member-location a').attr('href', `https://www.google.com/maps/search/?api=1&query=${item.location}`);
1397				$(customdiv).find('.sptp-member-location span').append(item.location);
1398			} else {
1399				$(customdiv).find('.sptp-member-location a').attr('href', `https://www.google.com/maps/search/?api=1&query=${item.location}`);
1400				$(customdiv).find('.sptp-member-location').remove();
1401			}
1402			// Member website.
1403			if ($.inArray("website", modalshow) != -1 && (typeof item.website != "undefined") && item.website.length > 1) {
1404				$(customdiv).find('.sptp-member-website').append(item.website);
1405			} else {
1406				$(customdiv).find('.sptp-member-website').remove();
1407			}
1408			// Member extra fields.
1409			if ($.inArray("extra_fields_switch", modalshow) != -1 && (typeof item.extra_fields != "undefined") && item.extra_fields.length > 1) {
1410				$(customdiv).find('.sptp-member-extra-fields').append(item.extra_fields);
1411			} else {
1412				$(customdiv).find('.sptp-member-extra-fields').remove();
1413			}
1414			// Member Skill.
1415			if ($.inArray("skills", modalshow) != -1 && (typeof item.skills != "undefined") && item.skills.length > 1) {
1416				$(customdiv).find('.sptp-member-skill-progress').append(item.skills);
1417			} else {
1418				$(customdiv).find('.sptp-member-skill-progress').remove();
1419			}
1420			// Member Social profiles.
1421			if ($.inArray("social_profiles", modalshow) != -1 && (typeof item.social != "undefined") && item.social.length > 1) {
1422				$(customdiv).find('.sptp-member-social ul').append(item.social);
1423			} else {
1424				$(customdiv).find('.sptp-member-social').remove();
1425			}
1426			// Member author posts.
1427			if ($.inArray("author_posts_detail", modalshow) != -1 && (typeof item.author_post != "undefined") && item.author_post.length > 1) {
1428				$(customdiv).find('.sptp-member-post ul').append(item.author_post);
1429			} else {
1430				$(customdiv).find('.sptp-member-post').remove();
1431			}
1432			// Social add class icon shape.
1433			$(customdiv).find('.sptp-member-social').removeClass('circle').addClass(icon_shape);
1434			var data = customdiv.innerHTML;
1435			customdiv.remove();
1436			return `<div class="sptp-popup-content-main text-center">` + data + `</div>`;
1437		}
1438
1439		// Check Element in viewport.
1440		function isElementInViewport(el) {
1441			var elementTop = $(el).offset().top;
1442			var elementBottom = elementTop + $(el).outerHeight();
1443			var viewportTop = $(window).scrollTop();
1444			var viewportBottom = viewportTop + $(window).height();
1445			return elementBottom > viewportTop && elementTop < viewportBottom;
1446		};
1447		// Popup init function.
1448		function ajax_popup_init(sid, sptp_Wrapper_ID) {
1449			var json_data = Array();
1450			var rest_url = $(sptp_Wrapper_ID + '.sptp-modal').data('rest-url');
1451			$.ajax({
1452				url: rest_url + sid,
1453				async: true,
1454				dataType: 'json',
1455				success: function (response) {
1456					json_data[sid] = response;
1457					var sptp_id_list;
1458					var sptp_array_key;
1459					var sptp_id_length;
1460					// Triggering modal.
1461					$(document).on('click', sptp_Wrapper_ID + '.sptp-modal .sptp-member-
1461avatar:not(.custom-link),' + sptp_Wrapper_ID + '.sptp-modal .sptp-member-read-more-button, ' + sptp_Wrapper_ID + '.sptp-modal .member_name_clickable', function (e) {
1462						var custom_link = $(this).parents('.sptp-member:has(.custom-link)').length;
1463						if (custom_link) {
1464							return;
1465						}
1466						e.preventDefault();
1467						e.stopPropagation();
1468						e.stopImmediatePropagation();
1469						var that = $(this);
1470						var selector = $(sptp_Wrapper_ID + '.sptp-modal');
1471						var modal_type = selector.data('modal-type');
1472						var layout = selector.data('layout');
1473						var pdfbtn = selector.data('pdfbtn');
1474						var icon_shape = selector.data('icon');
1475						var modalshow = selector.data('modalshow');
1476						var modalshow = modalshow.split(',');
1477						var shortcodeId = that.parents('.sp-team-pro').attr('id');
1478						var unique_uid = Date.now();
1479						memberId = that.parents('.sp-team-pro-item').data('member');
1480						sptp_id_list = sptp_post_id_list(selector);
1481						sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1482						sptp_id_length = sptp_id_list.length;
1483						var multiple_btn_style1 = '';
1484						var multiple_btn_style2 = '';
1485						var pdfbtn_text = '';
1486						if (pdfbtn) {
1487							pdfbtn_text = `<button id="sp-team-generate-pdf-file">Download PDF File</button>`;
1488						}
1489						if ('multiple' == modal_type) {
1490							multiple_btn_style1 = `<div class="sptp-popup-style1-navigation"> <a href="#" class="sptp-nav-item sptp-nav-next"><i class="fa fa-angle-left"></i></a><a href="#" class="sptp-nav-item sptp-nav-prev"><i class="fa fa-angle-right"></i></a></div><button type="button" class="mfp-close"></button>`;
1491							multiple_btn_style2 = `<div class="sptp-popup-style2-navigation"> <a href="#" class="sptp-nav-item sptp-nav-next"><i class="fa fa-angle-left"></i></a> <a href="#" class="sptp-nav-item sptp-nav-prev"><i class="fa fa-angle-right"></i></a></div><button type="button" class="mfp-close"></button>`;
1492						}
1493						// json_data[sid]
1494						var $item = json_data[sid][memberId];
1495						var $data = modal_json_to_plain_html($item, modalshow, icon_shape, sptp_Wrapper_ID);
1496						var $data = `<section class="sptp-popup-section ` + unique_uid + ` ` + layout + `">` + multiple_btn_style1 + `<div id="` + shortcodeId + `" class="sp-team-pro sptp-section ` + layout + ` popup-open"><div class="sptp-popup-header"> ` + multiple_btn_style2 + `  <button title="Close (Esc)" type="button" class="mfp-close"></button> </div> <button type="button" class="mfp-close"></button> <div class="sptp-popup-item sp-team-popup-item-section">` + $data + ` </div> ` + pdfbtn_text + ` </div> </section>`;
1497						$.magnificPopup.open({
1498							type: 'inline',
1499							mainClass: 'sptp-popup popup-open',
1500							showCloseBtn: true,
1501							closeBtnInshortcode_ide: true,
1502							enableEscapeall_key: true,
1503							closeOnBgClick: true,
1504							fixedContentPos: true,
1505							fixedBgPos: true,
1506							items: {
1507								src: $data
1508							},
1509							callbacks: {
1510								open: function () {
1511									sptp_id_length = sptp_id_list.length;
1512									sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1513								}
1514							}
1515						});
1516						setTimeout(() => {
1517							$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1518								'opacity': '1',
1519								'transform': 'translate(-50%, -50%)'
1520							});
1521							$('.sp-team-pro.sptp-section.style-3.popup-open').css({
1522								'opacity': '1',
1523								'transform': 'translateX(0px)'
1524							});
1525							$('.sp-team-pro.sptp-section.style-4.popup-open').css({
1526								'opacity': '1',
1527								'transform': 'translate(-50%, 0px)'
1528							});
1529							$('.sp-team-pro.sptp-section.style-2.popup-open').css({
1530								'opacity': '1',
1531								'transform': 'translateX(0px)'
1532							});
1533							$('.sptp-popup-content-main.text-center').css({
1534								'opacity': '1',
1535								'transform': 'translateY(0px)'
1536							});
1537							gallery_caption_hover(shortcodeId);
1538							progressBarAnimation();
1539							team_pro_generate_pdf();
1540							var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1541							var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1542							var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1543							var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1544								loop: loop,
1545								autoplay: autoplay ? ({ delay: 5000 }) : false,
1546								navigation: {
1547									nextEl: '.sptp-button-next.swiper-button-next',
1548									prevEl: '.sptp-button-prev.swiper-button-prev',
1549								},
1550								// clickable: true,
1551								autoHeight: true,
1552								pagination: {
1553									el: '.sptp-pagination.swiper-pagination',
1554									clickable: true,
1555								}
1556							});
1557							var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1558							if (sptpPaginationSingle < 2) {
1559								$('.popup-open .sptp-pagination.swiper-pagination').hide();
1560							}
1561							$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1562								var $parent = $(this).parents('.sptp-popup-section .sptp-member-avatar-area .sptp-popup-carousel');
1563								if ($parent.length) {
1564									$parent.css('overflow', 'visible');
1565								}
1566							});
1567						}, 0);
1568
1569						// Triggering Modal next.
1570						$(document).on('click', '.' + unique_uid + ' .sptp-nav-item.sptp-nav-next', function (event) {
1571							event.preventDefault();
1572							event.stopPropagation();
1573							var that = $(this);
1574							var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1575							if (typeof sptp_id_list != 'undefined') {
1576								sptp_array_key = sptp_array_key_next(sptp_array_key, sptp_id_length);
1577								popup_next_prev(json_data[sid][sptp_id_list[sptp_array_key]], shortcodeId, 'true', sptp_Wrapper_ID);
1578							}
1579						});
1580						// Triggering Modal Prev.
1581						$(document).on('click', '.' + unique_uid + ' .sptp-nav-item.sptp-nav-prev', function (event) {
1582							event.preventDefault();
1583							event.stopPropagation();
1584							var that = $(this);
1585							var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1586							if (typeof sptp_id_list != 'undefined') {
1587								sptp_array_key = sptp_array_key_prev(sptp_array_key, sptp_id_length);
1588								popup_next_prev(json_data[sid][sptp_id_list[sptp_array_key]], shortcodeId, 'true', sptp_Wrapper_ID);
1589							}
1590						});
1591					});
1592				}
1593			});
1594		}
1595		// Modal popup.
1596		$('.sp-team-pro.sptp-modal').each(function () {
1597			var sptp_container = $(this),
1598				sptp_container_id = sptp_container.attr('id'),
1599				sptp_Wrapper_ID = '#' + sptp_container_id,
1600				shortcode_id_array = Array(),
1601				sid = $(sptp_Wrapper_ID).data('id');
1602			// Init popup after loading modal API.
1603			if (sptp_vars.load_type) {
1604				if (isElementInViewport(sptp_Wrapper_ID) && jQuery.inArray(sptp_Wrapper_ID, shortcode_id_array) == -1) {
1605					shortcode_id_array.push(sptp_Wrapper_ID);
1606					ajax_popup_init(sid, sptp_Wrapper_ID);
1607				}
1608				window.addEventListener('scroll', function () {
1609					if (isElementInViewport(sptp_Wrapper_ID) && jQuery.inArray(sptp_Wrapper_ID, shortcode_id_array) == -1) {
1610						shortcode_id_array.push(sptp_Wrapper_ID);
1611						ajax_popup_init(sid, sptp_Wrapper_ID);
1612					}
1613				}, true);
1614			} else {
1615				// Modal load by data attr.
1616				var sptp_id_list;
1617				var sptp_array_key;
1618				var sptp_id_length;
1619				// Triggering Modal next.
1620				$(document).on('click', '.sptp-nav-item.sptp-nav-next', function (event) {
1621					event.preventDefault();
1622					event.stopPropagation();
1623					var that = $(this);
1624					var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1625					if (typeof sptp_id_list != 'undefined') {
1626						sptp_array_key = sptp_array_key_next(sptp_array_key, sptp_id_length);
1627						var current_id = sptp_id_list[sptp_array_key];
1628						var $item = $('#' + shortcodeId + '.sptp-modal').find('.sp-team-pro-item[data-member="' + current_id + '"]').find('.modal-data').data('modal');
1629						popup_next_prev($item, shortcodeId, 'false');
1630					}
1631				});
1632				// Triggering Modal Prev.
1633				$(document).on('click', '.sptp-nav-item.sptp-nav-prev', function (event) {
1634					event.preventDefault();
1635					event.stopPropagation();
1636					var that = $(this);
1637					var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1638					if (typeof sptp_id_list != 'undefined') {
1639						sptp_array_key = sptp_array_key_prev(sptp_array_key, sptp_id_length);
1640						var current_id = sptp_id_list[sptp_array_key];
1641						var $item = $('#' + shortcodeId + '.sptp-modal').find('.sp-team-pro-item[data-member="' + current_id + '"]').find('.modal
1641-data').data('modal');
1642						popup_next_prev($item, shortcodeId, 'false');
1643					}
1644				});
1645				// Triggering modal.
1646				$(document).on('click', '.sptp-modal .sptp-member-avatar, .sptp-modal .sptp-member-read-more-button, .sptp-modal .member_name_clickable', function (e) {
1647					var custom_link = $(this).parents('.sptp-member:has(.custom-link)').length;
1648					if (custom_link) {
1649						return;
1650					}
1651					e.preventDefault();
1652					e.stopPropagation();
1653					e.stopImmediatePropagation();
1654					var that = $(this);
1655					var selector = that.parents('.sptp-modal');
1656					var modal_type = selector.data('modal-type');
1657					var layout = selector.data('layout');
1658					var pdfbtn = selector.data('pdfbtn');
1659					var icon_shape = selector.data('icon');
1660					var modalshow = selector.data('modalshow');
1661					var modalshow = modalshow.split(',');
1662					var shortcodeId = that.parents('.sp-team-pro').attr('id');
1663					memberId = that.parents('.sp-team-pro-item').data('member');
1664					sptp_id_list = sptp_post_id_list(selector);
1665					sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1666					sptp_id_length = sptp_id_list.length;
1667					var multiple_btn_style1 = '';
1668					var multiple_btn_style2 = '';
1669					var pdfbtn_text = '';
1670					var modal_navigation = '';
1671					if (pdfbtn) {
1672						pdfbtn_text = `<button id="sp-team-generate-pdf-file">Download PDF File</button>`;
1673					}
1674					if ('multiple' == modal_type) {
1675						modal_navigation = `<a href="#" class="sptp-nav-item sptp-nav-next"><i class="fa fa-angle-left"></i></a> <a href="#" class="sptp-nav-item sptp-nav-prev"><i class="fa fa-angle-right"></i></a>`;
1676					}
1677					multiple_btn_style1 = `<div class="sptp-popup-style1-navigation"> ` + modal_navigation + ` </div><button type="button" class="mfp-close"></button>`;
1678					multiple_btn_style2 = `<div class="sptp-popup-style2-navigation">  ` + modal_navigation + ` </div><button type="button" class="mfp-close"></button>`;
1679					var member_content = that.parents('.sp-team-pro-item').find('.modal-data').data('modal');
1680					// var customTextarea = document.createElement('textarea');
1681					// customTextarea.innerHTML = member_content;
1682					var $data = member_content;
1683					var $data = `<section class="sptp-popup-section ` + layout + `">` + multiple_btn_style1 + ` <div id="` + shortcodeId + `" class="sp-team-pro sptp-section ` + layout + ` popup-open"><div class="sptp-popup-header"> ` + multiple_btn_style2 + `
1684                    </div>
1685                    <button type="button" class="mfp-close"></button>
1686                <div class="sptp-popup-item sp-team-popup-item-section">` + $data + ` </div>
1687                `+ pdfbtn_text + `
1688            </div>
1689        </section>`;
1690					$.magnificPopup.open({
1691						type: 'inline',
1692						mainClass: 'popup-open',
1693						showCloseBtn: true,
1694						closeBtnInshortcode_ide: true,
1695						enableEscapeall_key: true,
1696						closeOnBgClick: true,
1697						fixedContentPos: true,
1698						fixedBgPos: true,
1699						items: {
1700							src: $data
1701						},
1702						callbacks: {
1703							open: function () {
1704								sptp_id_length = sptp_id_list.length;
1705								sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1706							}
1707						}
1708					});
1709					setTimeout(() => {
1710						$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1711							'opacity': '1',
1712							'transform': 'translate(-50%, -50%)'
1713						});
1714						$('.sp-team-pro.sptp-section.style-3.popup-open').css({
1715							'opacity': '1',
1716							'transform': 'translateX(0px)'
1717						});
1718						$('.sp-team-pro.sptp-section.style-4.popup-open').css({
1719							'opacity': '1',
1720							'transform': 'translate(-50%, 0px)'
1721						});
1722						$('.sp-team-pro.sptp-section.style-2.popup-open').css({
1723							'opacity': '1',
1724							'transform': 'translateX(0px)'
1725						});
1726						$('.sptp-popup-content-main.text-center').css({
1727							'opacity': '1',
1728							'transform': 'translateY(0px)'
1729						});
1730						gallery_caption_hover(shortcodeId);
1731						progressBarAnimation();
1732						team_pro_generate_pdf();
1733						var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1734						var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1735						var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1736						var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1737							loop: loop,
1738							autoplay: autoplay ? ({ delay: 5000 }) : false,
1739							navigation: {
1740								nextEl: '.sptp-button-next.swiper-button-next',
1741								prevEl: '.sptp-button-prev.swiper-button-prev',
1742							},
1743							// clickable: true,
1744							autoHeight: true,
1745							pagination: {
1746								el: '.sptp-pagination.swiper-pagination',
1747								clickable: true,
1748							}
1749						});
1750						var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1751						if (sptpPaginationSingle < 2) {
1752							$('.popup-open .sptp-pagination.swiper-pagination').hide();
1753						}
1754					}, 0);
1755				});
1756			}
1757		});
1758
1759		wpteam_lazyload();
1760	}
1761
1762	$(document).on("click", ".sptp-content-on-image .sptp-content", function (e) {
1763		if (!$(this).find('.sptp-member-social').hasClass('sptp-member-social')) {
1764			if (!$(this).parents('.sptp-drawer').hasClass('sptp-drawer')) {
1765				$(this)
1766					.parents(".sptp-content-on-image")
1767					.find(".sptp-image .sptp-member-avatar.sptp-popup-trigger")
1768					.trigger('click');
1769			}
1770		}
1771	});
1772
1773
1774	// Generate WP Team member PDF file.
1775	function team_pro_generate_pdf() {
1776		$("#sp-team-generate-pdf-file").on('click', function (e) {
1777			e.preventDefault();
1778			$("#sp-team-generate-pdf-file").css("display", "none");
1779			$(".sptp-popup-header").css("display", "none");
1780			$(".sptp-pagination,.sptp-button-next,.sptp-button-prev").css("display", "none");
1781			$(".sp-team-pro.sptp-section .sptp-popup-content-main .sptp-member-avatar-area").css({ "width": "400px", 'margin-bottom': '10px' });
1782			var item_section = $('.sptp-popup-item').hasClass('sp-team-popup-item-section');
1783
1784			if (item_section) {
1785				var element = $('.sp-team-pro.sptp-section')[0];
1786			} else {
1787				var element = $('.sptp-single-post')[0];
1788			}
1789			var oldTitle = document.title;
1790
1791			var member_name = $(element).find('.sptp-member-name')[0].innerText;
1792
1793			document.title = member_name.replace(' ', '-') + '-Wp-Team';
1794
1795			$(element).printThis({
1796				printContainer: false,
1797			});
1798
1799			setTimeout(function () {
1800				$('#sp-team-generate-pdf-file').show();
1801				$(".sptp-section.popup-open:not(.style-1) .sptp-popup-header").show();
1802				$(".sptp-pagination,.sptp-button-next,.sptp-button-prev").css("display", "block");
1803				document.title = oldTitle;
1804			}, 2000);
1805
1806		});
1807	}
1808	team_pro_generate_pdf();
1809
1810	$('.sp-wp-team-pro-wrapper').addClass('sp-wp-team-loaded');
1811});
1812
1813// Preloader js
1814var sptp_preloaders = document.querySelectorAll('.sp-team-pro.sptp-section');
1815document.querySelectorAll('.wp-team-pro-preloader').forEach(function (item) {
1816	item.style.opacity = '1';
1817})
1818sptp_preloaders.forEach(function (preloader) {
1819	window.addEventListener('load', function () {
1820		var preloaderId = preloader.id;
1821		var preloaderImg = preloader.querySelector('#' + preloaderId + ' .sp-team-pro-page-loading-image');
1822		if (preloaderImg != null) {
1823			preloaderImg.style.visibility = 'hidden';
1824		}
1825	})
1826})
1827

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.