1(function ($, elementor) { 2 "use strict"; 3 var getElementSettings = function( $element ) { 4 var elementSettings = {}, 5 modelCID = $element.data( 'model-cid' ); 6 7 if ( isEditMode && modelCID ) { 8 var settings = elementorFrontend.config.elements.data[ modelCID ], 9 settingsKeys = elementorFrontend.config.elements.keys[ settings.attributes.widgetType || settings.attributes.elType ]; 10 11 jQuery.each( settings.getActiveControls(), function( controlKey ) { 12 if ( -1 !== settingsKeys.indexOf( controlKey ) ) { 13 elementSettings[ controlKey ] = settings.attributes[ controlKey ]; 14 } 15 } ); 16 } else { 17 elementSettings = $element.data('settings') || {}; 18 } 19 20 return elementSettings; 21 }; 22 var isEditMode = false; 23 24 function getHeaderHeight(){ 25 var _height = 0; 26 var $stickySection = $('.elementor-location-header .elementor-top-section[data-settings*="sticky_on"]'); 27 if($stickySection.length){ 28 _height = $stickySection.innerHeight(); 29 } 30 return _height; 31 } 32 33 function checkHeaderHeight(){ 34 document.documentElement.style.setProperty('--kitify-header-height', getHeaderHeight() + 'px'); 35 } 36 37 document.addEventListener('DOMContentLoaded', function () { 38 document.body.classList.add('kitify--js-ready'); 39 checkHeaderHeight(); 40 if(!Kitify.isPageSpeed()){ 41 Kitify.localCache.validCache(false); 42 Kitify.ajaxTemplateHelper.init(); 43 $('.col-row').each(function (){ 44 if($(this).closest('[data-kitify_ajax_loadtemplate]').length == 0){ 45 $(this).trigger('kitify/LazyloadSequenceEffects'); 46 } 47 }) 48 } 49 }); 50 $(window).on('load', function (){ 51 $('.template-loaded[data-kitify_ajax_loadtemplate="true"] .col-row').trigger('kitify/LazyloadSequenceEffects'); 52 }); 53 54 $(document).on('kitify/LazyloadSequenceEffects', '.col-row, .swiper-container', function (e){ 55 var $this = $(this); 56 if( $this.hasClass('swiper-container') ){ 57 Kitify.LazyLoad( $this, {rootMargin: '0px'} ).observe(); 58 } 59 else{ 60 Kitify.LazyLoad( $('>*', $this), {rootMargin: '0px'} ).observe(); 61 } 62 }); 63 $(window).on('load resize', checkHeaderHeight); 64 65 $(document).on('kitify/woocommerce/single/init_product_slider', function (e, slider) { 66 slider.controlNav.eq(slider.animatingTo).closest('li').get(0).scrollIntoView({ 67 inline: "center", 68 block: "nearest", 69 behavior: "smooth" 70 }); 71 slider.viewport.closest('.woocommerce-product-gallery').css('--singleproduct-thumbs-height', slider.viewport.height() + 'px'); 72 }); 73 var Kitify = { 74 log: function (...data){ 75 if(window.KitifySettings.devMode === 'true'){ 76 console.log(...data); 77 } 78 }, 79 addedScripts: {}, 80 addedStyles: {}, 81 addedAssetsPromises: [], 82 carouselInited: [], 83 swiperInstances: {}, 84 localCache: { 85 cache_key: typeof KitifySettings.themeName !== "undefined" ? KitifySettings.themeName : 'kitify', 86 /** 87 * timeout for cache in seconds, default 5 mins 88 * @type {number} 89 */ 90 timeout: typeof KitifySettings.cache_ttl !== "undefined" && parseInt(KitifySettings.cache_ttl) > 0 ? parseInt(KitifySettings.cache_ttl) : (60 * 5), 91 timeout2: 60 * 10, 92 /** 93 * @type {{_: number, data: {}}} 94 **/ 95 data:{}, 96 remove: function (url) { 97 delete Kitify.localCache.data[url]; 98 }, 99 exist: function (url) { 100 return !!Kitify.localCache.data[url] && ((Date.now() - Kitify.localCache.data[url]._) / 1000 < Kitify.localCache.timeout2); 101 }, 102 get: function (url) { 103 //Kitify.log('Get cache for ' + url); 104 return Kitify.localCache.data[url].data; 105 }, 106 set: function (url, cachedData, callback) { 107 Kitify.localCache.remove(url); 108 Kitify.localCache.data[url] = { 109 _: Date.now(), 110 data: cachedData 111 }; 112 if ("function" == typeof callback && "number" != typeof callback.nodeType) { 113 callback(cachedData) 114 } 115 }, 116 hashCode: function (s){ 117 var hash = 0; 118 s = s.toString(); 119 if (s.length == 0) return hash; 120 121 for (var i = 0; i < s.length; i++) {
122 var char = s.charCodeAt(i); 123 hash = (hash << 5) - hash + char; 124 hash = hash & hash; // Convert to 32bit integer 125 } 126 127 return Math.abs(hash); 128 }, 129 validCache: function ( force ){ 130 var expiry = typeof KitifySettings.local_ttl !== "undefined" && parseInt(KitifySettings.local_ttl) > 0 ? parseInt(KitifySettings.local_ttl) : 60 * 30; // 30 mins 131 var cacheKey = Kitify.localCache.cache_key + '_cache_timeout' + Kitify.localCache.hashCode(KitifySettings.homeURL); 132 try{ 133 var whenCached = localStorage.getItem(cacheKey); 134 if (whenCached !== null || force) { 135 var age = (Date.now() - whenCached) / 1000; 136 if (age > expiry || force) { 137 Object.keys(localStorage).forEach(function (key) { 138 if (key.indexOf(Kitify.localCache.cache_key) === 0) { 139 localStorage.removeItem(key); 140 } 141 }); 142 localStorage.setItem(cacheKey, Date.now()); 143 } 144 } else { 145 localStorage.setItem(cacheKey, Date.now()); 146 } 147 } 148 catch (ex) { 149 Kitify.log(ex); 150 } 151 } 152 }, 153 isPageSpeed: function () { 154 return (typeof navigator !== "undefined" && (/(lighthouse|gtmetrix)/i.test(navigator.userAgent.toLocaleLowerCase()) || /mozilla\/5\.0 \(x11; linux x86_64\)/i.test(navigator.userAgent.toLocaleLowerCase()))); 155 }, 156 addQueryArg: function (url, key, value) { 157 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 158 var separator = url.indexOf('?') !== -1 ? "&" : "?"; 159 160 if (url.match(re)) { 161 return url.replace(re, '$1' + key + "=" + value + '$2'); 162 } else { 163 return url + separator + key + "=" + value; 164 } 165 }, 166 getUrlParameter: function (name, url) { 167 if (!url) url = window.location.href; 168 name = name.replace(/[\[\]]/g, "\\$&"); 169 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 170 results = regex.exec(url); 171 if (!results) return null; 172 if (!results[2]) return ''; 173 return decodeURIComponent(results[2].replace(/\+/g, " ")); 174 }, 175 parseQueryString: function (query) { 176 var urlparts = query.split("?"); 177 var query_string = {}; 178 179 if (urlparts.length >= 2) { 180 var vars = urlparts[1].split("&"); 181 182 for (var i = 0; i < vars.length; i++) { 183 var pair = vars[i].split("="); 184 var key = decodeURIComponent(pair[0]); 185 var value = decodeURIComponent(pair[1]); // If first entry with this name 186 187 if (typeof query_string[key] === "undefined") { 188 query_string[key] = decodeURIComponent(value); // If second entry with this name 189 } else if (typeof query_string[key] === "string") { 190 var arr = [query_string[key], decodeURIComponent(value)]; 191 query_string[key] = arr; // If third or later entry with this name 192 } else { 193 query_string[key].push(decodeURIComponent(value)); 194 } 195 } 196 } 197 198 return query_string; 199 }, 200 removeURLParameter: function (url, parameter) { 201 let urlparts = url?.split('?') ?? []; 202 203 if (urlparts.length >= 2) { 204 let prefix = encodeURIComponent(parameter) + '='; 205 let pars = urlparts[1].split(/[&;]/g); //reverse iteration as may be destructive 206 207 for (let i = pars.length; i-- > 0;) { 208 //idiom for string.startsWith 209 if (pars[i].lastIndexOf(prefix, 0) !== -1) { 210 pars.splice(i, 1); 211 } 212 } 213 214 url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ""); 215 return url; 216 } else { 217 return url; 218 } 219 }, 220 initCarousel: function ($scope) { 221 222 let $carousel = $scope.find('.kitify-carousel').first(); 223 224 if ($carousel.length === 0) { 225 return; 226 } 227 228 const $swiperContainer = $carousel.find('>.swiper-container, >div>.swiper-container').first(); 229 230 if ($swiperContainer.length === 0) { 231 return; 232 } 233 234 if ($carousel.hasClass('inited')) { 235 return; 236 } 237 238 const totalSlides = $carousel.find('.swiper-wrapper').first().find('.swiper-slide').length; 239 240 $carousel.addClass('inited'); 241 242 const isSwiperLatest = elementorFrontendConfig.experimentalFeatures.e_swiper_latest || false; 243 244 let elementSettings = $carousel.data('slider_options'), 245 slidesToShow = parseInt(elementSettings.slidesToShow.desktop) || 1, 246 elementorBreakpoints = elementorFrontend.config.responsive.activeBreakpoints, 247 carousel_id = elementSettings.uniqueID, 248 eUniqueId = $carousel.closest('.elementor-element').data('id'), 249 e_dRows = parseInt(elementSettings.rows.desktop || 1); 250 251 let swiperOptions = { 252 slidesPerView: slidesToShow, 253 loop: elementSettings.infinite, 254 speed: elementSettings.speed, 255 handleElementorBreakpoints: true, 256 slidesPerGroup: parseInt(elementSettings.slidesToScroll.desktop || 1), 257 loopAdditionalSlides: 1, 258 loopFillGroupWithBlank: 1, 259 loopedSlides: 4, 260 preloadImages: false, 261 ...( isSwiperLatest ? { 262 grid: { 263 rows: e_dRows, 264 fill: 'row' 265 } 266 } : { 267 slidesPerColumn: e_dRows, 268 }), 269 ...(e_dRows > 1 ? { rewind: elementSettings.infinite, loop: false } : {}) 270 } 271 272 swiperOptions.breakpoints = {}; 273 274 let lastBreakpointSlidesToShowValue = 1; 275 let defaultLGDevicesSlidesCount = 1;
276 Object.keys(elementorBreakpoints).reverse().forEach(function (breakpointName) { 277 // Tablet has a specific default `slides_to_show`. 278 let defaultSlidesToShow = 'tablet' === breakpointName ? defaultLGDevicesSlidesCount : lastBreakpointSlidesToShowValue; 279 swiperOptions.breakpoints[elementorBreakpoints[breakpointName].value] = { 280 slidesPerView: +elementSettings.slidesToShow[breakpointName] || defaultSlidesToShow, 281 slidesPerGroup: +elementSettings.slidesToScroll[breakpointName] || 1, 282 ...( isSwiperLatest ? { 283 grid: { 284 rows: +elementSettings.rows[breakpointName] || 1, 285 fill: 'row' 286 } 287 } : { 288 slidesPerColumn: +elementSettings.rows[breakpointName] || 1, 289 } ) 290 } 291 lastBreakpointSlidesToShowValue = +elementSettings.slidesToShow[breakpointName] || defaultSlidesToShow; 292 }); 293 294 if (elementSettings.autoplay) { 295 swiperOptions.autoplay = { 296 delay: (elementSettings.effect === 'slide' && elementSettings.infiniteEffect ? 0 : elementSettings.autoplaySpeed), 297 disableOnInteraction: elementSettings.pauseOnInteraction, 298 pauseOnMouseEnter: elementSettings.pauseOnHover, 299 reverseDirection: elementSettings.reverseDirection || false, 300 } 301 if(elementSettings.effect === 'slide' && elementSettings.infiniteEffect){ 302 swiperOptions.freeMode = { 303 enable: true 304 }; 305 $carousel.addClass('kitify--linear-effect'); 306 if(swiperOptions.slidesPerView === 1){ 307 swiperOptions.slidesPerView = 'auto'; 308 swiperOptions.breakpoints = {}; 309 $carousel.addClass('kitify--linear-effect-auto'); 310 } 311 } 312 } 313 if (elementSettings.centerMode) { 314 swiperOptions.centerInsufficientSlides = true; 315 swiperOptions.centeredSlides = true; 316 swiperOptions.centeredSlidesBounds = false; 317 } 318 319 switch (elementSettings.effect) { 320 case 'fade': 321 if (slidesToShow === 1) { 322 swiperOptions.effect = elementSettings.effect; 323 swiperOptions.fadeEffect = { 324 crossFade: true 325 }; 326 } 327 break; 328 329 case 'coverflow': 330 swiperOptions.effect = 'coverflow'; 331 swiperOptions.grabCursor = true; 332 swiperOptions.centeredSlides = true; 333 swiperOptions.slidesPerView = 'auto'; 334 swiperOptions.coverflowEffect = { 335 rotate: 50, 336 stretch: 0, 337 depth: 100, 338 modifier: 1, 339 slideShadows: true 340 }; 341 swiperOptions.coverflowEffect = $.extend( {}, { 342 rotate: 0, 343 stretch: 100, 344 depth: 100, 345 modifier: 2.6, 346 scale: 1, 347 slideShadows : true 348 }, elementSettings.coverflowEffect ) 349 break; 350 351 case 'cube': 352 swiperOptions.effect = 'cube'; 353 swiperOptions.grabCursor = true; 354 swiperOptions.cubeEffect = { 355 shadow: true, 356 slideShadows: true, 357 shadowOffset: 20, 358 shadowScale: 0.94, 359 } 360 swiperOptions.slidesPerView = 1; 361 swiperOptions.slidesPerGroup = 1; 362 break; 363 364 case 'flip': 365 swiperOptions.effect = 'flip'; 366 swiperOptions.grabCursor = true; 367 swiperOptions.slidesPerView = 1; 368 swiperOptions.slidesPerGroup = 1; 369 break; 370 371 case 'slide': 372 swiperOptions.effect = 'slide'; 373 swiperOptions.grabCursor = true; 374 break; 375 376 case 'cards': 377 swiperOptions.effect = 'cards'; 378 swiperOptions.grabCursor = true; 379 swiperOptions.cardsEffect = { 380 perSlideOffset: 8, 381 perSlideRotate: 2, 382 rotate: true, 383 slideShadows: true, 384 } 385 break; 386 387 case 'creative': 388 swiperOptions.effect = 'creative'; 389 swiperOptions.grabCursor = true; 390 swiperOptions.creativeEffect = { 391 limitProgress: 1, 392 progressMultiplier: 1, 393 prev: { 394 shadow: false, 395 translate: ["-120%", 0, -500], 396 }, 397 next: { 398 shadow: false, 399 translate: ["120%", 0, -500], 400 }, 401 } 402 break; 403 } 404 405 if (elementSettings.arrows) { 406 swiperOptions.navigation = { 407 prevEl: elementSettings.prevArrow, 408 nextEl: elementSettings.nextArrow 409 }; 410 } 411 if (elementSettings.dots) { 412 413 let _dotType = elementSettings.dotType || 'bullets'; 414 swiperOptions.pagination = { 415 el: elementSettings.dotsElm || '.kitify-carousel__dots', 416 clickable: true, 417 renderFraction: function ( c, t ){ 418 return `<span class="${c}"></span><span>/</span><span class="${t}"></span>` 419 } 420 }; 421 if(_dotType !== 'custom'){ 422 swiperOptions.pagination.type = _dotType 423 } 424 if (_dotType === 'bullets') { 425 swiperOptions.pagination.dynamicBullets = true; 426 swiperOptions.pagination.dynamicMainBullets = 0; 427 swiperOptions.pagination.renderBullet = function (index, className) { 428 return '<span class="' + className + '">' + (index + 1) + "</span>"; 429 } 430 } 431 if (_dotType === 'custom') { 432 swiperOptions.pagination.modifierClass = 'kitify-swiper-pagination-' 433 swiperOptions.pagination.renderBullet = function (t, e) { 434 return '<span class="' + e + '"><svg width="65px" height="65px" viewBox="0 0 72 72" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><circle class="time" stroke-width="5" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg></span>' 435 } 436 } 437 } 438 439 var enableScrollbar = elementSettings.scrollbar || false; 440 441 if (!enableScrollbar) { 442 swiperOptions.scrollbar = false;
443 } 444 else { 445 swiperOptions.scrollbar = { 446 el: '.kitify-carousel__scrollbar_' + eUniqueId, 447 draggable: true 448 } 449 } 450 451 var _has_slidechange_effect = false, 452 _slide_change_effect_in = elementSettings.content_effect_in || 'fadeInUp', 453 _slide_change_effect_out = elementSettings.content_effect_out || 'fadeOutDown'; 454 455 if (elementSettings.content_selector !== undefined && $carousel.find(elementSettings.content_selector).length > 0) { 456 _has_slidechange_effect = true; 457 } 458 459 if ($carousel.closest('.no-slide-animation').length || $carousel.closest('.slide-no-animation').length) { 460 _has_slidechange_effect = false; 461 } 462 463 if (elementSettings.direction) { 464 swiperOptions.direction = elementSettings.direction; 465 } 466 if (elementSettings.autoHeight) { 467 swiperOptions.autoHeight = elementSettings.autoHeight 468 } 469 swiperOptions.watchSlidesProgress = true; 470 swiperOptions.watchSlidesVisibility = true; 471 swiperOptions.parallax = true; 472 473 if(typeof elementSettings.asFor !== "undefined" && elementSettings.asFor.trim() !== ''){ 474 swiperOptions.slideToClickedSlide = true; 475 } 476 477 const Swiper = elementorFrontend.utils.swiper; 478 479 $('.swiper-slide .kitify-has-entrance-animation', $scope).each(function (){ 480 const _settings = $(this).data('settings'); 481 const _animationName = elementorFrontend.getCurrentDeviceSetting(_settings, '_animation') || elementorFrontend.getCurrentDeviceSetting(_settings, 'animation'); 482 delete _settings?._animation; 483 delete _settings?.animation; 484 _settings.n_animation = _animationName; 485 this.setAttribute('data-settings', JSON.stringify(_settings)) 486 }); 487 488 const slideContentAnimation_cb = ( _deactivateSlides, _activateSlides ) => { 489 _activateSlides.forEach( _slide => { 490 _slide.querySelectorAll('.kitify-has-entrance-animation').forEach( _animation_item => { 491 let _settings = JSON.parse(_animation_item.getAttribute('data-settings')); 492 let _animationName = elementorFrontend.getCurrentDeviceSetting(_settings, 'n_animation') || elementorFrontend.getCurrentDeviceSetting(_settings, '_animation') || elementorFrontend.getCurrentDeviceSetting(_settings, 'animation'); 493 let _animationDelay = elementorFrontend.getCurrentDeviceSetting(_settings, '_animation_delay') || elementorFrontend.getCurrentDeviceSetting(_settings, 'animation_delay') || 0; 494 if(_animationName === 'none'){ 495 _animation_item.classList.remove('elementor-invisible') 496 } 497 else{ 498 setTimeout( () => { 499 _animation_item.classList.remove('elementor-invisible') 500 _animation_item.classList.add('animated', _animationName) 501 }, _animationDelay ) 502 } 503 } ) 504 _slide.querySelectorAll('.elementor-background-video-hosted')?.forEach( (_video) => { 505 _video?.play() 506 } ) 507 } ); 508 509 _deactivateSlides.forEach( _slide => { 510 _slide.querySelectorAll('.kitify-has-entrance-animation').forEach( _animation_item => { 511 let _settings = JSON.parse(_animation_item.getAttribute('data-settings')); 512 let _animationName = elementorFrontend.getCurrentDeviceSetting(_settings, 'n_animation') || elementorFrontend.getCurrentDeviceSetting(_settings, '_animation') || elementorFrontend.getCurrentDeviceSetting(_settings, 'animation'); 513 if(_animationName === 'none'){ 514 _animation_item.classList.remove('animated') 515 _animation_item.classList.add('elementor-invisible') 516 } 517 else{ 518 _animation_item.classList.add('elementor-invisible') 519 _animation_item.classList.remove('animated', _animationName) 520 } 521 } ) 522 _slide.querySelectorAll('.elementor-background-video-hosted')?.forEach( (_video) => { 523 _video?.pause() 524 } ) 525 } ) 526 if (_has_slidechange_effect) {
527 _deactivateSlides.forEach( _slide => { 528 _slide.querySelectorAll(elementSettings.content_selector).forEach( _selector => { 529 _selector.classList.add('no-effect-class', _slide_change_effect_out) 530 _selector.classList.remove(_slide_change_effect_in) 531 } ) 532 }) 533 _activateSlides.forEach( _slide => { 534 _slide.querySelectorAll(elementSettings.content_selector).forEach( _selector => { 535 _selector.classList.remove('no-effect-class', _slide_change_effect_out) 536 _selector.classList.add(_slide_change_effect_in) 537 } ) 538 }) 539 } 540 } 541 542 $swiperContainer.trigger('kitify/LazyloadSequenceEffects'); 543 544 $carousel.css({ 545 '--totalSlides': totalSlides, 546 '--swiperSpeed': `${swiperOptions.speed}ms` 547 }); 548 549 if(elementSettings?.variableWidth){ 550 swiperOptions.slidesPerView = 'auto'; 551 swiperOptions.loopedSlides = null; 552 swiperOptions.loopPreventsSlide = false; 553 swiperOptions.breakpoints = {}; 554 swiperOptions.on = { 555 init: function ( ) { 556 const swiper = this; 557 setTimeout( () => { 558 let _cheight = $('.swiper-slide-active', swiper.$el).first().innerHeight(); 559 swiper.el.style.setProperty('--swiperHeight', _cheight + 'px'); 560 }, 300) 561 }, 562 resize: function ( ) { 563 const swiper = this; 564 setTimeout( () => { 565 let _cheight = $('.swiper-slide-active', swiper.$el).first().innerHeight(); 566 swiper.el.style.setProperty('--swiperHeight', _cheight + 'px'); 567 }, 50) 568 } 569 } 570 } 571 572 swiperOptions.on = { 573 ...swiperOptions?.on, 574 beforeInit: ( _swiper ) => { 575 if(isSwiperLatest){ 576 let _classFB = ['swiper-container', 'swiper-container-initialized']; 577 _classFB.push(`swiper-container-${_swiper.params.direction}`); 578 _classFB.push(`swiper-container-${_swiper.params.effect}`); 579 if( ['coverflow', 'cube', 'flip', 'creative', 'creative'].includes(_swiper.params.effect) ) { 580 _classFB.push('swiper-container-3d'); 581 } 582 if( _swiper.params.autoHeight ){ 583 _classFB.push('swiper-container-autoheight'); 584 } 585 $swiperContainer.addClass(_classFB) 586 } 587 }, 588 afterInit: ( _swiper ) => { 589 $('.swiper-slide-duplicate .kitify-embla_wrap.embla--inited', _swiper.$wrapperEl).removeClass('embla--inited').trigger('kitify/init-embla-slider'); 590 }, 591 changeDirection: function( ) { 592 if(isSwiperLatest){ 593 $swiperContainer.removeClass('swiper-container-horizontal swiper-container-vertical').addClass(`swiper-container-${this.params.direction}`) 594 } 595 }, 596 beforeResize: function (){ 597 $('>.swiper-slide', this.$wrapperEl).css('width', '') 598 }, 599 slideChangeTransitionEnd: function (){ 600 const _swiper = this; 601 let _slides = []; 602 if(isSwiperLatest){ 603 _slides = _swiper.slides; 604 } 605 else{ 606 for (let i = 0; i < _swiper.slides.length; i += 1) { 607 _slides.push(_swiper.slides[i]) 608 } 609 } 610 let _deactivateSlides = _slides.filter( (_item, _idx) => { 611 let _flag = !_swiper.visibleSlidesIndexes.includes(_idx); 612 if(_swiper.params.slidesPerView !== 'auto' && _swiper.params.slidesPerView > 1 && (_item.classList.contains('swiper-slide-duplicate-prev') || _item.classList.contains('swiper-slide-duplicate-next'))){ 613 _flag = false;
614 } 615 return _flag; 616 }); 617 let _activeSlides = _slides.filter( (_item, _idx) => { 618 return _swiper.visibleSlidesIndexes.includes(_idx) 619 }); 620 slideContentAnimation_cb(_deactivateSlides, _activeSlides); 621 622 }, 623 slideChange: function (){ 624 const _swiper = this; 625 $('[data-carousel-goto="#'+carousel_id+'"]').removeClass('s-active'); 626 $('[data-carousel-goto="#'+carousel_id+'"][data-carousel-index="'+_swiper.realIndex+'"]').addClass('s-active'); 627 }, 628 transitionStart: (_swiper) => { 629 if(elementSettings?.variableWidth){ 630 setTimeout(() => { 631 _swiper.update() 632 }, 50) 633 } 634 } 635 }; 636 637 if( $scope.hasClass('elementor-kitify-portfolio') && $('.preset-grid-2b, .preset-grid-2b', $scope).length > 0){ 638 swiperOptions.autoHeight = false; 639 for (const _bkp_key in swiperOptions.breakpoints) { 640 swiperOptions.breakpoints[_bkp_key].autoHeight = elementorBreakpoints?.mobile?.value === parseInt(_bkp_key) 641 } 642 } 643 644 swiperOptions = elementorFrontend.hooks.applyFilters('kitify/carousel/options', swiperOptions, $scope, carousel_id); 645 646 new Swiper($swiperContainer, swiperOptions).then(function (SwiperInstance) { 647 648 Kitify.swiperInstances[carousel_id] = SwiperInstance 649 650 if(elementSettings?.variableWidth || elementSettings?.infiniteEffect){ 651 SwiperInstance.update() 652 } 653 654 Kitify.carouselInited.push({ 655 id: carousel_id, 656 syncWith: elementSettings.asFor, 657 thumbs: elementSettings.thumbs 658 }) 659 660 $swiperContainer.data('swiper', SwiperInstance); 661 662 if(SwiperInstance?.pagination?.bullets?.length < 5){ 663 SwiperInstance?.pagination?.$el?.addClass('no-bullets-dynamic'); 664 } 665 666 if(elementSettings.autoplay && elementSettings.pauseOnHover && typeof SwiperInstance.autoplay !== "undefined" && typeof SwiperInstance.autoplay.onMouseEnter === "undefined"){ 667 $swiperContainer.on('mouseenter', function (){ 668 SwiperInstance.autoplay.stop(); 669 }).on('mouseleave', function (){ 670 SwiperInstance.autoplay.start(); 671 }); 672 } 673 674 if(elementSettings.autoHeight){ 675 SwiperInstance.wrapperEl.style.height = 'auto'; 676 } 677 678 $carousel.css('--data-autoplay-speed', SwiperInstance.params.autoplay.delay + 'ms'); 679 680 $swiperContainer.find('.e-parent').trigger('kitify/section/calculate-container-width'); 681 682 Kitify.carouselInited.forEach( _syncItem => { 683 if(_syncItem?.synced !== true && _syncItem?.syncWith !== ''){ 684 const _c = _syncItem?.syncWith?.split(',')?.map( _a => _a?.trim())?.filter( _b => _b !== '' ) 685 const _ok = _c?.filter( (_d) => { 686 return Kitify.carouselInited.filter( _e => _e.id === _d ).length > 0 687 }) 688 if(_c?.length > 0 && _c?.length === _ok?.length){ 689 _syncItem.synced = true; 690 let _main_instance = Kitify.swiperInstances[_syncItem.id] 691 let _synced = _ok?.map( _e => Kitify.swiperInstances[_e] ) 692 _main_instance.controller.control = _synced 693 } 694 } 695 if(_syncItem?.syncedThumbs !== true && _syncItem?.thumbs !== '' && Kitify.swiperInstances[_syncItem?.thumbs]){ 696 const _mainS = Kitify.swiperInstances[_syncItem.id], 697 _thumbS = Kitify.swiperInstances[_syncItem.thumbs]; 698 _thumbS.params.slideToClickedSlide = true 699 _thumbS.update() 700 _mainS.params.thumbs.swiper = _thumbS 701 _mainS.update() 702 _mainS.thumbs.init() 703 _mainS.thumbs.update() 704 _syncItem.syncedThumbs = true; 705 } 706 }) 707 708 if (_has_slidechange_effect) { 709 $carousel.find(elementSettings.content_selector).addClass('animated no-effect-class'); 710 $carousel.find('.swiper-slide-visible ' + elementSettings.content_selector).removeClass('no-effect-class').addClass(_slide_change_effect_in); 711 } 712 713 $('.elementor-motion-effects-element', $scope).trigger('resize'); 714 715 $(document).trigger('kitify/carousel/init_success', { swiperContainer: $swiperContainer, SwiperInstance: SwiperInstance, parentContainer: $scope }); 716 }); 717 718 }, 719 initMasonry: function ($scope) { 720 var $container = $scope.find('.kitify-masonry-wrapper').first(); 721 722 if ($container.length == 0) { 723 return; 724 } 725 726 var $list_wrap = $scope.find($container.data('kitifymasonry_wrap')), 727 itemSelector = $container.data('kitifymasonry_itemselector'), 728 $advanceSettings = $container.data('kitifymasonry_layouts') || false, 729 $itemsList = $scope.find(itemSelector), 730 $masonryInstance, 731 _configs; 732 733 if ($list_wrap.length) { 734 735 if ($advanceSettings !== false) { 736 $(document).trigger('kitify/masonry/calculate-item-sizes', [$container, false]); 737 $(window).on('resize', function () { 738 $(document).trigger('kitify/masonry/calculate-item-sizes', [$container, true]); 739 }); 740 _configs = { 741 itemSelector: itemSelector, 742 percentPosition: true, 743 masonry: { 744 columnWidth: 1, 745 gutter: 0, 746 }, 747 } 748 } else { 749 _configs = { 750 itemSelector: itemSelector, 751 percentPosition: true, 752 } 753 } 754 755 $masonryInstance = $list_wrap.isotope(_configs); 756 757 $('img', $itemsList).imagesLoaded().progress(function (instance, image) { 758 var $image = $(image.img), 759 $parentItem = $image.closest(itemSelector); 760 $parentItem.addClass('item-loaded'); 761 if ($masonryInstance) { 762 $masonryInstance.isotope('layout'); 763 } 764 }); 765 } 766 }, 767 initCustomHandlers: function () { 768 $(document)
769 .on('click', '.kitify .kitify-pagination_ajax_loadmore a', function (e){ 770 e.preventDefault(); 771 if ($('body').hasClass('elementor-editor-active')) { 772 return false; 773 } 774 var $kitWrap,$parentContainer, $container, ajaxType, $parentNav, widgetId, itemSelector; 775 $parentNav = $(this).closest('.kitify-pagination'); 776 $kitWrap = $(this).closest('.kitify'); 777 widgetId = $kitWrap.data('id'); 778 779 if ($parentNav.hasClass('doing-ajax')) { 780 return false; 781 } 782 783 ajaxType = 'load_widget'; 784 if($kitWrap.find('div[data-widget_current_query="yes"]').length > 0){ 785 ajaxType = 'load_fullpage'; 786 } 787 788 if($kitWrap.hasClass('elementor-kitify-wooproducts')){ 789 $container = $kitWrap.find('.kitify-products__list'); 790 $parentContainer = $kitWrap.find('.kitify-products'); 791 itemSelector = '.kitify-product.product_item'; 792 } 793 else{ 794 $container = $($parentNav.data('container')); 795 $parentContainer = $($parentNav.data('parent-container')); 796 itemSelector = $parentNav.data('item-selector'); 797 } 798 799 if ($('a.next', $parentNav).length) { 800 $parentNav.addClass('doing-ajax'); 801 $parentContainer.addClass('doing-ajax'); 802 803 var success_func = function (response) { 804 var $data = $(response).find('.elementor-element-' + widgetId + ' ' + itemSelector); 805 806 if ($parentContainer.find('.kitify-carousel').length > 0) { 807 var swiper = $parentContainer.find('.kitify-carousel').get(0).swiper; 808 swiper.appendSlide($data); 809 } 810 else if ($container.data('isotope')) { 811 $container.append($data); 812 $container.isotope('insert', $data); 813 $(document).trigger('kitify/masonry/calculate-item-sizes', [$parentContainer, true]); 814 815 $('img', $data).imagesLoaded().progress(function (instance, image) { 816 var $image = $(image.img), 817 $parentItem = $image.closest(itemSelector); 818 $parentItem.addClass('item-loaded'); 819 $container.isotope('layout'); 820 }); 821 } 822 else { 823 $data.addClass('fadeIn animated').appendTo($container); 824 } 825 826 $parentContainer.removeClass('doing-ajax'); 827 $parentNav.removeClass('doing-ajax kitify-ajax-load-first'); 828 829 if ($(response).find( '.elementor-element-' + widgetId + ' .kitify-ajax-pagination').length) { 830 var $new_pagination = $(response).find( '.elementor-element-' + widgetId + ' .kitify-ajax-pagination'); 831 $parentNav.replaceWith($new_pagination); 832 $parentNav = $new_pagination; 833 } else { 834 $parentNav.addClass('nothingtoshow'); 835 } 836 $('body').trigger('jetpack-lazy-images-load'); 837 $(document).trigger('kitify/ajax-loadmore/success', { 838 parentContainer: $parentContainer, 839 contentHolder: $container, 840 pagination: $parentNav 841 }); 842 }; 843 844 var url_request = $('a.next', $parentNav).get(0).href.replace(/^\//, ''); 845 url_request = Kitify.removeURLParameter(url_request, '_'); 846 847 var ajaxOpts = { 848 url: url_request, 849 type: "GET", 850 cache: true, 851 dataType: 'html', 852 success: function (res) { 853 success_func(res); 854 } 855 }; 856 $.ajax(ajaxOpts); 857 } 858 859 }) 860 .on('click', '.kitify .kitify-ajax-pagination .page-numbers a', function (e){ 861 e.preventDefault(); 862 if ($('body').hasClass('elementor-editor-active')) { 863 return false;
864 } 865 var $kitWrap,$parentContainer, $container, ajaxType, $parentNav, widgetId, itemSelector, templateId, pagedKey; 866 $parentNav = $(this).closest('.kitify-pagination'); 867 $kitWrap = $(this).closest('.kitify'); 868 widgetId = $kitWrap.data('id'); 869 870 if ($parentNav.hasClass('doing-ajax')) { 871 return false; 872 } 873 874 templateId = $kitWrap.closest('.elementor[data-elementor-settings][data-elementor-id]').data('elementor-id'); 875 876 if($kitWrap.hasClass('elementor-kitify-wooproducts')){ 877 $container = $kitWrap.find('.kitify-products__list'); 878 $parentContainer = $kitWrap.find('.kitify-products'); 879 itemSelector = '.kitify-product.product_item'; 880 var tmpClass = $parentContainer.closest('.woocommerce').attr('class').match(/\bkitify_wc_widget_([^\s]*)/); 881 if (tmpClass !== null && tmpClass[1]) { 882 pagedKey = 'product-page-' + tmpClass[1]; 883 } 884 else{ 885 pagedKey = 'paged'; 886 } 887 } 888 else{ 889 $container = $($parentNav.data('container')); 890 $parentContainer = $($parentNav.data('parent-container')); 891 itemSelector = $parentNav.data('item-selector'); 892 pagedKey = $parentNav.data('ajax_request_id'); 893 } 894 895 ajaxType = 'load_widget'; 896 if($kitWrap.find('div[data-widget_current_query="yes"]').length > 0){ 897 ajaxType = 'load_fullpage'; 898 pagedKey = 'paged'; 899 } 900 901 $parentNav.addClass('doing-ajax'); 902 $parentContainer.addClass('doing-ajax'); 903 904 var success_func = function (res, israw) { 905 906 var $response; 907 908 if(israw){ 909 var jsoncontent = JSON.parse(res); 910 var contentraw = jsoncontent['template_content']; 911 $response = $('<div></div>').html(contentraw); 912 } 913 else{ 914 $response = $(res); 915 } 916 917 var $data = $response.find('.elementor-element-' + widgetId + ' ' + itemSelector); 918 919 if ($parentContainer.find('.kitify-carousel').length > 0) { 920 var swiper = $parentContainer.find('.kitify-carousel').get(0).swiper; 921 swiper.removeAllSlides(); 922 swiper.appendSlide($data); 923 } 924 else if ($container.data('isotope')) { 925 $container.isotope('remove', $container.isotope('getItemElements')); 926 $container.isotope('insert', $data); 927 $(document).trigger('kitify/masonry/calculate-item-sizes', [$parentContainer, true]); 928 929 $('img', $data).imagesLoaded().progress(function (instance, image) { 930 var $image = $(image.img), 931 $parentItem = $image.closest(itemSelector); 932 $parentItem.addClass('item-loaded'); 933 $container.isotope('layout'); 934 }); 935 } 936 else { 937 $data.addClass('fadeIn animated').appendTo($container.empty()); 938 } 939 940 $parentContainer.removeClass('doing-ajax'); 941 $parentNav.removeClass('doing-ajax kitify-ajax-load-first'); 942 943 if ($response.find( '.elementor-element-' + widgetId + ' .kitify-ajax-pagination').length) { 944 var $new_pagination = $response.find( '.elementor-element-' + widgetId + ' .kitify-ajax-pagination'); 945 $parentNav.replaceWith($new_pagination); 946 $parentNav = $new_pagination; 947 } 948 else { 949 $parentNav.addClass('nothingtoshow'); 950 } 951 952 if($response.find( '.elementor-element-' + widgetId + ' .woocommerce-result-count').length && $kitWrap.find('.woocommerce-result-count').length){ 953 $kitWrap.find('.woocommerce-result-count').replaceWith($response.find( '.elementor-element-' + widgetId + ' .woocommerce-result-count')); 954 } 955 956 $('html,body').animate({ 957 'scrollTop': $parentContainer.offset().top - getHeaderHeight() - 50 958 }, 400); 959 960 $('body').trigger('jetpack-lazy-images-load'); 961 $(document).trigger('kitify/ajax-pagination/success', { 962 parentContainer: $parentContainer, 963 contentHolder: $container, 964 pagination: $parentNav 965 }); 966 }; 967 968 var url_request = e.target.href.replace(/^\//, ''); 969 970 if( ajaxType == 'load_widget' ){ 971 var _tmpURL = url_request; 972 url_request = Kitify.addQueryArg(KitifySettings.widgetApiUrl, 'template_id', templateId); 973 url_request = Kitify.addQueryArg(url_request, 'widget_id', widgetId); 974 url_request = Kitify.addQueryArg(url_request, 'dev', KitifySettings.devMode); 975 url_request = Kitify.addQueryArg(url_request, pagedKey, Kitify.getUrlParameter(pagedKey, _tmpURL)); 976 url_request = Kitify.addQueryArg(url_request, 'kitifypagedkey', pagedKey); 977 } 978 979 url_request = Kitify.removeURLParameter(url_request, '_'); 980 981 var ajaxOpts = { 982 url: url_request, 983 type: "GET", 984 cache: true, 985 dataType: 'html', 986 ajax_request_id: Kitify.getUrlParameter(pagedKey, url_request), 987 success: function (res) { 988 if(ajaxType == 'load_widget'){ 989 success_func(res, true); 990 } 991 else{ 992 success_func(res, false); 993 } 994 } 995 }; 996 997 $.ajax(ajaxOpts) 998 999 }) 1000 .on('click', '[data-kitify-element-link]', function (e) { 1001 var $wrapper = $(this), 1002 data = $wrapper.data('kitify-element-link'), 1003 id = $wrapper.data('id'), 1004 anchor = document.createElement('a'), 1005 anchorReal; 1006 1007 anchor.id = 'nova-wrapper-link-' + id; 1008 anchor.href = data.url; 1009 anchor.target = data.is_external ? '_blank' : '_self'; 1010 anchor.rel = data.nofollow ? 'nofollow noreferer' : ''; 1011 anchor.style.display = 'none'; 1012 1013 document.body.appendChild(anchor); 1014 1015 anchorReal = document.getElementById(anchor.id); 1016 anchorReal.click(); 1017 anchorReal.remove(); 1018 }) 1019 .on('click', '.kitify-masonry_filter .kitify-masonry_filter-item', function (e){ 1020 e.preventDefault(); 1021 var $wrap = $(this).closest('.kitify-masonry_filter'), 1022 $isotopeInstance = $($wrap.data('kitifymasonry_container')), 1023 _filter = $(this).data('filter'); 1024 if (_filter != '*'){ 1025 _filter = '.' + _filter; 1026 } 1027 if ($isotopeInstance.data('isotope')) { 1028 $(this).addClass('active').siblings('.kitify-masonry_filter-item').removeClass('active'); 1029 $isotopeInstance.isotope({ 1030 filter: _filter 1031 }); 1032 } 1033 }) 1034 .on('kitify/masonry/calculate-item-sizes', function (e, $isotope_container, need_relayout) { 1035 var masonrySettings = $isotope_container.data('kitifymasonry_layouts') || false, 1036 $isotopeInstance = $isotope_container.find($isotope_container.data('kitifymasonry_wrap')); 1037 1038 if (masonrySettings !== false) { 1039 var win_w = $(window).width(), 1040 selector = $isotope_container.data('kitifymasonry_itemselector'); 1041 1042 if (win_w > 1023) { 1043 $isotope_container.addClass('cover-img-bg'); 1044 1045 var _base_w = masonrySettings.item_width, 1046 _base_h = masonrySettings.item_height, 1047 _container_width_base = masonrySettings.container_width, 1048 _container_width = $isotope_container.width(), 1049 item_per_page = Math.round(_container_width_base / _base_w), 1050 itemwidth = Math.floor(_container_width / item_per_page), 1051 margin = parseInt($isotope_container.data('kitifymasonry_itemmargin') || 0), 1052 dimension = (_base_h ? parseFloat(_base_w / _base_h) : 1), 1053 layout_mapping = masonrySettings.layout || [{w: 1, h: 1}]; 1054 1055 var _idx = 0, 1056 _idx2 = 0; 1057 1058 $(selector, $isotope_container).each(function () { 1059 $(this) 1060 .css({ 1061 'width': Math.floor(itemwidth * (layout_mapping[_idx]['w']) - (margin / 2)), 1062 'height': _base_h ? Math.floor(itemwidth / dimension * (layout_mapping[_idx]['h'])) : 'auto' 1063 }) 1064 .addClass('kitify-disable-cols-style'); 1065 // .attr('data-kitifymansory--item_setting', JSON.stringify({ 1066 // 'index': _idx2 + '_' + _idx, 1067 // 'itemwidth': itemwidth, 1068 // 'layout': layout_mapping[_idx] 1069 // })); 1070 _idx++; 1071 if (_idx == layout_mapping.length) { 1072 _idx2++; 1073 _idx = 0; 1074 } 1075 }); 1076 } else { 1077 $isotope_container.removeClass('kitify-masonry--cover-bg'); 1078 $(selector, $isotope_container).css({ 1079 'width': '', 1080 'height': '' 1081 }).removeClass('kitify-disable-cols-style'); 1082 } 1083 } 1084 if (need_relayout) { 1085 if ($isotopeInstance.data('isotope')) { 1086 $isotopeInstance.isotope('layout'); 1087 } 1088 } 1089 }) 1090 .on('keyup', function (e) { 1091 if(e.keyCode == 27){ 1092 $('.kitify-cart').removeClass('kitify-cart-open'); 1093 $('.kitify-hamburger-panel').removeClass('open-state'); 1094 $('html').removeClass('kitify-hamburger-panel-visible'); 1095 } 1096 }) 1097 .on('kitify/section/calculate-container-width', '.elementor-top-section', function (e){ 1098 var $scope = $(this); 1099 var $child_container = $scope.find('>.e-con-inner'); 1100 if(!$child_container.length){ 1101 $child_container = $scope; 1102 } 1103 $child_container.css('--kitify-section-width', $child_container.width() + 'px'); 1104 $(window).on('resize', function (){ 1105 $child_container.css('--kitify-section-width', $child_container.width() + 'px'); 1106 }); 1107 }) 1108 .on('click', function (e){ 1109 if( $(e.target).closest('.kitify-cart').length == 0 ) { 1110 $('.kitify-cart').removeClass('kitify-cart-open'); 1111 } 1112 }) 1113 }, 1114 ImageScrollHandler: function($scope) { 1115 var elementSettings = getElementSettings( $scope ), 1116 scrollElement = $scope.find('.kitify-image-scroll-container'), 1117 scrollOverlay = scrollElement.find('.kitify-image-scroll-overlay'), 1118 scrollVertical = scrollElement.find('.kitify-image-scroll-vertical'), 1119 imageScroll = scrollElement.find('.kitify-image-scroll-image img'), 1120 direction = elementSettings.direction_type, 1121 reverse = elementSettings.reverse, 1122 trigger = elementSettings.trigger_type, 1123 transformOffset = null; 1124 1125 function startTransform() { 1126 imageScroll.css('transform', (direction === 'vertical' ? 'translateY' : 'translateX') + '( -' + transformOffset + 'px)'); 1127 } 1128 1129 function endTransform() { 1130 imageScroll.css('transform', (direction === 'vertical' ? 'translateY' : 'translateX') + '(0px)'); 1131 } 1132 1133 function setTransform() { 1134 if( direction === 'vertical' ) { 1135 transformOffset = imageScroll.height() - scrollElement.height(); 1136 } else { 1137 transformOffset = imageScroll.width() - scrollElement.width(); 1138 } 1139 } 1140 1141 if ( trigger === 'scroll' ) { 1142 scrollElement.addClass('kitify-container-scroll'); 1143 if ( direction === 'vertical' ) { 1144 scrollVertical.addClass('kitify-image-scroll-ver'); 1145 } else { 1146 scrollElement.imagesLoaded(function() { 1147 scrollOverlay.css( { 'width': imageScroll.width(), 'height': imageScroll.height() } ); 1148 }); 1149 } 1150 } else { 1151 if ( reverse === 'yes' ) { 1152 scrollElement.imagesLoaded(function() { 1153 scrollElement.addClass('kitify-container-scroll-instant'); 1154 setTransform(); 1155 startTransform(); 1156 }); 1157 } 1158 if ( direction === 'vertical' ) { 1159 scrollVertical.removeClass('kitify-image-scroll-ver'); 1160 } 1161 scrollElement.mouseenter(function() { 1162 scrollElement.removeClass('kitify-container-scroll-instant'); 1163 setTransform(); 1164 reverse === 'yes' ? endTransform() : startTransform(); 1165 }); 1166 1167 scrollElement.mouseleave(function() { 1168 reverse === 'yes' ? startTransform() : endTransform(); 1169 }); 1170 } 1171 }, 1172 isEditMode: function () { 1173 return Boolean(elementorFrontend.isEditMode()); 1174 }, 1175 mobileAndTabletCheck: function () { 1176 return ( (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) && (window.innerWidth < 1400) ) 1177 }, 1178 loadStyle: function (style, uri) { 1179 1180 if (Kitify.addedStyles.hasOwnProperty(style) && Kitify.addedStyles[style] === uri) { 1181 return style; 1182 } 1183 1184 if (!uri) { 1185 return; 1186 } 1187 1188 Kitify.addedStyles[style] = uri; 1189 1190 return new Promise(function (resolve, reject)
1190{ 1191 var tag = document.createElement('link'); 1192 1193 tag.id = style + '-css'; 1194 tag.rel = 'stylesheet'; 1195 tag.href = uri; 1196 tag.type = 'text/css'; 1197 tag.media = 'all'; 1198 tag.onload = function () { 1199 resolve(style); 1200 }; 1201 tag.onerror = function () { 1202 reject(`Can not load css file "${uri}"`); 1203 } 1204 1205 document.head.appendChild(tag); 1206 }); 1207 }, 1208 loadScriptAsync: function (script, uri, callback, async) { 1209 if (Kitify.addedScripts.hasOwnProperty(script)) { 1210 return script; 1211 } 1212 if (!uri) { 1213 return; 1214 } 1215 Kitify.addedScripts[script] = uri; 1216 return new Promise(function (resolve, reject) { 1217 var tag = document.createElement('script'); 1218 1219 tag.src = uri; 1220 tag.id = script + '-js'; 1221 tag.async = async; 1222 tag.onload = function () { 1223 resolve(script); 1224 if ("function" == typeof callback && "number" != typeof callback.nodeType) { 1225 callback(); 1226 } 1227 }; 1228 1229 tag.onerror = function () { 1230 reject(`Can not load javascript file "${uri}"`); 1231 if ("function" == typeof callback && "number" != typeof callback.nodeType) { 1232 callback(); 1233 } 1234 } 1235 1236 document.head.appendChild(tag); 1237 }); 1238 }, 1239 detectWidgetsNotInHeader: function (){ 1240 let itemDetected = ['.elementor-widget-icon-list', '.main-color', '.elementor-icon', '.elementor-heading-title', '.elementor-widget-text-editor', '.elementor-widget-divider', '.elementor-icon-list-item', '.elementor-social-icon', '.elementor-button', '.kitify-nav-wrap', '.kitify-nav', '.menu-item-link-depth-0']; 1241 let _q = []; 1242 itemDetected.forEach( _item => _q.push('.kitify-nav__sub ' + _item) ); 1243 document.querySelectorAll(_q.join()).forEach( _item => _item.classList.add('ignore-docs-style') ); 1244 1245 $('.elementor-widget-icon-list .elementor-icon-list-item').each(function (){ 1246 var $child_a = $('>a', $(this)), 1247 _href = $child_a.attr('href'); 1248 if($(this).closest('.kitify-nav__sub').length && $(this).closest('.menu-item.need-check-active').length){ 1249 if(window.location.href == _href){ 1250 $(this).addClass('current-menu-item') 1251 } 1252 } 1253 }) 1254 }, 1255 isInViewport: function (element) { 1256 let bounding = element.getBoundingClientRect(); 1257 return (bounding.top >= -element.offsetHeight 1258 && bounding.left >= -element.offsetWidth 1259 && bounding.right <= (window.innerWidth || document.documentElement.clientWidth) + element.offsetWidth 1260 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) + element.offsetHeight 1261 ) 1262 }, 1263 LazyLoad: function (){ 1264 var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 1265 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1266 var _defaultConfig$option = $.extend({}, { 1267 rootMargin: '50px', 1268 threshold: 0, 1269 load: function load(element) { 1270 var base_src = element.getAttribute('data-src') || element.getAttribute('data-lazy') || element.getAttribute('data-lazy-src') || element.getAttribute('data-lazy-original'), 1271 base_srcset = element.getAttribute('data-src') || element.getAttribute('data-lazy-srcset'), 1272 base_sizes = element.getAttribute('data-sizes') || element.getAttribute('data-lazy-sizes'); 1273 if (base_src) { 1274 element.src = base_src; 1275 } 1276 if (base_srcset) { 1277 element.srcset = base_srcset; 1278 } 1279 if (base_sizes) { 1280 element.sizes = base_sizes; 1281 } 1282 if (element.getAttribute('data-background-image')) { 1283 element.style.backgroundImage = 'url("' + element.getAttribute('data-background-image') + '")'; 1284 } 1285 element.setAttribute('data-element-loaded', true); 1286 if (element.classList.contains('jetpack-lazy-image')) { 1287 element.classList.add('jetpack-lazy-image--handled'); 1288 } 1289 }, 1290 complete: function (elm) {} 1291 }, options), 1292 rootMargin = _defaultConfig$option.rootMargin, 1293 threshold = _defaultConfig$option.threshold, 1294 load = _defaultConfig$option.load, 1295 complete = _defaultConfig$option.complete; // // If initialized, then disconnect the observer 1296 1297 var _target_cache = false, 1298 _counter = 0; 1299 1300 function onIntersection(load) { 1301 return function (entries, observer) {
1302 entries.forEach(function (entry) { 1303 if(entry.isIntersecting){ 1304 if(_counter > 7){ 1305 _counter = 0; 1306 } 1307 if(_target_cache !== entry.target.offsetTop){ 1308 _counter = 0; 1309 _target_cache = entry.target.offsetTop; 1310 } 1311 else{ 1312 _counter++; 1313 } 1314 observer.unobserve(entry.target); 1315 entry.target.style.setProperty('--effect-delay', _counter); 1316 load(entry.target); 1317 } 1318 }); 1319 }; 1320 } 1321 1322 var observer = void 0; 1323 1324 if ("IntersectionObserver" in window) { 1325 observer = new IntersectionObserver(onIntersection(load), { 1326 rootMargin: rootMargin, 1327 threshold: threshold 1328 }); 1329 } 1330 return { 1331 observe: function observe() { 1332 if(!selector){ 1333 return; 1334 } 1335 for (var i = 0; i < selector.length; i++) { 1336 if(selector[i].getAttribute('data-element-loaded') === 'true'){ 1337 continue; 1338 } 1339 if (observer) { 1340 observer.observe(selector[i]); 1341 continue; 1342 } 1343 load(selector[i]); 1344 } 1345 complete(selector); 1346 } 1347 }; 1348 }, 1349 elementorFrontendInit: function ($container, reinit_global_trigger) { 1350 if( typeof window.elementorFrontend.hooks === "undefined"){ 1351 return; 1352 } 1353 Kitify.detectWidgetsNotInHeader(); 1354 if(reinit_global_trigger){ 1355 $(window).trigger('elementor/frontend/init'); 1356 } 1357 $container.removeClass('need-reinit-js'); 1358 $container.find('[data-element_type]').each(function () { 1359 var $this = $(this), 1360 elementType = $this.data('element_type'); 1361 1362 if (!elementType) { 1363 return; 1364 } 1365 1366 try { 1367 if ('widget' === elementType) { 1368 elementType = $this.data('widget_type'); 1369 window.elementorFrontend.hooks.doAction('frontend/element_ready/widget', $this, $); 1370 } 1371 1372 window.elementorFrontend.hooks.doAction('frontend/element_ready/global', $this, $); 1373 window.elementorFrontend.hooks.doAction('frontend/element_ready/' + elementType, $this, $); 1374 1375 } catch (err) { 1376 Kitify.log(err); 1377 $this.remove(); 1378 return false; 1379 } 1380 }); 1381 }, 1382 initAnimationsHandlers: function ($selector) { 1383 $selector.find('[data-element_type]').each(function () { 1384 var $this = $(this), 1385 elementType = $this.data('element_type'); 1386 1387 if (!elementType) { 1388 return; 1389 } 1390 1391 window.elementorFrontend.hooks.doAction('frontend/element_ready/global', $this, $); 1392 }); 1393 }, 1394 hamburgerPanel: function ($scope) { 1395 1396 var wid = $scope.data('id'), 1397 _wid_tpl_id = $scope.find('.kitify-hamburger-panel__content').attr('data-template-id'), 1398 _need_add_remove = true, 1399 $wContent = $scope.find('>.elementor-widget-container').clone(); 1400 1401 if( !!$scope.data('hamburgerTemplateId') && ( _wid_tpl_id == $scope.data('hamburgerTemplateId') ) ){ 1402 _need_add_remove = false; 1403 } 1404 else{ 1405 $scope.data('hamburgerTemplateId', _wid_tpl_id); 1406 } 1407 1408 if ($('.kitify-site-wrapper > .elementor-location-header >.kitify-burger-wrapall').length == 0) { 1409 $('<div/>').addClass('kitify-burger-wrapall').appendTo($('.kitify-site-wrapper > .elementor-location-header')); 1410 } 1411 1412 var $burger_wrap_all = $('.kitify-burger-wrapall'); 1413 1414 if ( _need_add_remove && $('.elementor-element-' + wid, $burger_wrap_all).length) { 1415 $('.elementor-element-' + wid, $burger_wrap_all).remove(); 1416 } 1417 1418 var $new_scope = $scope; 1419 1420 if($scope.closest('.elementor-location-header').length){ 1421 if(_need_add_remove){ 1422 $('<div/>').addClass('elementor-element elementor-element-' + wid).append($wContent).appendTo($burger_wrap_all); 1423 } 1424 $('.kitify.elementor-element-' + wid + ' .kitify-hamburger-panel__instance').remove(); 1425 $new_scope = $('.elementor-element-' + wid, $burger_wrap_all); 1426 $('.kitify-hamburger-panel__toggle', $new_scope).remove(); 1427 } 1428 1429 var $panel = $('.kitify-hamburger-panel', $new_scope), 1430 $toggleButton = $('.kitify-hamburger-panel__toggle', $scope), 1431 $instance = $('.kitify-hamburger-panel__instance', $new_scope), 1432 $cover = $('.kitify-hamburger-panel__cover', $new_scope), 1433 $inner = $('.kitify-hamburger-panel__inner', $new_scope), 1434 $closeButton = $('.kitify-hamburger-panel__close-button', $new_scope), 1435 $html = $('html'), 1436 settings = $panel.data('settings') || {}, 1437 $panelInstance = $('.elementor-element-' + wid + ' .kitify-hamburger-panel'); 1438 1439 if (!settings['ajaxTemplate']) { 1440 Kitify.elementorFrontendInit($inner, false); 1441 } 1442 1443 $toggleButton.on('click', function (e) { 1444 e.preventDefault(); 1445 if (!$panel.hasClass('open-state')) { 1446 $panelInstance.addClass('open-state'); 1447 $html.addClass('kitify-hamburger-panel-visible'); 1448 Kitify.initAnimationsHandlers($inner); 1449 } else { 1450 $panelInstance.removeClass('open-state'); 1451 $html.removeClass('kitify-hamburger-panel-visible'); 1452 } 1453 }); 1454 $closeButton.on('click', function (e) { 1455 e.preventDefault(); 1456 if (!$panel.hasClass('open-state')) { 1457 $panelInstance.addClass('open-state'); 1458 $html.addClass('kitify-hamburger-panel-visible'); 1459 Kitify.initAnimationsHandlers($inner); 1460 } 1461 else { 1462 $panelInstance.removeClass('open-state'); 1463 $html.removeClass('kitify-hamburger-panel-visible'); 1464 } 1465 }); 1466 1467 $(document).on('click.kitifyHamburgerPanel', function (event) { 1468 1469 if (($(event.target).closest('.kitify-hamburger-panel__toggle').length || $(event.target).closest('.kitify-hamburger-panel__instance').length) 1470 && !$(event.target).closest('.kitify-hamburger-panel__cover').length 1471 ) { 1472 return; 1473 } 1474 1475 if (!$panel.hasClass('open-state')) { 1476 return; 1477 } 1478 1479 $('.elementor-element-' + wid + ' .kitify-hamburger-panel').removeClass('open-state'); 1480 1481 if (!$(event.target).closest('.kitify-hamburger-panel__toggle').length) { 1482 $html.removeClass('kitify-hamburger-panel-visible'); 1483 } 1484 1485 event.stopPropagation(); 1486 }); 1487 }, 1488 wooCard: function ($scope) { 1489 if (window.KitifyEditor && window.KitifyEditor.activeSection) { 1490 let section = window.KitifyEditor.activeSection, 1491 isCart = -1 !== ['cart_list_style', 'cart_list_items_style', 'cart_buttons_style'].indexOf(section); 1492 1493 $('.widget_shopping_cart_content').empty(); 1494 $(document.body).trigger('wc_fragment_refresh'); 1495 } 1496 1497 var $target = $('.kitify-cart', $scope), 1498 $toggle = $('.kitify-cart__heading-link', $target), 1499 settings = $target.data('settings'), 1500 firstMouseEvent = true; 1501 1502 switch (settings['triggerType']) { 1503 case 'hover': 1504 hoverType(); 1505 break; 1506 case 'click': 1507 clickType(); 1508 break; 1509 } 1510 1511 $target.on('click', '.kitify-cart__close-button', function (event) { 1512 if (!$target.hasClass('kitify-cart-open-proccess')) { 1513 $target.toggleClass('kitify-cart-open'); 1514 } 1515 }); 1516 1517 function hoverType() { 1518 var scrollOffset = 0;
1519 if ('ontouchend' in window || 'ontouchstart' in window) { 1520 $target.on('touchstart', function (event) { 1521 scrollOffset = $(window).scrollTop(); 1522 }); 1523 1524 $target.on('touchend', function (event) { 1525 1526 if (scrollOffset !== $(window).scrollTop()) { 1527 return false; 1528 } 1529 1530 var $this = $(this); 1531 1532 if ($this.hasClass('kitify-cart-open-proccess')) { 1533 return; 1534 } 1535 1536 setTimeout(function () { 1537 $this.toggleClass('kitify-cart-open'); 1538 }, 10); 1539 }); 1540 1541 $(document).on('touchend', function (event) { 1542 1543 if ($(event.target).closest($target).length) { 1544 return; 1545 } 1546 1547 if ($target.hasClass('kitify-cart-open-proccess')) { 1548 return; 1549 } 1550 1551 if (!$target.hasClass('kitify-cart-open')) { 1552 return; 1553 } 1554 1555 $target.removeClass('kitify-cart-open'); 1556 }); 1557 } else { 1558 1559 $target.on('mouseenter mouseleave', function (event) { 1560 1561 if (firstMouseEvent && 'mouseleave' === event.type) { 1562 return; 1563 } 1564 1565 if (firstMouseEvent && 'mouseenter' === event.type) { 1566 firstMouseEvent = false; 1567 } 1568 1569 if (!$(this).hasClass('kitify-cart-open-proccess')) { 1570 $(this).toggleClass('kitify-cart-open'); 1571 } 1572 }); 1573 } 1574 } 1575 1576 function clickType() { 1577 $toggle.on('click', function (event) { 1578 event.preventDefault(); 1579 1580 if (!$target.hasClass('kitify-cart-open-proccess')) { 1581 $target.toggleClass('kitify-cart-open'); 1582 } 1583 }); 1584 } 1585 }, 1586 wooGallery: function ($scope) { 1587 if (Kitify.isEditMode()) { 1588 $('.woocommerce-product-gallery', $scope).wc_product_gallery(); 1589 } 1590 1591 var centerdots_cb = function () { 1592 if ($scope.find('.flex-viewport').length) { 1593 $scope.find('.woocommerce-product-gallery').css('--singleproduct-thumbs-height', $scope.find('.flex-viewport').height() + 'px'); 1594 if ($scope.find('.woocommerce-product-gallery__trigger').length) { 1595 $scope.find('.woocommerce-product-gallery__trigger').appendTo($scope.find('.flex-viewport')); 1596 } 1597 if ($('.la-custom-badge', $scope).length) { 1598 $('.la-custom-badge', $scope).prependTo($scope.find('.flex-viewport')); 1599 } 1600 if ($('.woocommerce-product-gallery__actions', $scope).length) { 1601 $('.woocommerce-product-gallery__actions', $scope).prependTo($scope.find('.flex-viewport')); 1602 } 1603 } 1604 1605 var $nav = $scope.find('.flex-direction-nav'); 1606 if ($nav.length && $scope.find('.flex-viewport').length) { 1607 $nav.appendTo($scope.find('.flex-viewport')) 1608 } 1609 1610 var $thumbs = $scope.find('.flex-control-thumbs').get(0); 1611 if (typeof $thumbs === "undefined" || $scope.find('.kitify-product-images').hasClass('layout-type-wc')) { 1612 return; 1613 } 1614 1615 var pos = {top: 0, left: 0, x: 0, y: 0}; 1616 var mouseDownHandler = function (e) { 1617 $thumbs.style.cursor = 'grabbing'; 1618 $thumbs.style.userSelect = 'none'; 1619 1620 pos = { 1621 left: $thumbs.scrollLeft, 1622 top: $thumbs.scrollTop, 1623 // Get the current mouse position 1624 x: e.clientX, 1625 y: e.clientY, 1626 }; 1627 1628 document.addEventListener('mousemove', mouseMoveHandler); 1629 document.addEventListener('mouseup', mouseUpHandler); 1630 }; 1631 1632 var mouseMoveHandler = function (e) { 1633 // How far the mouse has been moved 1634 const dx = e.clientX - pos.x; 1635 const dy = e.clientY - pos.y; 1636 1637 // Scroll the element 1638 $thumbs.scrollTop = pos.top - dy; 1639 $thumbs.scrollLeft = pos.left - dx; 1640 }; 1641 1642 var mouseUpHandler = function () { 1643 $thumbs.style.cursor = 'grab'; 1644 $thumbs.style.removeProperty('user-select'); 1645 1646 document.removeEventListener('mousemove', mouseMoveHandler); 1647 document.removeEventListener('mouseup', mouseUpHandler); 1648 }; 1649 // Attach the handler 1650 $thumbs.addEventListener('mousedown', mouseDownHandler); 1651 } 1652 setTimeout(centerdots_cb, 300); 1653 1654 function flexdestroy($els) { 1655 $els.each(function () { 1656 var $el = jQuery(this); 1657 var $elClean = $el.clone(); 1658 1659 $elClean.find('.flex-viewport').children().unwrap(); 1660 $elClean.find('img.zoomImg, .woocommerce-product-gallery__trigger').remove(); 1661 $elClean 1662 .removeClass('flexslider') 1663 .find('.clone, .flex-direction-nav, .flex-control-nav') 1664 .remove() 1665 .end() 1666 .find('*').removeAttr('style').removeClass(function (index, css) { 1667 // If element is SVG css has an Object inside (?) 1668 if (typeof css === 'string') { 1669 return (css.match(/\bflex\S+/g) || []).join(' '); 1670 } 1671 }); 1672 $elClean.insertBefore($el); 1673 $el.remove(); 1674 }); 1675 1676 } 1677 1678 if ($scope.find('.kitify-product-images').hasClass('layout-type-5') || $scope.find('.kitify-product-images').hasClass('layout-type-6')) { 1679 flexdestroy($scope.find('.kitify-product-images')); 1680 } 1681 1682 1683 var $gallery_target = $scope.find('.woocommerce-product-gallery'); 1684 1685 var data_columns = parseInt($gallery_target.data('columns')); 1686 if($scope.find('.kitify-product-images').hasClass('layout-type-4')){ 1687 data_columns = parseInt($gallery_target.closest('.elementor-kitify-wooproduct-images').css('--singleproduct-image-column')); 1688 } 1689 1690 if ($gallery_target.find('.woocommerce-product-gallery__image').length <= data_columns) { 1691 $gallery_target.addClass('center-thumb'); 1692 if($scope.find('.kitify-product-images').hasClass('layout-type-4')){ 1693 flexdestroy($scope.find('.kitify-product-images')); 1694 $gallery_target = $scope.find('.woocommerce-product-gallery'); 1695 } 1696 } 1697 if( $scope.find('.kitify-product-images').hasClass('layout-type-5') || $scope.find('.kitify-product-images').hasClass('layout-type-6') ){ 1698 $scope.find('.woocommerce-product-gallery__image a').attr('data-elementor-open-lightbox', 'yes'); 1699 $scope.find('.woocommerce-product-gallery__image a').attr('data-elementor-lightbox-slideshow', $scope.data('id')); 1700 } 1701 else{ 1702 $scope.find('.woocommerce-product-gallery__image a').attr('data-elementor-open-lightbox', 'n
1702o'); 1703 } 1704 $scope.find('.woocommerce-product-gallery__image').each(function (){ 1705 if( $(this).find('.zoominner').length == 0 ){ 1706 $(this).wrapInner('<div class="zoomouter"><div class="zoominner"></div></div>'); 1707 } 1708 }) 1709 var initZoom = function (zoomTarget) { 1710 1711 var zoom_enabled = $.isFunction($.fn.zoom) && wc_single_product_params.zoom_enabled; 1712 if (!zoom_enabled) { 1713 return; 1714 } 1715 var galleryWidth = $gallery_target.width(), 1716 zoomEnabled = false, 1717 zoom_options; 1718 1719 if($scope.find('.kitify-product-images').hasClass('layout-type-4')){ 1720 galleryWidth = $(zoomTarget).width() 1721 } 1722 1723 $(zoomTarget).each(function (index, target) { 1724 var image = $(target).find('img'); 1725 1726 if (image.data('large_image_width') > galleryWidth) { 1727 zoomEnabled = true; 1728 return false; 1729 } 1730 }); 1731 1732 // But only zoom if the img is larger than its container. 1733 if (zoomEnabled) { 1734 1735 try { 1736 zoom_options = $.extend({ 1737 touch: false 1738 }, wc_single_product_params.zoom_options); 1739 } catch (ex) { 1740 zoom_options = { 1741 touch: false 1742 }; 1743 } 1744 1745 if ('ontouchstart' in document.documentElement) { 1746 zoom_options.on = 'click'; 1747 } 1748 1749 zoomTarget.trigger('zoom.destroy'); 1750 zoomTarget.zoom(zoom_options); 1751 1752 } 1753 } 1754 1755 initZoom($gallery_target.find('.woocommerce-product-gallery__image .zoominner')); 1756 }, 1757 wooTabs: function ($scope) { 1758 var $tabs = $scope.find('.wc-tabs-wrapper').first(); 1759 if ($tabs) { 1760 $tabs.wrapInner('<div class="kitify-wc-tabs--content"></div>'); 1761 $tabs.find('.wc-tabs').wrapAll('<div class="kitify-wc-tabs--controls"></div>'); 1762 $tabs.find('.kitify-wc-tabs--controls').prependTo($tabs); 1763 $tabs.find('.wc-tab').wrapInner('<div class="tab-content"></div>'); 1764 $tabs.find('.wc-tab').each(function () { 1765 var _html = $('#' + $(this).attr('aria-labelledby')).html(); 1766 $(this).prepend('<div class="wc-tab-title">' + _html + '</div>'); 1767 }); 1768 $('.wc-tab-title a', $tabs).wrapInner('<span></span>'); 1769 $('.wc-tab-title a', $tabs).on('click', function (e) { 1770 e.preventDefault(); 1771 $tabs.find('.wc-tabs').find('li[aria-controls="' + $(this).attr('href').replace('#', '') + '"]').toggleClass('active').siblings().removeClass('active'); 1772 $(this).closest('.wc-tab').toggleClass('active').siblings().removeClass('active'); 1773 }); 1774 $('.wc-tabs li a', $tabs).on('click', function (e) { 1775 var $wrapper = $(this).closest('.wc-tabs-wrapper, .woocommerce-tabs'); 1776 $wrapper.find($(this).attr('href')).addClass('active').siblings().removeClass('active'); 1777 }); 1778 $('.wc-tabs li', $tabs).removeClass('active'); 1779 $('.wc-tab-title a', $tabs).first().trigger('click'); 1780 } 1781 }, 1782 SearchAnimate: function ($scope) { 1783 var $target = $scope.find('#js_header_search_modal'); 1784 if (!$target.length) { 1785 return; 1786 } 1787 $("#js_header_search_modal").animatedModal({ 1788 animatedIn: 'slideInDown', 1789 animatedOut: 'slideOutUp', 1790 beforeOpen: function() { 1791 window.setTimeout(function () { 1792 $(".header-search").addClass('animate'); 1793 }, 300); 1794 window.setTimeout(function () { 1795 $(".header-search").addClass('animate-line'); 1796 }, 1000); 1797 }, 1798 }); 1799 }, 1800 animatedBoxHandler: function ($scope) { 1801 1802 var $target = $scope.find('.kitify-animated-box'), 1803 toogleEvents = 'mouseenter mouseleave', 1804 scrollOffset = $(window).scrollTop(), 1805 firstMouseEvent = true; 1806 1807 if (!$target.length) { 1808 return; 1809 } 1810
1811 if ('ontouchend' in window || 'ontouchstart' in window) { 1812 $target.on('touchstart', function (event) { 1813 scrollOffset = $(window).scrollTop(); 1814 }); 1815 1816 $target.on('touchend', function (event) { 1817 1818 if (scrollOffset !== $(window).scrollTop()) { 1819 return false; 1820 } 1821 1822 if (!$(this).hasClass('flipped-stop')) { 1823 $(this).toggleClass('flipped'); 1824 } 1825 }); 1826 1827 } else { 1828 $target.on(toogleEvents, function (event) { 1829 1830 if (firstMouseEvent && 'mouseleave' === event.type) { 1831 return; 1832 } 1833 1834 if (firstMouseEvent && 'mouseenter' === event.type) { 1835 firstMouseEvent = false; 1836 } 1837 1838 if (!$(this).hasClass('flipped-stop')) { 1839 $(this).toggleClass('flipped'); 1840 } 1841 }); 1842 } 1843 }, 1844 1845 ajaxTemplateHelper: { 1846 1847 need_reinit_js : false, 1848 1849 template_processed : {}, 1850 1851 template_processed_count : 0, 1852 1853 template_loaded : [], 1854 1855 total_template : 0, 1856 1857 processInsertData: function ($el, templateContent, template_id){ 1858 1859 1860 Kitify.ajaxTemplateHelper.template_processed_count++; 1861 1862 if (templateContent) { 1863 $el.html(templateContent); 1864 if($el.find('div[data-kitify_ajax_loadtemplate]:not(.template-loaded,.is-loading)').length){ 1865 Kitify.log('found template in ajax content'); 1866 Kitify.ajaxTemplateHelper.init(); 1867 } 1868 } 1869 1870 if(Kitify.ajaxTemplateHelper.template_processed_count >= Kitify.ajaxTemplateHelper.total_template && Kitify.ajaxTemplateHelper.need_reinit_js){ 1871 Kitify.ajaxTemplateHelper.need_reinit_js = false; 1872 Promise.all(Kitify.addedAssetsPromises).then(function (value) { 1873 // $(window).trigger('elementor/frontend/init'); 1874 Kitify.elementorFrontendInit($('.need-reinit-js[data-kitify_ajax_loadtemplate="true"]'), false); 1875 $('.elementor-motion-effects-element').trigger('resize'); 1876 $('body').trigger('jetpack-lazy-images-load'); 1877 //Kitify.log('Kitify.addedAssetsPromises --- FINISHED'); 1878 1879 }, function (reason){ 1880 1881 Kitify.log(`An error occurred while insert the asset resources, however we still need to insert content. Reason detail
1881: "${reason}"`); 1882 // $(window).trigger('elementor/frontend/init'); 1883 Kitify.elementorFrontendInit($('.need-reinit-js[data-kitify_ajax_loadtemplate="true"]'), false); 1884 $('.elementor-motion-effects-element').trigger('resize'); 1885 $('body').trigger('jetpack-lazy-images-load'); 1886 Kitify.log('Kitify.addedAssetsPromises --- ERROR'); 1887 }); 1888 } 1889 1890 $(document).trigger('kitify/ajax-load-template/after', { 1891 target_id: template_id, 1892 contentHolder: $el, 1893 parentContainer: $el, 1894 response: templateContent 1895 }); 1896 }, 1897 templateRenderCallback: function ( response, template_id ){ 1898 var templateContent = response['template_content'], 1899 templateScripts = response['template_scripts'], 1900 templateStyles = response['template_styles'], 1901 template_metadata = response['template_metadata']; 1902 1903 for (var scriptHandler in templateScripts) { 1904 if($( '#' + scriptHandler + '-js').length == 0) { 1905 Kitify.addedAssetsPromises.push(Kitify.loadScriptAsync(scriptHandler, templateScripts[scriptHandler], '', true)); 1906 } 1907 } 1908 1909 for (var styleHandler in templateStyles) { 1910 if($( '#' + styleHandler + '-css').length == 0) { 1911 Kitify.addedAssetsPromises.push(Kitify.loadStyle(styleHandler, templateStyles[styleHandler])); 1912 } 1913 } 1914 document.querySelectorAll('body:not(.elementor-editor-active) div[data-kitify_ajax_loadtemplate][data-cache-id="' + template_id + '"]:not(.template-loaded)').forEach(function (elm) { 1915 elm.classList.remove('is-loading'); 1916 elm.classList.add('template-loaded'); 1917 elm.classList.add('need-reinit-js'); 1918 Kitify.ajaxTemplateHelper.processInsertData($(elm), templateContent, template_id); 1919 }); 1920 1921 var wpbar = document.querySelectorAll('#wp-admin-bar-elementor_edit_page ul'); 1922 1923 if (wpbar && typeof template_metadata['title'] !== "undefined") { 1924 setTimeout(function () { 1925 var _tid = 'wp-admin-bar-elementor_edit_doc_'+template_metadata['id']; 1926 if($('#'+_tid).length == 0){ 1927 $('<li id="'+_tid+'" class="elementor-general-section"><a class="ab-item" title="'+template_metadata['title']+'" data-title="'+template_metadata['title']+'" href="' + template_metadata['href'] + '"><span class="elementor-edit-link-title">' + template_metadata['title'] + '</span><span class="elementor-edit-link-type">' + template_metadata['sub_title'] + '</span></a></li>').prependTo($(wpbar)); 1928 } 1929 }, 2000); 1930 } 1931 }, 1932 init: function (){ 1933 if(KitifySettings.isElementorAdmin){ 1934 /** do not run if current context is editor **/ 1935 return; 1936 } 1937 Kitify.ajaxTemplateHelper.need_reinit_js = false; 1938 Kitify.ajaxTemplateHelper.template_loaded = []; 1939 Kitify.ajaxTemplateHelper.template_processed_count = 0; 1940 Kitify.ajaxTemplateHelper.total_template = 0; 1941 Kitify.ajaxTemplateHelper.template_processed = {}; 1942 1943 var templates = document.querySelectorAll('body:not(.elementor-editor-active) div[data-kitify_ajax_loadtemplate]:not(.template-loaded)'); 1944 if (templates.length) { 1945 var template_ids = []; 1946 var template_exist_ids = [];
1947 templates.forEach(function (el) { 1948 if (!el.classList.contains('is-loading') && !el.classList.contains('template-loaded')) { 1949 el.classList.add('is-loading'); 1950 var _cache_key = el.getAttribute('data-template-id'); 1951 if (!template_ids.includes(_cache_key)) { 1952 var exits_nodes = document.querySelectorAll('.elementor.elementor-'+_cache_key+'[data-elementor-type]:not([data-elementor-title])'); 1953 if(exits_nodes.length == 0){ 1954 template_ids.push(_cache_key); 1955 } 1956 else{ 1957 template_exist_ids.push(_cache_key); 1958 } 1959 } 1960 el.setAttribute('data-cache-id', _cache_key); 1961 } 1962 }); 1963 1964 var arr_ids = [], _idx1 = 0, _idx2 = 0, _bk = 6; 1965 1966 var ajaxCalling = function (template_ids){ 1967 1968 var _ajax_data_sending = { 1969 'action': 'kitify_ajax', 1970 '_nonce': window.KitifySettings.ajaxNonce, 1971 'actions': JSON.stringify({ 1972 'elementor_template' : { 1973 'action': 'elementor_template', 1974 'data': { 1975 'template_ids': template_ids, 1976 'current_url': window.location.href, 1977 'current_url_no_search': window.location.href.replace(window.location.search, ''), 1978 'dev': window.KitifySettings.devMode 1979 } 1980 } 1981 }) 1982 }; 1983 if(KitifySettings.useFrontAjax == 'true'){ 1984 _ajax_data_sending['kitify-ajax'] = 'yes'; 1985 delete _ajax_data_sending['action']; 1986 } 1987 $.ajax({ 1988 type: KitifySettings.useFrontAjax == 'true' ? 'GET' : 'POST', 1989 url: KitifySettings.useFrontAjax == 'true' ? window.location.href : window.KitifySettings.ajaxUrl, 1990 dataType: 'json', 1991 data: _ajax_data_sending, 1992 success: function (resp, textStatus, jqXHR) { 1993 var responses = resp.data.responses.elementor_template.data; 1994 $.each( responses, function( templateId, response ) { 1995 var cached_key = 'kitifyTpl_' + templateId; 1996 var browserCacheKey = Kitify.localCache.cache_key + '_' + Kitify.localCache.hashCode(templateId); 1997 Kitify.localCache.set(cached_key, response); 1998 Kitify.ajaxTemplateHelper.templateRenderCallback(response, templateId); 1999 try{ 2000 //Kitify.log('setup browser cache for ' + browserCacheKey); 2001 localStorage.setItem(browserCacheKey, JSON.stringify(response)); 2002 localStorage.setItem(browserCacheKey + ':ts', Date.now()); 2003 } 2004 catch (ajax_ex1){ 2005 Kitify.log('Cannot setup browser cache', ajax_ex1); 2006 } 2007 }); 2008 } 2009 }); 2010 } 2011 2012 template_exist_ids.forEach(function (templateId){ 2013 var exist_tpl = document.querySelector('.elementor.elementor-'+templateId+'[data-elementor-type]'); 2014 Kitify.ajaxTemplateHelper.need_reinit_js = true; 2015 Kitify.ajaxTemplateHelper.templateRenderCallback({ 2016 'template_content' : exist_tpl.outerHTML, 2017 'template_scripts' : [], 2018 'template_styles' : [], 2019 'template_metadata' : {}, 2020 }, templateId); 2021 }); 2022 2023 template_ids.forEach(function (templateId){ 2024 var cached_key = 'kitifyTpl_' + templateId; 2025 var cached_key2 = 'kitifyTplExist_' + templateId; 2026 2027 if(Kitify.localCache.exist(cached_key2)){ 2028 if(Kitify.localCache.exist(cached_key)){ 2029 Kitify.ajaxTemplateHelper.need_reinit_js = true; 2030 Kitify.ajaxTemplateHelper.templateRenderCallback(Kitify.localCache.get(cached_key), templateId); 2031 } 2032 return; 2033 }
2034 Kitify.localCache.set(cached_key2, 'yes'); 2035 2036 if(Kitify.localCache.exist(cached_key)){ 2037 Kitify.ajaxTemplateHelper.need_reinit_js = true; 2038 Kitify.ajaxTemplateHelper.templateRenderCallback(Kitify.localCache.get(cached_key), templateId); 2039 } 2040 else{ 2041 2042 $(document).trigger('kitify/ajax-load-template/before', { 2043 target_id: templateId 2044 }); 2045 2046 var browserCacheKey = Kitify.localCache.cache_key + '_' + Kitify.localCache.hashCode(templateId); 2047 var expiry = Kitify.localCache.timeout; 2048 try{ 2049 var browserCached = localStorage.getItem(browserCacheKey); 2050 var browserWhenCached = localStorage.getItem(browserCacheKey + ':ts'); 2051 2052 if (browserCached !== null && browserWhenCached !== null) { 2053 var age = (Date.now() - browserWhenCached) / 1000; 2054 if (age < expiry) { 2055 //Kitify.log(`render from cache for ID: ${templateId} | Cache Key: ${browserCacheKey}`); 2056 Kitify.ajaxTemplateHelper.need_reinit_js = true; 2057 Kitify.ajaxTemplateHelper.templateRenderCallback(JSON.parse(browserCached), templateId); 2058 return; 2059 } 2060 else { 2061 //Kitify.log(`clear browser cache key for ID: ${templateId} | Cache Key: ${browserCacheKey}`); 2062 // We need to clean up this old key 2063 localStorage.removeItem(browserCacheKey); 2064 localStorage.removeItem(browserCacheKey + ':ts'); 2065 } 2066 } 2067 //Kitify.log('run ajaxCalling() for ' + templateId); 2068 _idx1++; 2069 if(_idx1 > _bk){ 2070 _idx1 = 0; 2071 _idx2++; 2072 } 2073 if( "undefined" == typeof arr_ids[_idx2] ) { 2074 arr_ids[_idx2] = []; 2075 } 2076 arr_ids[_idx2].push(templateId); 2077 Kitify.ajaxTemplateHelper.template_loaded.push(templateId); 2078 } 2079 catch (ajax_ex) { 2080 Kitify.log('Cannot setup browser cache ajaxCalling() for ' + templateId); 2081 _idx1++; 2082 if(_idx1 == _bk){ 2083 _idx1 = 0; 2084 _idx2++; 2085 } 2086 if( "undefined" == typeof arr_ids[_idx2] ) { 2087 arr_ids[_idx2] = []; 2088 } 2089 arr_ids[_idx2].push(templateId); 2090 Kitify.ajaxTemplateHelper.template_loaded.push(templateId); 2091 } 2092 } 2093 2094 }); 2095 2096 Kitify.ajaxTemplateHelper.total_template = templates.length; 2097 2098 if(arr_ids.length){ 2099 Kitify.ajaxTemplateHelper.need_reinit_js = true; 2100 arr_ids.forEach(function (arr_id){ 2101 ajaxCalling(arr_id); 2102 }); 2103 } 2104 } 2105 } 2106 }, 2107 }; 2108 var KitifyTools = { 2109 2110 getElementPercentageSeen: function( $element, offset ) { 2111 var offsetSettings = offset || {}, 2112 startOffset = offsetSettings.start || 0, 2113 endOffset = offsetSettings.end || 0,
2114 viewportHeight = $( window ).height(), 2115 viewportStartOffset = viewportHeight * startOffset / 100, 2116 viewportEndOffset = viewportHeight * endOffset / 100, 2117 scrollTop = $( window ).scrollTop(), 2118 elementOffsetTop = $element.offset().top, 2119 elementHeight = $element.height(), 2120 percentage; 2121 2122 percentage = (scrollTop + viewportHeight + viewportStartOffset - elementOffsetTop) / (viewportHeight + viewportStartOffset + viewportEndOffset + elementHeight); 2123 percentage = Math.min( 100, Math.max( 0, percentage * 100 ) ); 2124 2125 return parseFloat( percentage.toFixed( 2 ) ); 2126 }, 2127 2128 isRTL: function() { 2129 return $( 'body' ).hasClass( 'rtl' ); 2130 }, 2131 2132 inArray: function( needle, haystack ) { 2133 return -1 < haystack.indexOf( needle ); 2134 }, 2135 2136 debounce: function( threshold, callback ) { 2137 var timeout; 2138 2139 return function debounced( $event ) { 2140 function delayed() { 2141 callback.call( this, $event ); 2142 timeout = null; 2143 } 2144 2145 if ( timeout ) { 2146 clearTimeout( timeout ); 2147 } 2148 2149 timeout = setTimeout( delayed, threshold ); 2150 }; 2151 }, 2152 2153 getObjectNextKey: function( object, key ) { 2154 var keys = Object.keys( object ), 2155 idIndex = keys.indexOf( key ), 2156 nextIndex = idIndex += 1; 2157 2158 if( nextIndex >= keys.length ) { 2159 //we're at the end, there is no next 2160 return false; 2161 } 2162 2163 var nextKey = keys[ nextIndex ]; 2164 2165 return nextKey; 2166 }, 2167 2168 getObjectPrevKey: function( object, key ) { 2169 var keys = Object.keys( object ), 2170 idIndex = keys.indexOf( key ), 2171 prevIndex = idIndex -= 1; 2172 2173 if ( 0 > idIndex ) { 2174 //we're at the end, there is no next 2175 return false; 2176 } 2177 2178 var prevKey = keys[ prevIndex ]; 2179 2180 return prevKey; 2181 }, 2182 2183 getObjectFirstKey: function( object ) { 2184 return Object.keys( object )[0]; 2185 }, 2186 2187 getObjectLastKey: function( object ) { 2188 return Object.keys( object )[ Object.keys( object ).length - 1 ]; 2189 }, 2190 2191 getObjectValues: function( object ) { 2192 var values; 2193 2194 if ( !Object.values ) { 2195 values = Object.keys( object ).map( function( e ) { 2196 return object[e] 2197 } ); 2198 2199 return values; 2200 } 2201 2202 return Object.values( object ); 2203 }, 2204 2205 validateEmail: function( email ) { 2206 var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 2207 2208 return re.test( email ); 2209 }, 2210 2211 mobileAndTabletcheck: function() { 2212 var check = false; 2213 2214 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
2214sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); 2215 2216 return check; 2217 }, 2218 2219 addThousandCommaSeparator: function ( nStr, separator ) { 2220 2221 var nStr = nStr + '', 2222 separator = separator.toString().replace(/[0-9]/g, ''), 2223 x = nStr.split('.'), 2224 x1 = x[0], 2225 x2 = x.length > 1 ? '.' + x[1] : '', 2226 rgx = /(\d+)(\d{3})/; 2227 2228 if ( '' === separator ) { 2229 return nStr; 2230 } 2231 2232 while ( rgx.test(x1) ) { 2233 x1 = x1.replace(rgx, '$1' + separator + '$2'); 2234 } 2235 2236 return x1 + x2; 2237 }, 2238 2239 getElementorElementSettings: function( $scope ) { 2240 2241 if ( window.elementorFrontend && window.elementorFrontend.isEditMode() && $scope.hasClass( 'elementor-element-edit-mode' ) ) { 2242 return KitifyTools.getEditorElementSettings( $scope ); 2243 } 2244 2245 return $scope.data( 'settings' ) || {}; 2246 }, 2247 2248 getEditorElementSettings: function( $scope ) { 2249 var modelCID = $scope.data( 'model-cid' ), 2250 elementData; 2251 2252 if ( ! modelCID ) { 2253 return {}; 2254 } 2255 2256 if ( ! elementor.hasOwnProperty( 'config' ) ) { 2257 return {}; 2258 } 2259 2260 if ( ! elementor.config.hasOwnProperty( 'elements' ) ) { 2261 return {}; 2262 } 2263 2264 if ( ! elementor.config.elements.hasOwnProperty( 'data' ) ) { 2265 return {}; 2266 } 2267 2268 elementData = elementor.config.elements.data[ modelCID ]; 2269 2270 if ( ! elementData ) { 2271 return {}; 2272 } 2273 2274 return elementData.toJSON(); 2275 } 2276 }; 2277 2278 $(window).on('elementor/frontend/init', function () { 2279 2280 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-advanced-carousel.default', function ($scope) { 2281 Kitify.initCarousel($scope); 2282 }); 2283 2284 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-slides.default', function ($scope) { 2285 Kitify.initCarousel($scope); 2286 }); 2287 2288 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-posts.default', function ($scope) { 2289 Kitify.initCarousel($scope); 2290 Kitify.initMasonry($scope); 2291 }); 2292 2293 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-portfolio.default', function ($scope) { 2294 Kitify.initCarousel($scope); 2295 Kitify.initMasonry($scope); 2296 }); 2297 2298 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-images-layout.default', function ($scope) { 2299 Kitify.initCarousel($scope); 2300 Kitify.initMasonry($scope); 2301 }); 2302 2303 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-team-member.default', function ($scope) { 2304 Kitify.initCarousel($scope); 2305 Kitify.initMasonry($scope); 2306 }); 2307 2308 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-testimonials.default', function ($scope) { 2309 Kitify.initCarousel($scope); 2310 Kitify.initMasonry($scope); 2311 }); 2312 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-banner-list.default', function ($scope) { 2313 Kitify.initCarousel($scope); 2314 Kitify.initMasonry($scope); 2315 }); 2316 2317 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-instagram-feed.default', function ($scope) { 2318 Kitify.initCarousel($scope); 2319 Kitify.initMasonry($scope); 2320 }); 2321 2322 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-wooproduct-datatabs.default', function ($scope) { 2323 $scope.foundation(); 2324 }); 2325 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-woo-categories.default', function ($scope) { 2326 Kitify.initCarousel($scope); 2327 }); 2328 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-scroll-image.default', function ($scope) { 2329 Kitify.ImageScrollHandler($scope); 2330 }); 2331 2332 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-hamburger-panel.default', function ($scope) { 2333 Kitify.hamburgerPanel($scope); 2334 }); 2335 2336 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-menucart.default', function ($scope) { 2337 Kitify.wooCard($scope); 2338 }); 2339 2340 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-animated-box.default', function ($scope) { 2341 Kitify.animatedBoxHandler($scope); 2342 }); 2343 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-search.default', function ($scope) { 2344 Kitify.SearchAnimate($scope); 2345 }); 2346 2347 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-wooproducts.default', function ($scope) { 2348 Kitify.initCarousel($scope); 2349 Kitify.initMasonry($scope); 2350 }); 2351 2352 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-wooproduct-images.default', function ($scope) { 2353 Kitify.wooGallery($scope); 2354 }); 2355 2356 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-wooproduct-datatabs.default', function ($scope) { 2357 Kitify.wooTabs($scope); 2358 }); 2359 elementorFrontend.hooks.addAction('frontend/element_ready/kitify-image-comparison.default', function ($scope) { 2360 var $target = $scope.find( '.kitify-image-comparison__instance' ), 2361 instance = null, 2362 imageComparisonItems = $( '.kitify-image-comparison__container', $target ), 2363 settings = $target.data( 'settings' ), 2364 elementId = $scope.data( 'id' ); 2365 2366 if ( ! $target.length ) { 2367 return; 2368 } 2369 2370 window.juxtapose.scanPage( '.kitify-juxtapose' ); 2371 2372 2373 Kitify.initCarousel( $scope ); 2374 }); 2375 window.elementorFrontend.hooks.addAction('frontend/element_ready/section', function ($scope) { 2376 if( $scope.hasClass('elementor-top-section') ) { 2377 $scope.trigger('kitify/section/calculate-container-width'); 2378 } 2379 }); 2380 2381 Kitify.initCustomHandlers(); 2382 2383 }); 2384 2385 window.Kitify = Kitify; 2386 window.KitifyTools = KitifyTools; 2387 2388 $.ajaxPrefilter(function (options, originalOptions, jqXHR) { 2389 if (options.cache) { 2390 //Here is our identifier for the cache. Maybe have a better, safer ID (it depends on the object string representation here) ? 2391 // on $.ajax call we could also set an ID in originalOptions
2392 var id = Kitify.removeURLParameter(originalOptions.url, '_') + ("undefined" !== typeof originalOptions.ajax_request_id ? JSON.stringify(originalOptions.ajax_request_id) : "undefined" !== typeof originalOptions.data ? JSON.stringify(originalOptions.data) : ''); 2393 id = Kitify.localCache.hashCode(id.replace(/null$/g, '')); 2394 options.cache = false; 2395 2396 options.beforeSend = function () { 2397 if (!Kitify.localCache.exist(id)) { 2398 jqXHR.promise().done(function (data, textStatus) { 2399 Kitify.localCache.set(id, data); 2400 }); 2401 } 2402 return true; 2403 }; 2404 } 2405 }); 2406 $.ajaxTransport("+*", function (options, originalOptions, jqXHR) { 2407 //same here, careful because options.url has already been through jQuery processing 2408 var id = Kitify.removeURLParameter(originalOptions.url, '_') + ("undefined" !== typeof originalOptions.ajax_request_id ? JSON.stringify(originalOptions.ajax_request_id) : "undefined" !== typeof originalOptions.data ? JSON.stringify(originalOptions.data) : ''); 2409 options.cache = false; 2410 id = Kitify.localCache.hashCode(id.replace(/null$/g, '')); 2411 if (Kitify.localCache.exist(id)) { 2412 return { 2413 send: function (headers, completeCallback) { 2414 setTimeout(function () { 2415 completeCallback(200, "OK", [Kitify.localCache.get(id)]); 2416 }, 50); 2417 }, 2418 abort: function () { 2419 /* abort code, nothing needed here I guess... */ 2420 } 2421 }; 2422 } 2423 }); 2424 2425}(jQuery, window.elementorFrontend)); 2426 2427(function ($) { 2428 2429 class _eContainerHandler extends elementorModules.frontend.handlers.Base { 2430 _editorInit(){ 2431 setTimeout( () => { 2432 if(this.$element.data('nesting-level') > 0){ 2433 this.$element.removeClass('e-root-container elementor-top-section'); 2434 } 2435 else{ 2436 this.$element.addClass('e-root-container elementor-top-section'); 2437 this._FullwidthRight(); 2438 } 2439 }, 50); 2440 } 2441 _FullwidthRight() { 2442 const $scope = this.$element; 2443 if( $scope.hasClass('elementor-top-section') ) { 2444 $scope.trigger('kitify/section/calculate-container-width'); 2445 } 2446 } 2447 bindEvents() { 2448 if(this.isEdit){ 2449 this._editorInit() 2450 } 2451 else{ 2452 this._FullwidthRight() 2453 } 2454 } 2455 } 2456 2457 $( window ).on( 'elementor/frontend/init', () => { 2458 elementorFrontend.hooks.addAction( 'frontend/element_ready/container', ( $element ) => { 2459 elementorFrontend.elementsHandler.addHandler( _eContainerHandler, { 2460 $element, 2461 } ); 2462 } ); 2463 } ); 2464 2465}(jQuery));
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.