1/* global WCF_ADDONS_JS */ 2(function ($) { 3 /** 4 * @param $scope The Widget wrapper element as a jQuery element 5 * @param $ The jQuery alias 6 */ 7 8 const getSliderOptions = function ($scope) { 9 const slider = $($('.arolax_project_slider', $scope)[0]); 10 const sliderSettings = $($('.arolax_project_wrapper', $scope)[0]).data('settings') || {}; 11 sliderSettings.handleElementorBreakpoints = true; 12 13 //pagination fractions 14 if (sliderSettings.hasOwnProperty('pagination')) { 15 sliderSettings.pagination.el = $('.swiper-pagination', $scope)[$('.swiper-pagination', $scope).length - 1]; 16 17 if (sliderSettings.pagination.hasOwnProperty('type') && 'fraction' === sliderSettings.pagination.type) { 18 sliderSettings.pagination.formatFractionCurrent = function (number) { 19 return ('0' + number).slice(-2); 20 } 21 sliderSettings.pagination.formatFractionTotal = function (number) { 22 return ('0' + number).slice(-2); 23 } 24 sliderSettings.pagination.renderFraction = function (currentClass, totalClass) { 25 return '<span class="' + currentClass + '"></span>' + 26 '<span class="dash">/</span>' + 27 '<span class="' + totalClass + '"></span>'; 28 } 29 } 30 } 31 32 //remove the attribute after getting the slider settings 33 // $($('.arolax_project_wrapper', $scope)[0]).removeAttr('data-settings'); 34 35 return {slider: slider, options: sliderSettings}; 36 37 } 38 39 40 const getThumbSliderOptions = function ($scope) { 41 const slider = $('.project_thumb_slider', $scope); 42 const sliderSettings = $('.project_thumb_wrapper', $scope).data('settings') || {}; 43 sliderSettings.handleElementorBreakpoints = true; 44 45 //remove the attribute after getting the slider settings 46 $('.project_thumb_wrapper', $scope).removeAttr('data-settings'); 47 48 return {thumbSlider: slider, thumbOptions: sliderSettings}; 49 } 50 51 52 const ArolaxProjectSlider = function ($scope, $) { 53 const {thumbSlider, thumbOptions} = getThumbSliderOptions($scope); 54 const {slider, options} = getSliderOptions($scope); 55 56 //if thumb slider enable 57 if (thumbSlider.length) { 58 new elementorFrontend.utils.swiper(thumbSlider, thumbOptions).then(newSwiperInstance => newSwiperInstance).then((thumbSliderInstance) => { 59 new elementorFrontend.utils.swiper(slider, options).then(newSwiperInstance => newSwiperInstance).then(( newSwiperInstance) => { 60 newSwiperInstance.controller.control = thumbSliderInstance; 61 thumbSliderInstance.controller.control = newSwiperInstance; 62 }); 63 64 }); 65 } else { 66 new elementorFrontend.utils.swiper(slider, options).then(newSwiperInstance => newSwiperInstance); 67 } 68 }; 69 70 71 72 // Make sure you run this code under Elementor. 73 $(window).on('elementor/frontend/init', function () { 74 elementorFrontend.hooks.addAction('frontend/element_ready/arolax--project-slider.default', ArolaxProjectSlider); 75 }); 76})(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.