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