/******/ (function() { // webpackBootstrap var __webpack_exports__ = {}; /*!*******************************************************!*\ !*** ./src/js/blocks/product-offers-carousel/view.js ***! \*******************************************************/ (function ($) { 'use strict'; // Product Offers Carousel/Slider $(document).ready(function () { $('.product-offers-carousel').each(function () { $(this).find('.product-offers-carousel__slider').attr('aria-roledescription', 'carousel'); $(this).find('.product-offers-carousel__pagination').attr('aria-atomic', 'true').attr('aria-live', 'polite'); let sliderMain = $(this).find('.product-offers-carousel__slider:not(.slick-initialized)'); const autoplay = $('body').hasClass('single-landing-page') ? true : false; sliderMain.on('init', function (event, slick) { // Correct way to handle initialization logic $('.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-prev').attr('aria-label', 'Previous slide'); $('.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-next').attr('aria-label', 'Next slide'); // .product-offers-carousel__item image add alt text. $('.product-offers-carousel__item').each(function () { const $this = $(this); const altText = $this.find('.product-offers-carousel__title').text(); const imageAlt = $this.find('.product-offers-carousel__img img').attr('alt'); if (imageAlt === '') { $(this).find('.product-offers-carousel__img img').attr('alt', altText); } }); // Add aria-live region to the slider. setTimeout(function () { $('.product-offers-carousel__slider .slick-track').attr('aria-live', 'polite'); $('.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-prev').removeAttr('tabindex'); $('.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-next').removeAttr('tabindex'); }, 1000); }); sliderMain.slick({ infinite: false, dots: false, initialSlide: 0, slidesToShow: 1.4, slidesToScroll: 1, arrows: false, autoplay: autoplay, responsive: [{ breakpoint: 1024, settings: { slidesToShow: 1.3 } }, { breakpoint: 767, settings: { slidesToShow: 1, arrows: false, dots: true } }] }); sliderMain.on('init afterChange', function () { $('.slick-arrow').each(function () { const disabled = $(this).attr('aria-disabled') === 'true'; $(this).attr('tabindex', disabled ? '-1' : '0'); }); }); sliderMain.on('afterChange', function (event, slick, currentSlide) { // Use currentSlide parameter directly const $slide = $(slick.$slides[currentSlide]); $slide.attr('aria-hidden', 'false').siblings().attr('aria-hidden', 'true'); }); $(document).on('click', '.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-prev', function () { $(this).parents('.product-offers-carousel__slider.slick-initialized').slick('slickPrev'); $(this).attr('aria-disabled', 'true'); }); $(document).on('click', '.product-offers-carousel__slider.slick-initialized .product-offers-carousel__img .slick-next', function () { $(this).parents('.product-offers-carousel__slider.slick-initialized').slick('slickNext'); $(this).attr('aria-disabled', 'true'); }); // Helper function to set aria-disabled for previous and next buttons function updateAriaDisabled(slider) { var $slider = $(slider); var currentSlide = $slider.slick('slickCurrentSlide'); var slideCount = $slider.slick('getSlick').slideCount; // .slick-prev in first slide var $firstPrev = $slider.find('.slick-slide').first().find('.slick-prev'); if ($firstPrev.length) { if (currentSlide === 0) { $firstPrev.attr('aria-disabled', 'true'); } } // .slick-next in last slide var $lastNext = $slider.find('.slick-slide').last().find('.slick-next'); if ($lastNext.length) { if (currentSlide === slideCount - 1) { $lastNext.attr('aria-disabled', 'true'); } } } // On init and after slide change, update aria-disabled sliderMain.on('init reInit afterChange', function (event, slick) { updateAriaDisabled(this); }); // If already initialized (e.g., when page loaded from bfcache) if (sliderMain.hasClass('slick-initialized')) { updateAriaDisabled(sliderMain); } }); }); })(jQuery); /******/ })() ; //# sourceMappingURL=view.js.map; /******/ (function() { // webpackBootstrap var __webpack_exports__ = {}; /*!******************************************!*\ !*** ./src/js/blocks/highlights/view.js ***! \******************************************/ /** * File history. * * Handles history blocks. */ (function ($) { 'use strict'; $('.highlights-list__box').each(function (index) { if ($(this).find('.highlights-list__box-cnt').find('a').length > 0) { const buttonText = $(this).find('.highlights-list__box-cnt').find('a').text(); const title = $(this).find('.h5').text(); const h5Text = $(this).find('h5').text(); // only 5 words of description const description = $(this).find('.highlights-list__box-cnt').find('p').text().split(' ').slice(0, 5).join(' '); if (title == '' && h5Text == '') { $(this).find('.highlights-list__box-cnt').find('a').attr('aria-label', `${buttonText}: ${description}...`); } else { $(this).find('.highlights-list__box-cnt').find('a').attr('aria-label', `${buttonText}: ${title || h5Text}: ${description}`); } } }); })(jQuery); /******/ })() ; //# sourceMappingURL=view.js.map;