1/** 2 * Ram Dass Events Calendar Carousel Skin - JavaScript Handler 3 * 4 * Registers the Swiper initialization for the Ram Dass skin of the 5 * BDThemes Element Pack Events Calendar Carousel widget. 6 * 7 * This hooks into: frontend/element_ready/bdt-event-carousel.ramdass 8 */ 9(function($, elementorFrontend) { 10 'use strict'; 11 12 var widgetEventCarouselRamDass = function($scope) { 13 var $eventCarousel = $scope.find('.bdt-event-calendar'); 14 if (!$eventCarousel.length) { 15 return; 16 } 17 18 var $container = $eventCarousel.find('.swiper-carousel'), 19 settings = $eventCarousel.data('settings'); 20 21 // Skip if already initialized 22 if ($container[0] && $container[0].swiper) { 23 return; 24 } 25 26 // Use Elementor's built-in Swiper utility 27 const Swiper = elementorFrontend.utils.swiper; 28 29 (async function initSwiper() { 30 var swiper = await new Swiper($container, settings); 31 32 if (settings.pauseOnHover) { 33 $($container).hover( 34 function() { 35 this.swiper.autoplay.stop(); 36 }, 37 function() { 38 this.swiper.autoplay.start(); 39 } 40 ); 41 } 42 })(); 43 }; 44 45 /** 46 * Initialize any existing widgets that were rendered before our script loaded. 47 * Uses setTimeout to avoid race conditions when multiple widgets exist - 48 * each widget gets its own microtask to initialize independently. 49 */ 50 function initExistingWidgets() { 51 $('[data-widget_type="bdt-event-carousel.ramdass"]').each(function(index) { 52 var $widget = $(this); 53 // Stagger initialization to prevent async race conditions 54 setTimeout(function() { 55 widgetEventCarouselRamDass($widget); 56 }, index * 10); 57 }); 58 } 59 60 /** 61 * Register the handler and init existing widgets 62 */ 63 function registerHandler() { 64 if (elementorFrontend && elementorFrontend.hooks) { 65 elementorFrontend.hooks.addAction( 66 'frontend/element_ready/bdt-event-carousel.ramdass', 67 widgetEventCarouselRamDass 68 ); 69 } 70 // Initialize any widgets already on the page 71 initExistingWidgets(); 72 } 73 74 // Handle timing: if Elementor frontend is already ready, init immediately 75 // Otherwise wait for the init event 76 if (elementorFrontend && elementorFrontend.hooks) { 77 registerHandler(); 78 } else { 79 $(window).on('elementor/frontend/init', registerHandler); 80 } 81})(jQuery, window.elementorFrontend);
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.