PageSourceSearch

https://www.manchester.edu/wp-content/plugins/wp-team-pro/src/Frontend/js/script.js?ver=3.2.4

js manchester.edu collected 2026-09-24 09:28:35 UTC 69,886 bytes, 1,812 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				sptp_search_value = $(this).val();
898				sptp_ajax_actions('#' + sptp_container_id);
899			}, 500));
900
901			// Ajax number pagination.
902			if ($(sptp_Wrapper_ID + ".pagination_number").length > 0) {
903				$(sptp_Wrapper_ID + ".pagination_number").on('click', '.sptp-post-pagination a', function (e) {
904					e.preventDefault();
905					e.stopPropagation();
906					var that = $(this);
907					var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID)
908						.length,
909						currentPage = parseInt(
910							$('.sptp-post-pagination .current:not(.next, .prev)', sptp_Wrapper_ID).data('page')),
911						page = parseInt(that.data('page'));
912					if (that.hasClass('next')) {
913						if (totalPage > currentPage) {
914							var page = currentPage + 1
915						} else {
916							return
917						}
918					}
919					if (that.hasClass('prev')) {
920						if (currentPage > 1) {
921							var page = currentPage - 1
922						} else {
923							return
924						}
925					}
926					$.ajax({
927						type: 'POST',
928						url: sptp_vars.ajax_url,
929						data: {
930							value: sptp_search_value,
931							slug: sptp_filter_slug,
932							page: page,
933							generator_id: shortcodeId,
934							action: 'team_pro_search_member',
935							nonce: sptp_vars.nonce,
936						},
937						success: function (response) {
938							var $data = $(response);
939							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);
940
941							member_data.html($data);
942							// Carousel.
943							if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
944								carouselSlide();
945							}
946							// Masonry layout.
947							if ($(sptp_Wrapper_ID).hasClass("sptp-masonry")) {
948								var $post_wrapper = $(".sptp-row", sptp_Wrapper_ID);
949								$post_wrapper.masonry("destroy");
950								$post_wrapper.html($data).imagesLoaded(function () {
951									$post_wrapper.masonry();
952								});
953							}
954
955							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
956								$sptpgrid.isotope('insert', $data);
957							}
958							accordion_init();
959							// sptp_gridder_init();
960							sptp_item_same_height()
961							if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
962								$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
963									var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
964									if ($parent.length) {
965										$parent.css('overflow', 'visible');
966									}
967								});
968							}
969							// Thumbnail pager.
970							if ((sptp_Wrapper_ID + ' .sptp-thumbnail-page').length > 1) {
971								var galleryThumbs = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-thumbs', {
972									spaceBetween: 0,
973									slidesPerView: 10,
974									loop: false,
975									allowTouchMove: false,
976								});
977								var galleryTop = SwiperSlide(sptp_Wrapper_ID + ' .sptp-thumbnail-pager-sidebar', {
978									loop: false,
979									allowTouchMove: false,
980									effect: 'fade',
981									autoHeight: true,
982									thumbs: {
983										swiper: galleryThumbs,
984									}
985								});
986							}
987
988							var headerH = ($('body').hasClass('logged-in admin-bar')) ? 32 : 0;
989							var targetToID = $($data).parents('.sp-wp-team-pro-wrapper').offset().top - headerH;
990							$('html, body').animate({
991								scrollTop: targetToID + "px"
992							}, 500);
993
994							$('.page-numbers', sptp_Wrapper_ID).removeClass('current');
995							$('.page-numbers', sptp_Wrapper_ID).each(function () {
996								$('.sptp-post-pagination  a[data-page=' + page + ']', sptp_Wrapper_ID).addClass(
997									'current'
998								)
999							});
1000
1001							$('.next', sptp_Wrapper_ID).removeClass('current')
1002							$('.prev', sptp_Wrapper_ID).removeClass('current')
1003							$('.sptp-post-pagination a.current', sptp_Wrapper_ID).each(function () {
1004
1005								if (parseInt($(this).data('page')) === totalPage) {
1006									$('.next', sptp_Wrapper_ID).addClass('current');
1007								}
1008								if (parseInt($(this).data('page')) === 1) {
1009									$('.prev', sptp_Wrapper_ID).addClass('current');
1010								}
1011							})
1012							member_data.css('opacity', 1);
1013							wpteam_lazyload();
1014						}
1015					});
1016					if ($(sptp_Wrapper_ID + ' .sptp-row').hasClass('gridder')) {
1017						$.ajax({
1018							type: 'POST',
1019							url: sptp_vars.ajax_url,
1020							data: {
1021								value: sptp_search_value,
1022								slug: sptp_filter_slug,
1023								page: page,
1024								generator_id: shortcodeId,
1025								action: 'team_pro_drawer_content',
1026								nonce: sptp_vars.nonce,
1027							},
1028							success: function (response) {
1029								var $data = $(response);
1030								var member_data = $(sptp_Wrapper_ID + ' .sptp-drawer-items');
1031								member_data.html($data);
1032							}
1033						});
1034					}
1035				});
1036			}
1037			// Ajax load more and infinite scroll.
1038			var LoadMoreButton_text;
1039			if ($(sptp_Wrapper_ID + ".pagination_btn").length > 0 || $(sptp_Wrapper_ID + ".pagination_scrl").length > 0) {
1040				var EndingMessage = $(sptp_Wrapper_ID).find('.infinite-scroll-last');
1041				var ErrorMessage = $(sptp_Wrapper_ID).find('.infinite-scroll-error');
1042				var PageLoadStatus = $(sptp_Wrapper_ID).find('.page-load-status .loader-ellips.infinite-scroll-request');
1043				LoadMoreButton_text = $(sptp_Wrapper_ID).find('.sptp-post-load-more').data('buttontext')
1044				$('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing', 0);
1045				$(sptp_Wrapper_ID + ".pagination_btn, " + sptp_Wrapper_ID + ".pagination_scrl").on('click', '.sptp-post-load-more span', function (e) {
1046					e.preventDefault();
1047					e.stopPropagation();
1048					e.stopImmediatePropagation();
1049					PageLoadStatus.show();
1050					var that = $(this);
1051					var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID).length;
1052					var currentPage = parseInt($('.sptp-post-pagination .current:not(.next, .prev)', sptp_Wrapper_ID).data('page'));
1053					var page = currentPage + 1;
1054					$('.sptp-post-load-more', sptp_Wrapper_ID + '.pagination_scrl').attr('data-processing', 1);
1055					$.ajax({
1056						type: 'POST',
1057						url: sptp_vars.ajax_url,
1058						data: {
1059							value: sptp_search_value,
1060							slug: sptp_filter_slug,
1061							page: page,
1062							generator_id: shortcodeId,
1063							action: 'team_pro_search_member',
1064							nonce: sptp_vars.nonce,
1065						},
1066						success: function (response) {
1067							var $data = $(response);
1068							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');
1069							member_data.append($data);
1070							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
1071								$sptpgrid.isotope('appended', $data);
1072							}
1073							// Masonry Layout.
1074
1075							if ($(sptp_Wrapper_ID).hasClass("sptp-masonry")) {
1076								// Save current scroll position
1077								var scrollTop = $(window).scrollTop();
1078								var $post_wrapper = $(".sptp-row", sptp_Wrapper_ID);
1079								$post_wrapper.masonry("destroy");
1080								$post_wrapper.append($data).imagesLoaded(function () {
1081									$post_wrapper.masonry();
1082									// Restore scroll position after Masonry reinitialization.
1083									$(window).scrollTop(scrollTop);
1084								});
1085							}
1086							// Carousel.
1087							if ($(sptp_Wrapper_ID + ".sptp-carousel").length > 0) {
1088								carouselSlide();
1089							}
1090							accordion_init();
1091							sptp_item_same_height();
1092							if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
1093								$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1094									var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
1095									if ($parent.length) {
1096										$parent.css('overflow', 'visible');
1097									}
1098								});
1099							}
1100							if ($(sptp_Wrapper_ID + ".sptp-filter").length > 0) {
1101								$sptpgrid.isotope('layout');
1102							}
1103
1104							$('.page-numbers', sptp_Wrapper_ID).removeClass('current');
1105							$('.page-numbers', sptp_Wrapper_ID).each(function () {
1106								$('.sptp-post-pagination  a[data-page=' + page + ']', sptp_Wrapper_ID).addClass(
1107									'current'
1108								)
1109							});
1110
1111							$('.next', sptp_Wrapper_ID).removeClass('current')
1112							$('.prev', sptp_Wrapper_ID).removeClass('current')
1113							$('.sptp-post-pagination a.current', sptp_Wrapper_ID).each(function () {
1114
1115								if (parseInt($(this).data('page')) === totalPage) {
1116									$('.next', sptp_Wrapper_ID).addClass('current');
1117								}
1118								if (parseInt($(this).data('page')) === 1) {
1119									$('.prev', sptp_Wrapper_ID).addClass('current');
1120								}
1121							})
1122							if (totalPage == page) {
1123								$('.sptp-post-load-more span', sptp_Wrapper_ID).remove();
1124								EndingMessage.show();
1125							}
1126							PageLoadStatus.hide();
1127							$('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing', 0);
1128							wpteam_lazyload();
1129						}
1130					});
1131					if ($(sptp_Wrapper_ID + ' .sptp-row').hasClass('gridder')) {
1132						$.ajax({
1133							type: 'POST',
1134							url: sptp_vars.ajax_url,
1135							data: {
1136								value: sptp_search_value,
1137								slug: sptp_filter_slug,
1138								page: page,
1139								generator_id: shortcodeId,
1140								action: 'team_pro_drawer_content',
1141								nonce: sptp_vars.nonce,
1142							},
1143							success: function (response) {
1144								var $data = $(response);
1145								var member_data = $(sptp_Wrapper_ID + ' .sptp-drawer-items');
1146								member_data.append($data);
1147							}
1148						});
1149					}
1150				});
1151			}
1152			if ($(sptp_Wrapper_ID + ".pagination_scrl").length > 0) {
1153				var bufferBefore = Math.abs(10);
1154				var row = $('.sptp-row, table tbody, .sptp-accordion-items', sptp_Wrapper_ID);
1155				if (row.length) {
1156					$(window).on('scroll', function (e) {
1157						e.preventDefault();
1158						var TopAndContent = row.offset().top + row.outerHeight();
1159						var totalPage = $('.sptp-post-pagination a:not(.next, .prev)', sptp_Wrapper_ID).length;
1160						var areaLeft = TopAndContent - $(window).scrollTop();
1161						totalPage = totalPage + 1;
1162						if (areaLeft - bufferBefore < $(window).height()) {
1163							if ($('.sptp-post-load-more', sptp_Wrapper_ID).attr('data-processing') == 0) {
1164								$('.sptp-post-load-more span', sptp_Wrapper_ID).trigger('click');
1165							}
1166						}
1167					})
1168				}
1169			}
1170			if ($(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').length > 0) {
1171				$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1172					var $parent = $(this).parents('.sptp-member, .sptp-member-avatar');
1173					if ($parent.length) {
1174						$parent.css('overflow', 'visible');
1175					}
1176				});
1177			}
1178		})
1179
1180
1181		// Gallery caption image;
1182		function gallery_caption_hover(shortcodeId) {
1183			var sptp_gallery = $('#' + shortcodeId + " .swiper-slide");
1184			sptp_gallery.on('mousemove',
1185				function () {
1186					if ($(this).find('.sptp_gallery_image_caption').hasClass('sptp_gallery_image_caption')) {
1187						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1188							'bottom': '60px'
1189						})
1190					} else {
1191						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1192							'bottom': '10px'
1193						})
1194					}
1195				}
1196			);
1197			var sptp_gallery = $('#' + shortcodeId + " .sptp-member-avatar-area");
1198			sptp_gallery.on('mouseleave',
1199				function () {
1200					if ($(this).find('.sptp_gallery_image_caption').hasClass('sptp_gallery_image_caption')) {
1201						$('#' + shortcodeId + ".popup-open .sptp-pagination").css({
1202							'bottom': '10px'
1203						})
1204					}
1205				}
1206			);
1207		}
1208
1209		function sptp_post_id_list(selector) {
1210			var list = new Array()
1211			selector.find('.sp-team-pro-item')
1212				.each(function (index) {
1213					list.push($(this).data('member'))
1214				})
1215			return list
1216		}
1217		// Return array key number of a value.
1218		function sptp_val2key(val, array) {
1219			for (var all_key in array) {
1220				if (array[all_key] == val) {
1221					return all_key
1222				}
1223			}
1224			return false
1225		}
1226
1227		// Go to previous array key.
1228		function sptp_array_key_next(all_key, sptp_id_length) {
1229			all_key--
1230			if (all_key < 0) {
1231				all_key = sptp_id_length - 1
1232			}
1233			return all_key
1234		}
1235
1236		// Go to next array key.
1237		function sptp_array_key_prev(all_key, sptp_id_length) {
1238			all_key++
1239			if (all_key > sptp_id_length - 1) {
1240				all_key = 0
1241			}
1242			return all_key
1243		}
1244		// Progress bar animation on loading.
1245		function progressBarAnimation() {
1246			$(".sptp-progress-container").each(function () {
1247				var percent = $(this).data("title");
1248				$(this)
1249					.find(".sptp-progress-bar")
1250					.animate({
1251						width: percent
1252					},
1253						1000
1254					);
1255				var percentInt = parseInt(percent);
1256				if (percentInt >= 95) {
1257					$(this)
1258						.find(".sptp-top")
1259						.css("right", 0);
1260				}
1261				if (percentInt === 100) {
1262					$(this)
1263						.find(".sptp-top")
1264						.css("width", "40px");
1265				}
1266			});
1267		}
1268
1269		// Change Popup content on next prev button click.
1270		function popup_next_prev($data, shortcode_id, load_type, sptp_Wrapper_ID = '') {
1271			var selector = $('#' + shortcode_id + '.sptp-modal');
1272			var icon_shape = selector.data('icon');
1273			var modalshow = selector.data('modalshow');
1274			var modalshow = modalshow.split(',');
1275			if ('true' == load_type) {
1276				var $data = modal_json_to_plain_html($data, modalshow, icon_shape, sptp_Wrapper_ID);
1277			}
1278			var nextPrevContent = $('.sptp-popup-item');
1279			nextPrevContent.html($data);
1280			setTimeout(() => {
1281				var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1282				var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1283				var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1284				var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1285					loop: loop,
1286					autoplay: autoplay ? ({ delay: 5000 }) : false,
1287					navigation: {
1288						nextEl: '.sptp-button-next.swiper-button-next',
1289						prevEl: '.sptp-button-prev.swiper-button-prev',
1290					},
1291					autoHeight: true,
1292					pagination: {
1293						el: '.sptp-pagination.swiper-pagination',
1294						clickable: true,
1295					}
1296				});
1297				$('.sptp-popup-content-main.text-center').css({
1298					'opacity': '1',
1299					'transform': 'translateY(0px)',
1300					'transition': '.6s'
1301				})
1302
1303				$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1304					'transform': 'translate(-50%, -45%)',
1305					'opacity': '0',
1306					'visibility': 'hidden',
1307					'transition': '.2s'
1308				});
1309				var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1310				if (sptpPaginationSingle < 2) {
1311					$('.popup-open .sptp-pagination.swiper-pagination').hide();
1312				}
1313			}, 0);
1314
1315			setTimeout(() => {
1316				$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1317					'transform': 'translate(-50%, -50%)',
1318					'opacity': '1',
1319					'visibility': 'visible',
1320					'transition': '.4s'
1321				});
1322			}, 300);
1323			progressBarAnimation();
1324		}
1325
1326		// Modal option init with this function.
1327		function modal_json_to_plain_html(item, modalshow, icon_shape, sptp_Wrapper_ID) {
1328			var skeleton = $(sptp_Wrapper_ID + '+.sptp-skeleton').data('skeleton');
1329			var customdiv = document.createElement('div');
1330			customdiv.innerHTML = skeleton;
1331			// Member image.
1332			if ($.inArray("img", modalshow) != -1 && (typeof item.thumbs != "undefined") && item.thumbs.length > 1) {
1333				$(customdiv).find('.sptp-member-avatar-area .swiper-wrapper').append(item.thumbs)
1334			} else {
1335				$(customdiv).find('.sptp-member-avatar-area').remove();
1336			}
1337			// Member name.
1338			if ($.inArray("name", modalshow) != -1 && (typeof item.name != "undefined") && item.name.length > 1) {
1339				$(customdiv).find('.sptp-member-name .sptp-name').append(item.name);
1340			} else {
1341				$(customdiv).find('.sptp-member-name').remove();
1342			}
1343			// Member profession.
1344			if ($.inArray("position", modalshow) != -1 && (typeof item.job_title != "undefined") && item.job_title.length > 1) {
1345				$(customdiv).find('.sptp-member-profession .sptp-profession-text').append(item.job_title);
1346			} else {
1347				$(customdiv).find('.sptp-member-profession').remove();
1348			}
1349			// Member Description.
1350			if ($.inArray("desc", modalshow) != -1 && (typeof item.desc != "undefined") && item.desc.length > 1) {
1351				$(customdiv).find('.sptp-member-desc').append(item.desc);
1352			} else {
1353				$(customdiv).find('.sptp-member-desc').remove();
1354			}
1355			// Member Email.
1356			if ($.inArray("email", modalshow) != -1 && (typeof item.email != "undefined") && item.email.length > 1) {
1357				$(customdiv).find('.sptp-member-email').append(item.email);
1358			} else {
1359				$(customdiv).find('.sptp-member-email').remove();
1360			}
1361			// Member mobile.
1362			if ($.inArray("mobile", modalshow) != -1 && (typeof item.mobile != "undefined") && item.mobile.length > 1) {
1363				$(customdiv).find('.sptp-member-mobile').append(item.mobile);
1364			} else {
1365				$(customdiv).find('.sptp-member-mobile').remove();
1366			}
1367			// Member phone number.
1368			if ($.inArray("phone", modalshow) != -1 && (typeof item.phone != "undefined") && item.phone.length > 1) {
1369				$(customdiv).find('.sptp-member-phone').append(item.phone);
1370			} else {
1371				$(customdiv).find('.sptp-member-phone').remove();
1372			}
1373			// Member experience.
1374			if ($.inArray("experience", modalshow) != -1 && (typeof item.experience != "undefined") && item.experience.length > 1) {
1375				$(customdiv).find('.sptp-member-experience').append(item.experience);
1376			} else {
1377				$(customdiv).find('.sptp-member-experience').remove();
1378			}
1379			// Member location.
1380			if ($.inArray("location", modalshow) != -1 && (typeof item.location != "undefined") && item.location.length > 1) {
1381				$(customdiv).find('.sptp-member-location a').attr('href', `https://www.google.com/maps/search/?api=1&query=${item.location}`);
1382				$(customdiv).find('.sptp-member-location span').append(item.location);
1383			} else {
1384				$(customdiv).find('.sptp-member-location a').attr('href', `https://www.google.com/maps/search/?api=1&query=${item.location}`);
1385				$(customdiv).find('.sptp-member-location').remove();
1386			}
1387			// Member website.
1388			if ($.inArray("website", modalshow) != -1 && (typeof item.website != "undefined") && item.website.length > 1) {
1389				$(customdiv).find('.sptp-member-website').append(item.website);
1390			} else {
1391				$(customdiv).find('.sptp-member-website').remove();
1392			}
1393			// Member extra fields.
1394			if ($.inArray("extra_fields_switch", modalshow) != -1 && (typeof item.extra_fields != "undefined") && item.extra_fields.length > 1) {
1395				$(customdiv).find('.sptp-member-extra-fields').append(item.extra_fields);
1396			} else {
1397				$(customdiv).find('.sptp-member-extra-fields').remove();
1398			}
1399			// Member Skill.
1400			if ($.inArray("skills", modalshow) != -1 && (typeof item.skills != "undefined") && item.skills.length > 1) {
1401				$(customdiv).find('.sptp-member-skill-progress').append(item.skills);
1402			} else {
1403				$(customdiv).find('.sptp-member-skill-progress').remove();
1404			}
1405			// Member Social profiles.
1406			if ($.inArray("social_profiles", modalshow) != -1 && (typeof item.social != "undefined") && item.social.length > 1) {
1407				$(customdiv).find('.sptp-member-social ul').append(item.social);
1408			} else {
1409				$(customdiv).find('.sptp-member-social').remove();
1410			}
1411			// Member author posts.
1412			if ($.inArray("author_posts_detail", modalshow) != -1 && (typeof item.author_post != "undefined") && item.author_post.length > 1) {
1413				$(customdiv).find('.sptp-member-post ul').append(item.author_post);
1414			} else {
1415				$(customdiv).find('.sptp-member-post').remove();
1416			}
1417			// Social add class icon shape.
1418			$(customdiv).find('.sptp-member-social').removeClass('circle').addClass(icon_shape);
1419			var data = customdiv.innerHTML;
1420			customdiv.remove();
1421			return `<div class="sptp-popup-content-main text-center">` + data + `</div>`;
1422		}
1423
1424		// Check Element in viewport.
1425		function isElementInViewport(el) {
1426			var elementTop = $(el).offset().top;
1427			var elementBottom = elementTop + $(el).outerHeight();
1428			var viewportTop = $(window).scrollTop();
1429			var viewportBottom = viewportTop + $(window).height();
1430			return elementBottom > viewportTop && elementTop < viewportBottom;
1431		};
1432		// Popup init function.
1433		function ajax_popup_init(sid, sptp_Wrapper_ID) {
1434			var json_data = Array();
1435			var rest_url = $(sptp_Wrapper_ID + '.sptp-modal').data('rest-url');
1436			$.ajax({
1437				url: rest_url + sid,
1438				async: true,
1439				dataType: 'json',
1440				success: function (response) {
1441					json_data[sid] = response;
1442					var sptp_id_list;
1443					var sptp_array_key;
1444					var sptp_id_length;
1445					// Triggering modal.
1446					$(document).on('click', sptp_Wrapper_ID + '.sptp-modal .sptp-member-
1446avatar:not(.custom-link),' + sptp_Wrapper_ID + '.sptp-modal .sptp-member-read-more-button, ' + sptp_Wrapper_ID + '.sptp-modal .member_name_clickable', function (e) {
1447						var custom_link = $(this).parents('.sptp-member:has(.custom-link)').length;
1448						if (custom_link) {
1449							return;
1450						}
1451						e.preventDefault();
1452						e.stopPropagation();
1453						e.stopImmediatePropagation();
1454						var that = $(this);
1455						var selector = $(sptp_Wrapper_ID + '.sptp-modal');
1456						var modal_type = selector.data('modal-type');
1457						var layout = selector.data('layout');
1458						var pdfbtn = selector.data('pdfbtn');
1459						var icon_shape = selector.data('icon');
1460						var modalshow = selector.data('modalshow');
1461						var modalshow = modalshow.split(',');
1462						var shortcodeId = that.parents('.sp-team-pro').attr('id');
1463						var unique_uid = Date.now();
1464						memberId = that.parents('.sp-team-pro-item').data('member');
1465						sptp_id_list = sptp_post_id_list(selector);
1466						sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1467						sptp_id_length = sptp_id_list.length;
1468						var multiple_btn_style1 = '';
1469						var multiple_btn_style2 = '';
1470						var pdfbtn_text = '';
1471						if (pdfbtn) {
1472							pdfbtn_text = `<button id="sp-team-generate-pdf-file">Download PDF File</button>`;
1473						}
1474						if ('multiple' == modal_type) {
1475							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>`;
1476							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>`;
1477						}
1478						// json_data[sid]
1479						var $item = json_data[sid][memberId];
1480						var $data = modal_json_to_plain_html($item, modalshow, icon_shape, sptp_Wrapper_ID);
1481						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>`;
1482						$.magnificPopup.open({
1483							type: 'inline',
1484							mainClass: 'sptp-popup popup-open',
1485							showCloseBtn: true,
1486							closeBtnInshortcode_ide: true,
1487							enableEscapeall_key: true,
1488							closeOnBgClick: true,
1489							fixedContentPos: true,
1490							fixedBgPos: true,
1491							items: {
1492								src: $data
1493							},
1494							callbacks: {
1495								open: function () {
1496									sptp_id_length = sptp_id_list.length;
1497									sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1498								}
1499							}
1500						});
1501						setTimeout(() => {
1502							$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1503								'opacity': '1',
1504								'transform': 'translate(-50%, -50%)'
1505							});
1506							$('.sp-team-pro.sptp-section.style-3.popup-open').css({
1507								'opacity': '1',
1508								'transform': 'translateX(0px)'
1509							});
1510							$('.sp-team-pro.sptp-section.style-4.popup-open').css({
1511								'opacity': '1',
1512								'transform': 'translate(-50%, 0px)'
1513							});
1514							$('.sp-team-pro.sptp-section.style-2.popup-open').css({
1515								'opacity': '1',
1516								'transform': 'translateX(0px)'
1517							});
1518							$('.sptp-popup-content-main.text-center').css({
1519								'opacity': '1',
1520								'transform': 'translateY(0px)'
1521							});
1522							gallery_caption_hover(shortcodeId);
1523							progressBarAnimation();
1524							team_pro_generate_pdf();
1525							var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1526							var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1527							var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1528							var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1529								loop: loop,
1530								autoplay: autoplay ? ({ delay: 5000 }) : false,
1531								navigation: {
1532									nextEl: '.sptp-button-next.swiper-button-next',
1533									prevEl: '.sptp-button-prev.swiper-button-prev',
1534								},
1535								// clickable: true,
1536								autoHeight: true,
1537								pagination: {
1538									el: '.sptp-pagination.swiper-pagination',
1539									clickable: true,
1540								}
1541							});
1542							var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1543							if (sptpPaginationSingle < 2) {
1544								$('.popup-open .sptp-pagination.swiper-pagination').hide();
1545							}
1546							$(sptp_Wrapper_ID + ' .sptp-special-tag.top-ribbon').each(function () {
1547								var $parent = $(this).parents('.sptp-popup-section .sptp-member-avatar-area .sptp-popup-carousel');
1548								if ($parent.length) {
1549									$parent.css('overflow', 'visible');
1550								}
1551							});
1552						}, 0);
1553
1554						// Triggering Modal next.
1555						$(document).on('click', '.' + unique_uid + ' .sptp-nav-item.sptp-nav-next', function (event) {
1556							event.preventDefault();
1557							event.stopPropagation();
1558							var that = $(this);
1559							var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1560							if (typeof sptp_id_list != 'undefined') {
1561								sptp_array_key = sptp_array_key_next(sptp_array_key, sptp_id_length);
1562								popup_next_prev(json_data[sid][sptp_id_list[sptp_array_key]], shortcodeId, 'true', sptp_Wrapper_ID);
1563							}
1564						});
1565						// Triggering Modal Prev.
1566						$(document).on('click', '.' + unique_uid + ' .sptp-nav-item.sptp-nav-prev', function (event) {
1567							event.preventDefault();
1568							event.stopPropagation();
1569							var that = $(this);
1570							var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1571							if (typeof sptp_id_list != 'undefined') {
1572								sptp_array_key = sptp_array_key_prev(sptp_array_key, sptp_id_length);
1573								popup_next_prev(json_data[sid][sptp_id_list[sptp_array_key]], shortcodeId, 'true', sptp_Wrapper_ID);
1574							}
1575						});
1576					});
1577				}
1578			});
1579		}
1580		// Modal popup.
1581		$('.sp-team-pro.sptp-modal').each(function () {
1582			var sptp_container = $(this),
1583				sptp_container_id = sptp_container.attr('id'),
1584				sptp_Wrapper_ID = '#' + sptp_container_id,
1585				shortcode_id_array = Array(),
1586				sid = $(sptp_Wrapper_ID).data('id');
1587			// Init popup after loading modal API.
1588			if (sptp_vars.load_type) {
1589				if (isElementInViewport(sptp_Wrapper_ID) && jQuery.inArray(sptp_Wrapper_ID, shortcode_id_array) == -1) {
1590					shortcode_id_array.push(sptp_Wrapper_ID);
1591					ajax_popup_init(sid, sptp_Wrapper_ID);
1592				}
1593				window.addEventListener('scroll', function () {
1594					if (isElementInViewport(sptp_Wrapper_ID) && jQuery.inArray(sptp_Wrapper_ID, shortcode_id_array) == -1) {
1595						shortcode_id_array.push(sptp_Wrapper_ID);
1596						ajax_popup_init(sid, sptp_Wrapper_ID);
1597					}
1598				}, true);
1599			} else {
1600				// Modal load by data attr.
1601				var sptp_id_list;
1602				var sptp_array_key;
1603				var sptp_id_length;
1604				// Triggering Modal next.
1605				$(document).on('click', '.sptp-nav-item.sptp-nav-next', function (event) {
1606					event.preventDefault();
1607					event.stopPropagation();
1608					var that = $(this);
1609					var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1610					if (typeof sptp_id_list != 'undefined') {
1611						sptp_array_key = sptp_array_key_next(sptp_array_key, sptp_id_length);
1612						var current_id = sptp_id_list[sptp_array_key];
1613						var $item = $('#' + shortcodeId + '.sptp-modal').find('.sp-team-pro-item[data-member="' + current_id + '"]').find('.modal-data').data('modal');
1614						popup_next_prev($item, shortcodeId, 'false');
1615					}
1616				});
1617				// Triggering Modal Prev.
1618				$(document).on('click', '.sptp-nav-item.sptp-nav-prev', function (event) {
1619					event.preventDefault();
1620					event.stopPropagation();
1621					var that = $(this);
1622					var shortcodeId = that.parents('.mfp-content').find('.sp-team-pro').attr('id');
1623					if (typeof sptp_id_list != 'undefined') {
1624						sptp_array_key = sptp_array_key_prev(sptp_array_key, sptp_id_length);
1625						var current_id = sptp_id_list[sptp_array_key];
1626						var $item = $('#' + shortcodeId + '.sptp-modal').find('.sp-team-pro-item[data-member="' + current_id + '"]').find('.modal
1626-data').data('modal');
1627						popup_next_prev($item, shortcodeId, 'false');
1628					}
1629				});
1630				// Triggering modal.
1631				$(document).on('click', '.sptp-modal .sptp-member-avatar, .sptp-modal .sptp-member-read-more-button, .sptp-modal .member_name_clickable', function (e) {
1632					var custom_link = $(this).parents('.sptp-member:has(.custom-link)').length;
1633					if (custom_link) {
1634						return;
1635					}
1636					e.preventDefault();
1637					e.stopPropagation();
1638					e.stopImmediatePropagation();
1639					var that = $(this);
1640					var selector = that.parents('.sptp-modal');
1641					var modal_type = selector.data('modal-type');
1642					var layout = selector.data('layout');
1643					var pdfbtn = selector.data('pdfbtn');
1644					var icon_shape = selector.data('icon');
1645					var modalshow = selector.data('modalshow');
1646					var modalshow = modalshow.split(',');
1647					var shortcodeId = that.parents('.sp-team-pro').attr('id');
1648					memberId = that.parents('.sp-team-pro-item').data('member');
1649					sptp_id_list = sptp_post_id_list(selector);
1650					sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1651					sptp_id_length = sptp_id_list.length;
1652					var multiple_btn_style1 = '';
1653					var multiple_btn_style2 = '';
1654					var pdfbtn_text = '';
1655					var modal_navigation = '';
1656					if (pdfbtn) {
1657						pdfbtn_text = `<button id="sp-team-generate-pdf-file">Download PDF File</button>`;
1658					}
1659					if ('multiple' == modal_type) {
1660						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>`;
1661					}
1662					multiple_btn_style1 = `<div class="sptp-popup-style1-navigation"> ` + modal_navigation + ` </div><button type="button" class="mfp-close"></button>`;
1663					multiple_btn_style2 = `<div class="sptp-popup-style2-navigation">  ` + modal_navigation + ` </div><button type="button" class="mfp-close"></button>`;
1664					var member_content = that.parents('.sp-team-pro-item').find('.modal-data').data('modal');
1665					// var customTextarea = document.createElement('textarea');
1666					// customTextarea.innerHTML = member_content;
1667					var $data = member_content;
1668					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 + `
1669                    </div>
1670                    <button type="button" class="mfp-close"></button>
1671                <div class="sptp-popup-item sp-team-popup-item-section">` + $data + ` </div>
1672                `+ pdfbtn_text + `
1673            </div>
1674        </section>`;
1675					$.magnificPopup.open({
1676						type: 'inline',
1677						mainClass: 'popup-open',
1678						showCloseBtn: true,
1679						closeBtnInshortcode_ide: true,
1680						enableEscapeall_key: true,
1681						closeOnBgClick: true,
1682						fixedContentPos: true,
1683						fixedBgPos: true,
1684						items: {
1685							src: $data
1686						},
1687						callbacks: {
1688							open: function () {
1689								sptp_id_length = sptp_id_list.length;
1690								sptp_array_key = sptp_val2key(memberId, sptp_id_list);
1691							}
1692						}
1693					});
1694					setTimeout(() => {
1695						$('.sp-team-pro.sptp-section.style-1.popup-open').css({
1696							'opacity': '1',
1697							'transform': 'translate(-50%, -50%)'
1698						});
1699						$('.sp-team-pro.sptp-section.style-3.popup-open').css({
1700							'opacity': '1',
1701							'transform': 'translateX(0px)'
1702						});
1703						$('.sp-team-pro.sptp-section.style-4.popup-open').css({
1704							'opacity': '1',
1705							'transform': 'translate(-50%, 0px)'
1706						});
1707						$('.sp-team-pro.sptp-section.style-2.popup-open').css({
1708							'opacity': '1',
1709							'transform': 'translateX(0px)'
1710						});
1711						$('.sptp-popup-content-main.text-center').css({
1712							'opacity': '1',
1713							'transform': 'translateY(0px)'
1714						});
1715						gallery_caption_hover(shortcodeId);
1716						progressBarAnimation();
1717						team_pro_generate_pdf();
1718						var modelCarouselData = $('.sptp-popup-carousel').data('carousel');
1719						var autoplay = modelCarouselData ? modelCarouselData.autoplay : false;
1720						var loop = $('.sptp-popup-carousel .swiper-slide:not(.swiper-slide-duplicate )').length > 1 ? true : false;
1721						var modal_swiper = SwiperSlide('.sptp-popup-carousel', {
1722							loop: loop,
1723							autoplay: autoplay ? ({ delay: 5000 }) : false,
1724							navigation: {
1725								nextEl: '.sptp-button-next.swiper-button-next',
1726								prevEl: '.sptp-button-prev.swiper-button-prev',
1727							},
1728							// clickable: true,
1729							autoHeight: true,
1730							pagination: {
1731								el: '.sptp-pagination.swiper-pagination',
1732								clickable: true,
1733							}
1734						});
1735						var sptpPaginationSingle = $('.popup-open .sptp-pagination.swiper-pagination').children().length;
1736						if (sptpPaginationSingle < 2) {
1737							$('.popup-open .sptp-pagination.swiper-pagination').hide();
1738						}
1739					}, 0);
1740				});
1741			}
1742		});
1743
1744		wpteam_lazyload();
1745	}
1746
1747	$(document).on("click", ".sptp-content-on-image .sptp-content", function (e) {
1748		if (!$(this).find('.sptp-member-social').hasClass('sptp-member-social')) {
1749			if (!$(this).parents('.sptp-drawer').hasClass('sptp-drawer')) {
1750				$(this)
1751					.parents(".sptp-content-on-image")
1752					.find(".sptp-image .sptp-member-avatar.sptp-popup-trigger")
1753					.trigger('click');
1754			}
1755		}
1756	});
1757
1758
1759	// Generate WP Team member PDF file.
1760	function team_pro_generate_pdf() {
1761		$("#sp-team-generate-pdf-file").on('click', function (e) {
1762			e.preventDefault();
1763			$("#sp-team-generate-pdf-file").css("display", "none");
1764			$(".sptp-popup-header").css("display", "none");
1765			$(".sptp-pagination,.sptp-button-next,.sptp-button-prev").css("display", "none");
1766			$(".sp-team-pro.sptp-section .sptp-popup-content-main .sptp-member-avatar-area").css({ "width": "400px", 'margin-bottom': '10px' });
1767			var item_section = $('.sptp-popup-item').hasClass('sp-team-popup-item-section');
1768
1769			if (item_section) {
1770				var element = $('.sp-team-pro.sptp-section')[0];
1771			} else {
1772				var element = $('.sptp-single-post')[0];
1773			}
1774			var oldTitle = document.title;
1775
1776			var member_name = $(element).find('.sptp-member-name')[0].innerText;
1777
1778			document.title = member_name.replace(' ', '-') + '-Wp-Team';
1779
1780			$(element).printThis({
1781				printContainer: false,
1782			});
1783
1784			setTimeout(function () {
1785				$('#sp-team-generate-pdf-file').show();
1786				$(".sptp-section.popup-open:not(.style-1) .sptp-popup-header").show();
1787				$(".sptp-pagination,.sptp-button-next,.sptp-button-prev").css("display", "block");
1788				document.title = oldTitle;
1789			}, 2000);
1790
1791		});
1792	}
1793	team_pro_generate_pdf();
1794
1795	$('.sp-wp-team-pro-wrapper').addClass('sp-wp-team-loaded');
1796});
1797
1798// Preloader js
1799var sptp_preloaders = document.querySelectorAll('.sp-team-pro.sptp-section');
1800document.querySelectorAll('.wp-team-pro-preloader').forEach(function (item) {
1801	item.style.opacity = '1';
1802})
1803sptp_preloaders.forEach(function (preloader) {
1804	window.addEventListener('load', function () {
1805		var preloaderId = preloader.id;
1806		var preloaderImg = preloader.querySelector('#' + preloaderId + ' .sp-team-pro-page-loading-image');
1807		if (preloaderImg != null) {
1808			preloaderImg.style.visibility = 'hidden';
1809		}
1810	})
1811})
1812

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.