1function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}import Utils from"./quick-filters-utils";var QuickFilter=function(){function QuickFilter(partnerInformation){var domContent=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,QuickFilter),this.utils=new Utils,this.loadCompleted=!1,this.partnerInformation=JSON.parse(JSON.stringify(partnerInformation)),this.domSectionQuickFilter=document.querySelector(".quick-filter"),this.domTotalResults=document.querySelector("#quick-filter-section .quick-filter__wrapper >.quick-filter__total-results"),this.domShowMore=document.querySelector(".show-more"),this.selectBoxes=[],this.skeletonQuickFilters=document.querySelector(".skeleton-quick-filters"),this.quickFiltersWrapper=document.querySelector("#quick-filter-section .quick-filter__wrapper"),this.domContent=domContent?document.querySelector("#quick-filter-section .quick-filter__wrapper > div.quick-filter__content > "+domContent):document.querySelector("#quick-filter-section .quick-filter__wrapper > div.quick-filter__content"),this.dataURL="/_atomic/php/components/molecules/test-cards/test-cards-schema-with-casino-link.php",this.store={filters:{sortedBy:"",searchBox:"",providers:[],paymentMethod:[]},partners:[],providers:[],paymentMethods:[],currentViewType:"all",currentView:[]},this.prepareFilters()}return _createClass(QuickFilter,[{key:"getStorePartnersSorted",value:function getStorePartnersSorted(partnerData){return this.utils.sortProperties("rating-desc",partnerData)}},{key:"prepareFilters",value:function prepareFilters(){this.store.partners=this.getStorePartnersSorted(_toConsumableArray(this.partnerInformation)),this.store.providers=this.getProviders(this.partnerInformation),this.store.paymentMethods=this.getPaymentMethods(this.partnerInformation),this.init()}},{key:"prepareFiltersMobile",value:function prepareFiltersMobile(){var _this=this;this.mobileProvidersMenuItem.addEventListener("click",function(){_this.mobileProvidersList.classList.remove("hide"),_this.mobileMainMenu.classList.add("hide"),_this.mobileNavigationMenu.classList.add("hide"),_this.mobileNavigationNextMenu.classList.remove("hide")}),this.mobilePaymentsMenuItem.addEventListener("click",function(){_this.mobilePaymentsList.classList.remove("hide"),_this.mobileMainMenu.classList.add("hide"),_this.mobileNavigationMenu.classList.add("hide"),_this.mobileNavigationNextMenu.classList.remove("hide")}),this.mobileNavigationNextMenu.addEventListener("click",function(){_this.mobileNavigationMenu.classList.remove("hide"),_this.mobileNavigationNextMenu.classList.add("hide"),_this.mobileProvidersList.classList.add("hide"),_this.mobilePaymentsList.classList.add("hide"),_this.mobileMainMenu.classList.remove("hide")}),this.mobileProvidersItems=this.mobileFilters.querySelectorAll(".mobile-filters__items__filter-group__single-provider"),this.mobilePaymentsItems=this.mobileFilters.querySelectorAll(".mobile-filters__items__filter-group__single-payment"),this.mobileProvidersItems.forEac
1h(function(provider){provider.addEventListener("click",function(){var mobileProvidersSelected=_this.mobileProvidersList.querySelectorAll("input[type=checkbox]:checked"),mobileProvidersValues=[];[].forEach.call(mobileProvidersSelected,function(el){mobileProvidersValues.push(el.value)}),_this.updateFilteredItemsListOnMobile(mobileProvidersValues,_this.mobileProvidersMenuItemsSelected,_this.mobileProvidersMenuItemsSelectedNumber),_this.utils.countProperties(mobileProvidersValues)&&_this.resetSearchBox(),_this.store.filters.providers=mobileProvidersValues,_this.updateMobileBtnViewResults()})}),this.mobilePaymentsItems.forEach(function(payment){payment.addEventListener("click",function(){var mobilePaymentsSelected=_this.mobilePaymentsList.querySelectorAll("input[type=checkbox]:checked"),mobilePaymentsValues=[];[].forEach.call(mobilePaymentsSelected,function(el){mobilePaymentsValues.push(el.value)}),_this.updateFilteredItemsListOnMobile(mobilePaymentsValues,_this.mobilePaymentsMenuItemsSelected,_this.mobilePaymentsMenuItemsSelectedNumber),_this.utils.countProperties(mobilePaymentsValues)&&_this.resetSearchBox(),_this.store.filters.paymentMethod=mobilePaymentsValues,_this.updateMobileBtnViewResults()})}),this.mobileBtnViewResults.addEventListener("click",function(){_this.mobileFilters.classList.add("shrinked"),_this.getSearch()}),this.mobileFiltersBtn.addEventListener("click",function(){_this.mobileFilters.classList.remove("shrinked")}),this.mobileFiltersResetBtn.addEventListener("click",function(){_this.resetFilters()}),this.mobileNavigationCloseBtn.addEventListener("click",function(){_this.mobileFilters.classList.add("shrinked")})}},{key:"updateFilteredItemsListOnMobile",value:function updateFilteredItemsListOnMobile(selectedValues,selectedItemsDiv,selectedItemsNumberDiv){selectedItemsDiv.innerHTML=selectedValues.join(", "),selectedItemsNumberDiv.innerHTML=0<selectedValues.length?selectedValues.length.toString():"Alle",this.updateFilteredItemsSummaryNumberOnMobile()}},{key:"updateFilteredItemsSummaryNumberOnMobile",value:function updateFilteredItemsSummaryNumberOnMobile(){var mobileFiltersSummary=0;this.mobileFiltersMenuItemsSelectedNumber.forEach(function(e){mobileFiltersSummary+=isNaN(parseInt(e.innerHTML))?0:parseInt(e.innerHTML)}),this.mobileFiltersButton.innerHTML=0<mobileFiltersSummary?"Filtern ("+mobileFiltersSummary+")":"Filtern"}},{key:"updateMobileBtnViewResults",value:function updateMobileBtnViewResults(){var storePartners=this.store.partners,filterSearchBox=this.store.filters.searchBox,filterProviders=this.store.filters.providers,filterPaymentMethod=this.store.filters.paymentMethod,totalProviders=this.utils.countProperties(filterProviders),totalPaymentMehtods=this.utils.countProperties(filterPaymentMethod),totalSearchBoxChars=this.utils.countProperties(filterSearchBox);if(0<totalProviders){var currentDataStore=0<totalPaymentMehtods?this.store.currentView:storePartners;this.store.currentView=this.syncFilterElementsExist(filterProviders,currentDataStore,"providers")}if(0<totalPaymentMehtods){var _currentDataStore=0<totalProviders?this.store.currentView:storePartners;this.store.currentView=this.syncFilterElementsExist(filterPaymentMethod,_currentDataStore,"payments")}0<totalSearchBoxChars&&(this.store.currentView=this.syncFilterBySitename(filterSearchBox,storePartners)),0===totalProviders&&0===totalPaymentMehtods&&0===totalSearchBoxChars&&(this.store.currentView=storePartners.length);var totalCurrentView=this.utils.countProperties(this.store.currentView);this.mobileBtnViewResults.innerHTML=0<totalCurrentView?totalCurrentView+" Ergebnisse":"Keine Ergebnisse"}},{key:"resetActiveBtnState",value:function resetActiveBtnState(){this.domProvidersTypeButton.forEach(function(e){e.classList.remove("active")})}},{key:"init",value:function init(){var _this2=this;this.renderView(this.domContent,this.store.partners),setTimeout(function(){_this2.markloadCompleted()},2e3)}},{key:"markloadCompleted",value:function markloadCompleted(){this.skeletonQuickFilters.remove(),this.domContent.style.display="grid",this.quickFiltersWrapper.style.display="grid"}}
1,{key:"getTestCardStructure",value:function getTestCardStructure(){return axios({method:"get",url:this.dataURL,responseType:"text",headers:{"X-Requested-With":"XMLHttpRequest"}})}},{key:"removeDuplicateObj",value:function removeDuplicateObj(properties){return this.utils.checkIfObject(properties)&&(properties=this.utils.convertObjectToArray(properties)),properties.filter(function(item,index){return properties.indexOf(item)===index})}},{key:"setMessageNoResults",value:function setMessageNoResults(container,displayTotalFound,currentViewTotalProperties){displayTotalFound.innerHTML=currentViewTotalProperties+" Casinos gefunden",container.innerHTML="Es wurden keine Ergebnisse gefunden."}},{key:"renderView",value:function renderView(domContent,currentView){var _this3=this;domContent.innerHTML="",currentView=this.removeDuplicateObj(currentView),0===currentView.length&&(this.domShowMore&&this.getBtnShowMore(),this.setMessageNoResults(domContent,this.domTotalResults,currentView.length)),this.getTestCardStructure().then(function(response){Object.keys(currentView).forEach(function(item){domContent.appendChild(_this3.transferPartnerDataToComponent(currentView[item],response.data))}),switchTabs(),activateTooltips(),_this3.domTotalResults.innerHTML=currentView.length+" Casinos gefunden",_this3.loadCompleted=!0,_this3.domShowMore&&setTimeout(function(){_this3.getBtnShowMore(),itemsPerPage()},300)})["catch"](function(error){console.error(error)})}},{key:"getBtnShowMore",value:function getBtnShowMore(){var domTotalCards=document.querySelectorAll("section.quick-filter .test-cards .test-card").length;20<domTotalCards?this.domShowMore.classList.remove("hide"):this.domShowMore.classList.add("hide")}},{key:"getProviders",value:function getProviders(data){var output={};return data.forEach(function(el){return el.providers.forEach(function(author){output.hasOwnProperty(author)?output[author]++:output[author]=1})}),output}},{key:"getPaymentMethods",value:function getPaymentMethods(data){var output={};return data.forEach(function(el){return el.payments.forEach(function(payment){output.hasOwnProperty(payment)?output[payment]++:output[payment]=1})}),output}},{key:"transferPartnerDataToComponent",value:function transferPartnerDataToComponent(item,card){var cardElement=this.utils.parseHTML(card),casinoRatingContainer=cardElement.querySelector(".rating-container"),ratingStars=this.ratingStarsGenerator(10*item.rating),casinoLogoLinkElem=cardElement.querySelector(".test-card__front__images__logo"),casinoLogoElem=casinoLogoLinkElem.querySelector("img"),casinoLogoSvgElem=cardElement.querySelector(".switch-tab"),casinoNameElem=cardElement.querySelector(".test-card__front__casino-name p"),casinoBonusElem=cardElement.querySelector(".test-card__front__bonus p"),casinoProvdersPElem=cardElement.querySelector(".test-card__front__providers p"),casinoNameElemBack=cardElement.querySelector(".test-card__back__casino-name p"),casinoDescriptionElemBack=cardElement.querySelector(".test-card__back__casino-desc p"),reviewButton=cardElement.querySelector("a.button"),reviewButtonClass=cardElement.querySelector(".test-card__links a"),tooltipTextElem=cardElement.querySelector(".info-tooltip__text"),casinoRatingContainerValue=casinoRatingContainer.querySelector(".rating-container__rating__value"),casinoRatingContainerStars=casinoRatingContainer.querySelector(".rating-stars"),casinoLink=cardElement.querySelector(".test-card__casino-link");casinoLogoLinkElem.setAttribute("href",item.testsPageUrl),casinoLogoElem.setAttribute("data-src",item.logoSvgUrl),casinoLogoElem.setAttribute("alt",item.sitename),casinoNameElem.innerHTML=item.sitename,casinoBonusElem.innerHTML="Bonus<span>"+item.bonus+"</span>",casinoProvdersPElem.textContent=Object.keys(item.providers).length+" Spiele-Provider",casinoNameElemBack.innerHTML=item.sitename,casinoDescriptionElemBack.innerHTML=item.gamesDescription,reviewButton.setAttribute("href",item.testsPageUrl),casinoLink.setAttribute("href",item.affiliateLink),tooltipTextElem.innerHTML=item.providers.join(", ");var roundRating=this.round(item.rating/2,1);return casinoRatingContainerValue.innerHTML=roundRating,casinoRatingContainerStars.innerHTML=ratingStars,""===item.gamesDescription||null===item.gamesDescription?casinoLogoSvgElem.style.visibility="hidden":null,""
1===item.testsPageUrl||null===item.testsPageUrl?(reviewButtonClass.classList.add("disabled"),casinoLogoLinkElem.removeAttribute("href"),casinoLogoLinkElem.style.cursor="default"):reviewButtonClass.classList.add("secondary"),cardElement}},{key:"ratingStarsGenerator",value:function ratingStarsGenerator(rating){for(var ratingStars="",i=1;5>=i;i++)ratingStars+=rating>=20*i?"<img class=\"full-star\" src=\"/_atomic/assets/icons/rating-stars/full-star.svg\"/>":rating>=20*i-10?"<img class=\"half-star\" src=\"/_atomic/assets/icons/rating-stars/half-star.svg\"/>":"<img class=\"empty-star\" src=\"/_atomic/assets/icons/rating-stars/empty-star.svg\"/>";return ratingStars}},{key:"round",value:function round(num,decimalPlaces){return num=Math.round(num+"e"+decimalPlaces),+(num+"e"+-decimalPlaces)}}]),QuickFilter}();window.onload=function(){"undefined"==typeof domContent?new QuickFilter(partnerInformation):new QuickFilter(partnerInformation,domContent)};
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.