1( function( $ ) { 2 3 "use strict"; 4 5 var isEditMode = false; 6 7 var swiperSliderInit = function( carousel, elementSettings, sliderOptions ) { 8 $( carousel ).closest( '.elementor-widget-wrap' ).addClass( 'e-swiper-container' ); 9 $( carousel ).closest( '.elementor-widget' ).addClass( 'e-widget-swiper' ); 10 11 // if ( 'undefined' === typeof Swiper ) { 12 var asyncSwiper = elementorFrontend.utils.swiper; 13 14 new asyncSwiper( carousel, sliderOptions ).then( function( newSwiperInstance ) { 15 var mySwiper = newSwiperInstance; 16 swiperSliderAfterInit( carousel, carousel.parent(), elementSettings, mySwiper ); 17 } ); 18 // } else { 19 // var mySwiper = new Swiper( carousel, sliderOptions ); 20 // swiperSliderAfterInit( carousel, carousel.parent(), elementSettings, mySwiper ); 21 // } 22 }; 23 24 var swiperSliderAfterInit = function( carousel, carouselWrap, elementSettings, mySwiper ) { 25 26 // Fix for compatibility with Elementor Pro Nexted Carousel 27 if ( carouselWrap.hasClass( 'swiper' ) && ! carouselWrap.hasClass( 'swiper-initialized' ) ) { 28 carouselWrap.addClass( 'swiper-initialized' ); 29 } 30 if ( carousel.hasClass( 'swiper-container' ) && ! carousel.hasClass( 'swiper-container-initialized' ) ) { 31 carousel.addClass( 'swiper-container-initialized' ); 32 } 33 34 if ( 'yes' === elementSettings.pause_on_hover ) { 35 carousel.on( 'mouseover', function() { 36 mySwiper.autoplay.stop(); 37 } ); 38 carousel.on( 'mouseout', function() { 39 mySwiper.autoplay.start(); 40 } ); 41 } 42 if ( isEditMode ) { 43 carouselWrap.resize( function() { 44 // mySwiper.update(); 45 } ); 46 } 47 widgetUpdate( mySwiper, '.trx-addons-swiper-slider', 'swiper' ); 48 49 $( document ).trigger( 'action.slider_init', [carousel, carousel.attr('id')] ); 50 }; 51 52 var swiperSliderHandler = function( $scope, $ ) { 53 var elementSettings = trx_addons_elementor_get_settings( $scope ), 54 carousel = $scope.find( '.trx-addons-swiper-slider' ), 55 sliderOptions = ( carousel.attr( 'data-slider-settings' ) !== undefined ) ? JSON.parse( carousel.attr( 'data-slider-settings' ) ) : ''; 56 57 swiperSliderInit( carousel, elementSettings, sliderOptions ); 58 }; 59 60 var widgetUpdate = function( slider, selector, type ) { 61 if ( 'undefined' === typeof type ){ 62 type = 'swiper'; 63 } 64 65 var $triggers = [ 66 'trx-addons-action-tabs-switched', 67 'trx-addons-action-toggle-switched', 68 'trx-addons-action-accordion-switched', 69 'trx-addons-action-popup-opened', 70 ]; 71 72 $triggers.forEach( function( trigger ) { 73 if ( 'undefined' !== typeof trigger ) { 74 $( document ).on( trigger, function( e, wrap ) { 75 if ( trigger == 'trx-addons-action-popup-opened' ) { 76 wrap = $( '.trx-addons-modal-popup-' + wrap ); 77 } 78 if ( wrap.find( selector ).length > 0 ) { 79 setTimeout( function() { 80 if ( 'swiper' === type ) { 81 slider.update(); 82 } else if ( 'gallery' === type ) { 83 var $gallery = wrap.find( '.trx-addons-image-gallery' ).eq(0); 84 $gallery.isotope( 'layout' ); 85 } 86 }, 100 ); 87 } 88 } ); 89 } 90 } ); 91 }; 92 93 $( window ).on( 'elementor/frontend/init', function () { 94 if ( elementorFrontend.isEditMode() ) { 95 isEditMode = true; 96 } 97 // Posts slider is inited in the Posts.js 98 //elementorFrontend.hooks.addAction( 'frontend/element_ready/trx_elm_posts.default', swiperSliderHandler ); 99 } ); 100 101}( 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.