MAURIPRO

`); hyva.replaceDomElement(`.filter-option.${filterName}`, cloneNode.outerHTML); } }); }, removeFilterOptionsFromSidebar() { this.uniqueElements.forEach(element => { const amShopByFilter = element.querySelector('[data-amshopby-filter]'); const filterName = amShopByFilter?.getAttribute('data-amshopby-filter'); if (filterName) { const sidebarMain = document.querySelector('.sidebar-main.one-column-wrapper .block-content'); const filterOptionElement = sidebarMain.querySelector(`.filter-option.${filterName}`); if (filterOptionElement) { filterOptionElement.remove(); } } }); }, /** * */ checkIsMobileResolution(element) { this.isMobile = window.matchMedia('(max-width: 768px)').matches; this.isSidebar = this.isOneColumn && this.isMobile; if (this.isOneColumn) { const elementToRemove = document.querySelector('.amasty-catalog-topnav'); if (elementToRemove) { elementToRemove.remove(); } } }, /** * * @param index */ setOpenedFilter(index) { if (this.isMobile) { return; } this.openedFilter !== parseInt(index) ? this.openedFilter = parseInt(index) : this.openedFilter = null; }, /** * * @param index * @returns {boolean} */ isFilterOpened(index) { return this.openedFilter === parseInt(index); } } }
`; } }, { to: function (value) { let newValue = ''; if (currencyPosition && isCurrencyUnitLabel) { newValue = self.options.currencySymbol + ' ' + (self._parseValue(value * +self.options.curRate)); } else if (currencyPosition) { newValue = (self._parseValue(value * +self.options.curRate)) + ' ' + self.options.currencySymbol; } else if (isCurrencyUnitLabel) { newValue = self.options.currencySymbol + (self._parseValue(value * +self.options.curRate)); } else { newValue = self.options.currencySymbol + ' ' + (self._parseValue(value * +self.options.curRate)); } return `
${newValue}
`; } } ], handleAttributes: [ {'aria-label': `lower - ${this.filterCode}`}, {'aria-label': `upper - ${this.filterCode}`} ], } }, /** * * @param coefficient ex. 0.3 - 30% lighter; -0.3 - 30% darker * @param color {string} hex, rgb, rgba * @returns {null|string} * @private */ _newShade(coefficient, color) { return pSBC(coefficient, color); }, /** * * @param lightenColor * @param color * @param type {string} 'vertical' || 'horizontal' * @returns {string} * @private */ _generateGradient(lightenColor, color, type) { if (type === 'vertical') { return 'linear-gradient(160deg, ' + lightenColor + '40%, ' + color + ' 100%)'; } if (type === 'horizontal') { return 'linear-gradient(270deg,' + color + ' 0%, ' + lightenColor + ' 100%)'; } }, /** * * @param searchParams {string} * @param values {string} * @private */ _dispatchEventsForAjax(searchParams, values) { setTimeout(() => { window.dispatchEvent(new CustomEvent('amSliderValuesUpdated', { detail: { searchParams: searchParams, values: values, element: this.filterElement } })); }, 0); }, eventListeners: { ['@noUiSliderLoaded.window']() { this.sliderLoaded = true; }, ['@clearSlider.window']() { const priceInputs = document.querySelectorAll( `[name="amshopby[${this.code}][]"]` ); if (priceInputs.length > 1) { priceInputs.forEach(price => { price.value = ''; }); } } } } }

Items 1 to 20 of 22