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AQO,SAAS,WAClBP,EAAQC,SAAS,WAKzB,IAAIO,EAAkBL,GAA8B,EAEpDK,GAAkC5B,EAAM6B,QAAQC,eAGhDF,GAAkC,EAElCR,EAAQW,KAAKH,EAAiB,MAAQH,GAEtCL,EAAQY,YAAY,SACxB,GACJ,CAEAnB,EAAQS,GAAG,eAAe,SAAUtB,EAAOuB,EAAcC,GACzClE,MAARC,MAAqBS,EAAQX,QAAQ4E,6BACrC1E,KAAKC,KAAK,CACN,sBAAyB,QACzB,SAAYQ,EAAQX,QAAQ4E,6BAGxC,IAEApB,EAAQqB,IAAI,sBAAsBlC,MAAM,CACpCmC,MAAO,EACPC,aAAc,EACdN,eAAgB,EAChBO,QAAQ,EACRC,YAAY,EACZC,MAAM,EACNC,WAAYvB,EACZwB,UAAU,EACVC,eAAe,EACfC,WAAY,CACR,CACIC,WAAY,KACZC,SAAU,CACNT,aAAc,EACdN,eAAgB,IAGxB,CACIc,WAAY,IACZC,SAAU,CACNT,aAAc,EACdE,YAAY,KAIxBQ,UAAWhC,EACXiC,UAAW/B,EACXgC,UAAW9B,EAAyB,kBAAoB,WAG5DL,EAAQE,KAAK,+DAA+DkC,aAChF,CACJ,CACJ,EAEAnG,OAAOC,GAAGC,oCAAoCS,O","sources":["webpack://netzkern.am/./src/Feature/SponsorshipExamples/code/Scripts/SponsorshipExamples/inyournearSponsorshipExamplesSlider.js"],"sourcesContent":["import '../../Styles/inyournearSponsorshipExamplesSlider.scss';\r\n\r\nawait import('slick-carousel');\r\nawait import(/* webpackChunkName: \"jquery-match-height\" */ 'jquery-match-height');\r\n \r\nawait import(/* webpackChunkName: \"ajax\" */ 'Feature/Common/code/Scripts/Common/ajax');\r\nawait import(/* webpackChunkName: \"sync\" */ 'Feature/Common/code/Scripts/Common/sync');\r\n \r\nawait import(/* webpackChunkName: \"helpers\" */ 'Foundation/Common/code/Scripts/Common/helpers');\r\nawait import(/* webpackChunkName: \"requiredAdvanced\" */ 'Foundation/Forms/code/Scripts/requiredAdvanced');\r\n\r\nawait import(/* webpackChunkName: \"forms\" */ 'Feature/Forms/code/Scripts/forms');\r\n\r\nwindow.am = window.am || {};\r\n\r\nwindow.am.inyournearSponsorshipExamplesSlider = new function () {\r\n var that = this;\r\n\r\n that.trackClick = function (element) {\r\n var eventId = element.dataset.eventId;\r\n\r\n if (!eventId) {\r\n return;\r\n }\r\n\r\n if (utag != undefined) {\r\n utag.link({\r\n 'etracker_event_action': 'click',\r\n 'event_id': eventId\r\n });\r\n }\r\n }\r\n\r\n that.init = function () {\r\n\r\n let inyourAreaSponsorshipExamples = document.querySelectorAll('.inyourarea-sponsorshipexamples');\r\n\r\n if (inyourAreaSponsorshipExamples == null || inyourAreaSponsorshipExamples.length == 0) {\r\n return;\r\n }\r\n\r\n for (var exampleIndex = 0; exampleIndex < inyourAreaSponsorshipExamples.length; exampleIndex++) {\r\n let inyourAreaSponsorshipExample = inyourAreaSponsorshipExamples[exampleIndex];\r\n let wrapper = inyourAreaSponsorshipExample.querySelector('.inyourarea-sponsorshipexamples-slider-wrapper.ready');\r\n\r\n if (wrapper == null) {\r\n continue;\r\n }\r\n\r\n let slider = wrapper.querySelector('.slider');\r\n\r\n initSlider(slider, wrapper);\r\n\r\n let searchForm = inyourAreaSponsorshipExample.querySelector('.am-form form');\r\n\r\n if (searchForm) {\r\n searchForm.addEventListener('submit', function (event) {\r\n /* prevent page reload */\r\n event.preventDefault();\r\n\r\n if (window.am.forms.shouldSubmit(searchForm)) {\r\n refreshSlides(searchForm, inyourAreaSponsorshipExample, wrapper);\r\n return true;\r\n }\r\n\r\n return false;\r\n });\r\n\r\n let changePostalCodeButton = inyourAreaSponsorshipExample.querySelector('.change-postalcode-button');\r\n\r\n if (changePostalCodeButton != null) {\r\n changePostalCodeButton.addEventListener('click', function () {\r\n let selectForm = inyourAreaSponsorshipExample.querySelector('.select-form');\r\n let selectedForm = inyourAreaSponsorshipExample.querySelector('.selected-area');\r\n\r\n selectForm.classList.remove('d-none');\r\n selectedForm.classList.add('d-none');\r\n });\r\n }\r\n }\r\n }\r\n\r\n function refreshSlides(form, inyourAreaSponsorshipExample, wrapper) {\r\n let host = window.location.protocol + '//' + window.location.hostname;\r\n var url = new URL('/api/sitecore/sponsorshipexamples/getinyournearsponsorshipexamplesliderteasers', host);\r\n\r\n url.searchParams.append('datasource', form.querySelector('[name=\"DatasourceId\"]').value);\r\n url.searchParams.append('postalCode', form.querySelector('[name=\"PostalCode\"]').value);\r\n\r\n window.am.ajax.sendRequest(\r\n url,\r\n 'GET',\r\n function (response) { successCallback(response, form, inyourAreaSponsorshipExample, wrapper); },\r\n function () { window.am.forms.enableSubmitButton(form); })\r\n }\r\n\r\n function successCallback(response, form, area, wrapper) {\r\n\r\n let slider = wrapper.querySelector('.slider');\r\n $(slider).slick('unslick');\r\n $(slider).off();\r\n\r\n slider.innerHTML = response.html;\r\n\r\n initSlider(slider, wrapper);\r\n\r\n let selectForm = area.querySelector('.select-form');\r\n let selectedForm = area.querySelector('.selected-area');\r\n selectForm.classList.add('d-none');\r\n selectedForm.classList.remove('d-none');\r\n\r\n let postalcodeValue = form.querySelector('[name=\"PostalCode\"]').value;\r\n let contentEl = selectedForm.querySelector('.simple-content');\r\n let dataTemplate = contentEl.getAttribute('data-content');\r\n\r\n if (dataTemplate) {\r\n dataTemplate = atob(dataTemplate).replace(/\\$postalcode/g, postalcodeValue);\r\n }\r\n contentEl.innerHTML = dataTemplate;\r\n\r\n window.am.forms.enableSubmitButton(form);\r\n }\r\n\r\n function initSlider(slider, wrapper) {\r\n let $wrapper = $(wrapper);\r\n let $slider = $(slider);\r\n let $prevArrow = $wrapper.find(\".pagination .pagination-prev\");\r\n let $nextArrow = $wrapper.find(\".pagination .pagination-next\");\r\n let $dotsNavContainer = $wrapper.find(\".pagination-dots\");\r\n let isSliderWithLessSlides = slider.childElementCount <= 3;\r\n\r\n if (!isSliderWithLessSlides) {\r\n let $status = $wrapper.find(\".pagingInfo\");\r\n\r\n $status.addClass(\"show\");\r\n\r\n if ($dotsNavContainer) {\r\n $dotsNavContainer.addClass('d-none');\r\n }\r\n\r\n $slider.on(\"init reInit afterChange\", function (event, slick, currentSlide, nextSlide) {\r\n\r\n let totalCount = slick.getDotCount() + 1;\r\n\r\n if (totalCount == 1) {\r\n\r\n if (!$status.hasClass('d-none')) {\r\n $status.addClass('d-none');\r\n }\r\n return;\r\n }\r\n\r\n let currentSlideNo = (currentSlide ? currentSlide : 0);\r\n\r\n currentSlideNo = currentSlideNo / slick.options.slidesToScroll;\r\n\r\n /* 0 index based */\r\n currentSlideNo = currentSlideNo + 1;\r\n\r\n $status.text(currentSlideNo + \" / \" + totalCount);\r\n\r\n $status.removeClass('d-none');\r\n });\r\n }\r\n \r\n $slider.on(\"afterChange\", function (slick, currentSlide, nextSlide) {\r\n if (utag != undefined && wrapper.dataset.trackingSliderChangeEventId) {\r\n utag.link({\r\n 'etracker_event_action': 'click',\r\n 'event_id': wrapper.dataset.trackingSliderChangeEventId\r\n });\r\n }\r\n });\r\n\r\n $slider.not('.slick-initialized').slick({\r\n speed: 0,\r\n slidesToShow: 4,\r\n slidesToScroll: 1,\r\n arrows: true,\r\n centerMode: false,\r\n dots: false,\r\n appendDots: $dotsNavContainer,\r\n infinite: true,\r\n variableWidth: true,\r\n responsive: [\r\n {\r\n breakpoint: 1025,\r\n settings: {\r\n slidesToShow: 2,\r\n slidesToScroll: 2\r\n }\r\n },\r\n {\r\n breakpoint: 768,\r\n settings: {\r\n slidesToShow: 1,\r\n centerMode: true,\r\n }\r\n }\r\n ],\r\n prevArrow: $prevArrow,\r\n nextArrow: $nextArrow,\r\n dotsClass: isSliderWithLessSlides ? \"pagination-dots\" : \"d-none\"\r\n });\r\n\r\n $slider.find('.slider-item .teaser-content .teaser-headline:not(.no-text)').matchHeight();\r\n }\r\n }\r\n}\r\n\r\nwindow.am.inyournearSponsorshipExamplesSlider.init()"],"names":["window","am","inyournearSponsorshipExamplesSlider","this","trackClick","element","eventId","dataset","undefined","utag","link","init","inyourAreaSponsorshipExamples","document","querySelectorAll","length","exampleIndex","inyourAreaSponsorshipExample","wrapper","querySelector","initSlider","searchForm","addEventListener","event","preventDefault","forms","shouldSubmit","refreshSlides","changePostalCodeButton","selectForm","selectedForm","classList","remove","add","form","host","location","protocol","hostname","url","URL","searchParams","append","value","ajax","sendRequest","response","area","slider","$","slick","off","innerHTML","html","postalcodeValue","contentEl","dataTemplate","getAttribute","atob","replace","enableSubmitButton","successCallback","$wrapper","$slider","$prevArrow","find","$nextArrow","$dotsNavContainer","isSliderWithLessSlides","childElementCount","$status","addClass","on","currentSlide","nextSlide","totalCount","getDotCount","hasClass","currentSlideNo","options","slidesToScroll","text","removeClass","trackingSliderChangeEventId","not","speed","slidesToShow","arrows","centerMode","dots","appendDots","infinite","variableWidth","responsive","breakpoint","settings","prevArrow","nextArrow","dotsClass","matchHeight"],"sourceRoot":""}