ElementorPro/assets/js/loop-carousel.827a11bd7f1b0343de42.bundle.js

66 lines
2.8 KiB
JavaScript
Raw Normal View History

2024-07-07 01:00:30 +02:00
/*! elementor-pro - v3.21.0 - 30-04-2024 */
"use strict";
(self["webpackChunkelementor_pro"] = self["webpackChunkelementor_pro"] || []).push([["loop-carousel"],{
/***/ "../modules/loop-builder/assets/js/frontend/handlers/loop-carousel.js":
/*!****************************************************************************!*\
!*** ../modules/loop-builder/assets/js/frontend/handlers/loop-carousel.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _runElementHandlers = _interopRequireDefault(__webpack_require__(/*! elementor-pro/frontend/utils/run-element-handlers */ "../assets/dev/js/frontend/utils/run-element-handlers.js"));
class LoopCarousel extends elementorModules.frontend.handlers.CarouselBase {
getDefaultSettings() {
const defaultSettings = super.getDefaultSettings();
defaultSettings.selectors.carousel = '.elementor-loop-container';
return defaultSettings;
}
getSwiperSettings() {
const swiperOptions = super.getSwiperSettings(),
elementSettings = this.getElementSettings(),
isRtl = elementorFrontend.config.is_rtl,
widgetSelector = `.elementor-element-${this.getID()}`;
if ('yes' === elementSettings.arrows) {
swiperOptions.navigation = {
prevEl: isRtl ? `${widgetSelector} .elementor-swiper-button-next` : `${widgetSelector} .elementor-swiper-button-prev`,
nextEl: isRtl ? `${widgetSelector} .elementor-swiper-button-prev` : `${widgetSelector} .elementor-swiper-button-next`
};
}
swiperOptions.on.beforeInit = () => {
this.a11ySetSlidesAriaLabels();
};
return swiperOptions;
}
async onInit() {
super.onInit(...arguments);
this.ranElementHandlers = false;
}
handleElementHandlers() {
if (this.ranElementHandlers || !this.swiper) {
return;
}
const newSlides = Array.from(this.swiper.slides).slice(this.swiper.activeIndex - 1, this.swiper.slides.length);
(0, _runElementHandlers.default)(newSlides);
this.ranElementHandlers = true;
}
a11ySetSlidesAriaLabels() {
const slides = Array.from(this.elements.$slides);
slides.forEach((slide, index) => {
slide.setAttribute('aria-label', `${parseInt(index + 1)} ${__('of', 'elementor-pro')} ${slides.length}`);
});
}
}
exports["default"] = LoopCarousel;
/***/ })
}]);
//# sourceMappingURL=loop-carousel.827a11bd7f1b0343de42.bundle.js.map