Microgreens & Sprout Seeds: Sprouting Seeds (2024)

Items 1-36 of 39

Grid

sort-descending

Items 1-36 of 39

Loading...

'; this.qs('#layered-filter-block-content').appendChild(filter); }); self.isImrovedSorting = !!self.qs(self.selectors.improvedSortingWrapper); if (self.qs(self.toolbarElements.mode)) { self.addToolbarEvent(self.toolbarElements.mode, 'click', 'mode'); } if (self.qs(self.toolbarElements.sortDir)) { self.addToolbarEvent(self.toolbarElements.sortDir, 'click', 'direction'); } if (self.qs(self.toolbarElements.sort)) { self.addToolbarEvent(self.toolbarElements.sort, 'change', 'order'); } if (self.qs(self.toolbarElements.limiter)) { self.addToolbarEvent(self.toolbarElements.limiter, 'change', 'limit'); } this.topFiltersCheckOnMobile(); this.setSelectedPrtoductSwatch(); }, setSelectedPrtoductSwatch() { this.qsa(this.selectors.removeAllItems).forEach(item => { if (item.getAttribute('data-massset')) { this.setSwatchMassToProducts( item.getAttribute('data-massset'), item.getAttribute('data-attribute-id') ) } if (item.getAttribute('data-swatchset')) { this.setSwatchToProducts( item.getAttribute('data-swatchset'), item.getAttribute('data-attribute-id') ) } }); }, addToolbarEvent(element, event, paramValue) { const self = this, el = self.qs(element); el.removeAttribute('@click.prevent'); el.removeAttribute('@change'); el.replaceWith(el.cloneNode(true)); self.qs(element).addEventListener(event, e => { self.stopEvents(e); let value; if (paramValue === 'order' || paramValue === 'limit') { value = e.currentTarget.value; } else if (paramValue === 'direction') { const classNames = e.currentTarget.getAttribute('class'); value = classNames.indexOf('sort-desc') === -1 ? 'desc' : 'asc'; } else { value = e.currentTarget.getAttribute('data-value'); } self.changeUrl( paramValue, value ); }, false); }, /** * @public * @param {Object} element * @return {Boolean} */ isFinderAndCategory(element) { return location.href.indexOf('find=') !== -1 && element.type === 'radio' && element.name === 'amshopby[cat][]'; }, setSwatchBorder(element) { element.classList.toggle('border-container-darker'); element.classList.toggle('border-container-lighter'); element.classList.toggle('ring'); element.classList.toggle('ring-primary'); element.classList.toggle('ring-opacity-50'); element.classList.toggle('amshopby-link-selected'); }, /** * @public * @param {String} name * @param {String} value * @return {void} */ setDefault(name, value) { var self = this, valueSelector = self.selectors.filterName.replace('{name}', name), type, selected; this.qsa(valueSelector).forEach((filter, index) => { type = filter.tagName; switch (type) { case 'SELECT': if (name === 'price') { filter.querySelectorAll('option').forEach((element, index) => { if (self.toValidView(element.value.split('-')) === value) { element.selected = false; } }); filter.querySelector('[value="' + value + '"]').selected = true; } break; case 'INPUT': selected = ''; if (filter.getAttribute('type') !== 'text' && filter.getAttribute('type') !== 'hidden') { this.qsa(valueSelector + '[value="' + value + '"]').forEach(selected => { selected.checked = false; const selectedSibling = [...selected.parentNode.children] .filter((child) => child !== selected); selectedSibling.forEach(sibling => { sibling.classList.remove('selected'); }); }); } else if ((filter.getAttribute('type') === 'hidden' && self.isEquals(name, filter.value, value)) || name === 'price' ) { filter.value = ''; } break; } }); }, /** * @public * @param {Array} values * @return {String} */ toValidView(values) { values[0] = values[0] ? parseFloat(values[0]).toFixed() : values[0]; values[1] = values[1] ? parseFloat(values[1]).toFixed() : values[1]; return values[0] + '-' + values[1]; }, /** * @public * @param {String} name * @param {String} filterValue * @param {String} value * @return {Boolean} */ isEquals(name, filterValue, value) { var values = value.split('-'), filterValues = filterValue.split('-'); if (values.length > 1) { filterValue = this.toValidView(filterValues); value = this.toValidView(values); } return filterValue === value; }, /** * @public * @param {String | null} element * @param {String | null} clearUrl * @param {Boolean | null} [clearFilter] * @param {Boolean} [isSorting] * @return {Array} */ prepareTriggerAjax(element, clearUrl, clearFilter, isSorting) { let self = this, selectors = this.selectors, forms = this.qsa(this.selectors.filterForm), attributeName, excludedFormSelector, existFields = [], savedFilters = [], className, startPos, endPos, filterClass, isPriceType, serializeForms = [], isPriceExist, data; if (typeof this.element !== 'undefined' && clearFilter) { attributeName = selectors.filterFormAttr .replace('{attr}', this.element .closest(selectors.filterOptionsContent) .querySelector('form') .getAttribute('data-amshopby-filter')); excludedFormSelector = (this.element.closest(selectors.sidebar) ? selectors.topNav : selectors.sidebar) + ' ' + attributeName; forms = excludingElement(forms, excludedFormSelector); } forms.forEach((item, index) => { className = ''; if (item.closest(selectors.filterItems)) { className = item.closest(selectors.filterItems).className; } else if (item.querySelector(selectors.filterItems)) { className = item.querySelector(selectors.filterItems).className; } startPos = className.indexOf('am-filter-items'); endPos = className.indexOf(' ', startPos + 1) === -1 ? 100 : className.indexOf(' ', startPos + 1); filterClass = className.substring(startPos, endPos); isPriceType = item.closest(selectors.filterOptionsItem) .querySelectorAll(selectors.fromToWidget).length; if (filterClass && existFields[filterClass] && !isPriceType) { forms[index] = ''; } else { existFields[filterClass] = true; } }); forms.forEach(form => { const serializeData = self.serializeForm(form); if (serializeData.length) { serializeForms = [...serializeForms, ...serializeData]; } }); isPriceExist = false; // eslint-disable-next-line consistent-return serializeForms.map(item => { if (item.name === 'amshopby[price][]') { isPriceExist = true; return false; } }); if (!isPriceExist && savedFilters) { // eslint-disable-next-line no-shadow savedFilters.forEach(element => { serializeForms.push(self.serializeForm(element)[0]); }); } data = this.normalizeData(serializeForms, isSorting, clearFilter); data.clearUrl = data.clearUrl ? data.clearUrl : clearUrl; // eslint-disable-next-line no-param-reassign element = element || document; if (this.options.delta.length) { data = data.concat(this.options.delta); } if (element && element !== document && element.closest('.price-ranges')) { data.push({name: 'price-ranges', value: 1}); } window.dispatchEvent( new CustomEvent( 'amshopby-submit-filters', { detail: { data: data, clearFilter: clearFilter, isSorting: isSorting } } ) ) return data; }, /** * @public * @param {Array} data * @param {Boolean} [isSorting] * @param {Boolean} [clearFilter] * @return {Array} */ normalizeData(data, isSorting, clearFilter) { var self = this, normalizedData = [], clearUrl; data.forEach(item => { if (item && item.value.trim() !== '' && item.value !== '-1') { // eslint-disable-next-line vars-on-top let isNormalizeItem = normalizedData.find(normalizeItem => { return normalizeItem.name === item.name && normalizeItem.value === item.value || item.name === 'amshopby[price][]' && normalizeItem.name === item.name; }); if (!isNormalizeItem) { if (item.name === 'amshopby[price][]') { item.value = self.normalizePrice(item.value); } normalizedData.push(item); if (self.isCategorySingleSelect === 1 && item.name === 'amshopby[cat][]' && item.value !== self.currentCategoryId && !clearFilter && !isSorting ) { clearUrl = this.qs('*' + self.selectors.filterRequestVar + ' *[value="' + item.value + '"]') .closest('.item').querySelector('a').getAttribute('href'); } } } }); normalizedData = this.groupDataByName(normalizedData); if (clearUrl) { const locationData = clearUrl.split("?"); if (locationData.length > 1) { const url = locationData[0], urlParams = locationData[1].split('&'); urlParams.map((param, index) => { const paramKey = param.split(/=(.*)/)[0]; if (!this.qs('.amshopby-remove-item[data-container="'+ paramKey +'"]') && this.qs('[name="amshopby['+ paramKey +'][]"]')) { urlParams.splice(index, 1); } }); clearUrl = url + '?' + urlParams.join('&'); } normalizedData.clearUrl = clearUrl; } return normalizedData; }, /** * @public * @param {Array} formData * @return {Array} */ groupDataByName(formData) { var hash = Object.create(null); return formData.reduce((result, currentValue) => { if (!hash[currentValue.name]) { hash[currentValue.name] = {}; hash[currentValue.name].name = currentValue.name; result.push(hash[currentValue.name]); } if (hash[currentValue.name].value) { hash[currentValue.name].value += ',' + currentValue.value; } else { hash[currentValue.name].value = currentValue.value; } return result; }, []); }, /** * @public * @param {String} value * @return {String} */ normalizePrice(value) { var result = value.split('-'), i; for (i = 0; i < result.length; i++) { if (typeof result[i] == 'undefined') { result[i] = 0; } result[i] = this.processPrice(true, result[i]) .amToFixed(2, this.getHideDigitsAfterDot()); } return result.join('-').replace(/[ \r\n]/g, ''); }, /** * @public * @param {Boolean} toBasePrice * @param {String | Number} input * @param {String | Number} [delta] * @returns {Number} */ processPrice(toBasePrice, input, delta) { var rate = Number(this.options.curRate), inputPrice = Number(input); // eslint-disable-next-line no-param-reassign delta = typeof delta !== 'undefined' ? Number(delta) : 0; // eslint-disable-next-line no-nested-ternary return this.isBaseCurrency() ? inputPrice // eslint-disable-next-line no-extra-parens : (toBasePrice ? (inputPrice / rate) : ((inputPrice * rate) + delta)); }, /** * @public * @return {Number} */ getHideDigitsAfterDot() { const value = +this.qs('[name="amshopby[price][]"]').getAttribute('data-digits-after-dot'); return Number.isNaN(value) ? 0 : value; }, /** * @public * @returns {Boolean} */ isBaseCurrency() { return Number(this.options.curRate) === 1; }, showButtonCounter(count) { let data = { count:parseInt(count), disabled: false }; window.dispatchEvent(new CustomEvent('amApplyButtonData', { detail: data })); }, pagerEvent(e) { let newUrl = e.currentTarget.getAttribute('href'), updatedUrl = null, urlPaths = newUrl.split('?'), urlParams = urlPaths[1] ? urlPaths[1].split('&') : []; for (let i = 0; i < urlParams.length; i++) { if (urlParams[i].indexOf("p=") === 0) { let pageParam = urlParams[i].split('='); updatedUrl = this.getNewClearUrl(pageParam[0], pageParam[1] > 1 ? pageParam[1] : ''); break; } } if (!updatedUrl) { updatedUrl = e.currentTarget.getAttribute('href'); } updatedUrl = updatedUrl.replace('amp;', ''); this.prepareTriggerAjax(document, updatedUrl, false, true); window.scrollTo({ top: this.qs(this.selectors.products_wrapper).offsetTop, behavior: 'smooth' }) }, getUrlParams() { let decode = window.decodeURIComponent, urlPaths = window.location.href.split('?'), urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], params = {}, parameters, i; for (i = 0; i < urlParams.length; i++) { parameters = urlParams[i].split('='); params[decode(parameters[0])] = parameters[1] !== undefined ? decode(parameters[1].replace(/\+/g, '%20')) : ''; } return params; }, getCurrentLimit() { return this.getUrlParams()[this.toolbarOptions.limit] || this.toolbarOptions.limitDefault; }, getCurrentPage() { return this.getUrlParams()[this.toolbarOptions.page] || 1; }, changeUrl(param, paramValue) { let defaultValue = this.toolbarOptions[param + 'Default'], paramName = this.toolbarOptions[param], urlPaths = this.toolbarOptions.url.split('?'), baseUrl = urlPaths[0], paramData = this.getUrlParams(), currentPage = this.getCurrentPage(), newPage; /** * calculates the page on which the first item of the current page will * be with the new limit and sets that number as the new page */ if (currentPage > 1 && paramName === this.toolbarOptions.limit) { newPage = Math.floor(this.getCurrentLimit() * (currentPage - 1) / paramValue) + 1; if (newPage > 1) { paramData[this.toolbarOptions.page] = newPage; } else { delete paramData[this.toolbarOptions.page]; } } paramData[paramName] = paramValue; if (this.toolbarOptions.post) { hyva.postForm({action: baseUrl, data: paramData}); } else { if (paramValue === defaultValue.toString()) { delete paramData[paramName]; } paramData = Object.keys(paramData).length === 0 ? '' : '?' + (new URLSearchParams(paramData)); if (this.isImrovedSorting && paramValue === 'asc'){ paramData = paramData ? paramData + '&product_list_dir=asc' : ''; } if (this.isAjax) { this.prepareTriggerAjax(document, baseUrl + paramData, false, true); } else { location.href = baseUrl + paramData; } } }, getNewClearUrl(key, value, page) { var url = new URL(window.location.href), params = new window.URLSearchParams(url.search); if (value !== '') { params.set(key, value); } else { params.delete(key); } if (page) { params.set('p', page); } else if (key !== 'p') { params.delete('p'); } url.search = params; return window.decodeURIComponent(url.toString()); }, callAjax(clearUrl, data, pushState, cacheKey, isSorting) { const self = this; window.dispatchEvent(new CustomEvent('amClearButtonText', {})); if (pushState || isSorting) { self.isLoading = true; } data.every((item, key) => { if (item.name.indexOf('[cat]') != -1) { if (item.value == self.options.currentCategoryId) { data.splice(key, 1); } else { item.value.split(',').filter(element => { return element != self.options.currentCategoryId }).join(','); } return false; } return true; }); const pricefilter = data.find(item => item.name === 'amshopby[price][]'); if (pricefilter && pricefilter.value === 'NaN') { data.map((item, index) => { if (item.name === 'amshopby[price][]') { data = data.splice(index, 1); } }); } if (!this.submitByClick) { this.qsa(this.selectors.removeAllItems).forEach(removeItem => { const name = removeItem.getAttribute('data-container'), value = removeItem.getAttribute('data-value'); data.map(item => { if (!removeItem.classList.contains('radio-remove-item')) { if (item.name === 'amshopby['+ name +'][]') { if (item.value.indexOf(value) === -1) { item.value += ',' + value; } } } }); if (!data.find(item => item.name === 'amshopby['+ name +'][]')) { data.push({ name: 'amshopby['+ name +'][]', value: value }); } }); } if (!isSorting && !clearUrl) { const dir = 'product_list_dir', sort = 'product_list_order', params = new URL(location.href).searchParams; if (params.get(dir)) { data.push({name: dir, value: params.get(dir)}); } if (params.get(sort)) { data.push({name: sort, value: params.get(sort)}); } } data.push({name: 'shopbyAjax', value: 1}); self.startAjax = true; if (!clearUrl) { clearUrl = self.clearUrl; } clearUrl = clearUrl.replace(/amp;/g, ''); self.clearUrl = clearUrl; return fetch(self.getClearUrlParams(clearUrl, data), { headers: { 'Content-type': 'text/plain; charset=UTF-8', 'X-Requested-With': 'XMLHttpRequest', }, signal: this.signal } ).then(response => { return response.json() }).then(data => { try { self.startAjax = false; if (data.isDisplayModePage && !self.submitByClick) { const url = self.clearUrl ? self.clearUrl : self.options.clearUrl; window.location = (this.url && this.url.indexOf('shopbyAjax') == -1) ? this.url : url; return; } if (cacheKey) { self.cached[cacheKey] = data; } self.response = data; if (data.newClearUrl && (data.newClearUrl.indexOf('?p=') == -1 && data.newClearUrl.indexOf('&p=') == -1)) { self.options.clearUrl = data.newClearUrl; } if (pushState || self.showButtonClick || isSorting) { window.history.pushState({url: data.url}, '', data.url); } if (self.submitByClick !== 1 || isSorting) { self.reloadHtml(data); } if (self.showButtonClick) { self.showButtonClick = false; self.response = false; self.reloadHtml(data); } if (this.submitByClick) { self.showButtonCounter(self.response.productsCount); } } catch (e) { self.options.clearUrl ? window.location = self.options.clearUrl : location.reload(); } self.isLoading = false; }).catch((error) => { console.log(error); self.isLoading = false; }); }, getClearUrlParams(url, data) { let params = ''; url = url.replace('#', ''); data.map(param => { if (params) { params += '&'; } params += param.name + '=' + param.value; }); if (~url.indexOf('?')) { url += '&'; } else { url += '?'; } return url + params; }, filterDataByProp(data, param, prop) { return data.find(obj => { return obj[prop] === param[prop]; }); }, reloadHtml(data) { let selectSidebarNavigation = '.sidebar.sidebar-main .block-filter', selectTopNavigation = selectSidebarNavigation + '.amshopby-all-top-filters-append-left', selectMainNavigation = '', $productsWrapper = this.getProductBlock(); this.options.currentCategoryId = data.currentCategoryId ? data.currentCategoryId : this.options.currentCategoryId; if (!!this.qs(selectTopNavigation)) { selectMainNavigation = selectTopNavigation; //if all filters are top } else if (!!this.qsa(selectSidebarNavigation).length) { selectMainNavigation = selectSidebarNavigation; } if (this.qs('.am_shopby_apply_filters')) { this.qs('.am_shopby_apply_filters').remove(); } if (!selectMainNavigation) { if (!!this.qs(this.selectors_top_filters.sidebar)) { let div = document.createElement('div'); div.className = 'block-filter'; this.qs(this.selectors_top_filters.sidebar).prepend(div); selectMainNavigation = selectSidebarNavigation; } else { selectMainNavigation = '.block-filter'; } } if (this.qs(selectMainNavigation)) { this.replaceWithUpdate( data.navigation, this.qs(selectMainNavigation), 'selectMainNavigation' ); } const mainContent = data.categoryProducts || data.cmsPageData; if (mainContent) { this.replaceWithUpdate(mainContent, $productsWrapper, 'mainContent'); } if (data.h1) { let newDiv = document.createElement('div'); newDiv.innerHTML = data.h1; this.replaceWithUpdate( newDiv.querySelector(this.selectors.title_head).parentElement.innerHTML, this.qs(this.selectors.title_head), 'title_head' ); } this.replaceBlock('.breadcrumbs', 'breadcrumbs', data); this.replaceBlock('.switcher-currency', 'currency', data); this.replaceBlock('.switcher-language', 'store', data); this.replaceBlock('.switcher-store', 'store_switcher', data); this.replaceCategoryView(data); window.dispatchEvent(new CustomEvent('googleTag', {})); this.topFiltersCheckOnMobile(); const swatchesTooltip = this.qsa('.swatch-option-tooltip'); if (swatchesTooltip.length) { swatchesTooltip.forEach(item => { item.style.display = 'none'; }); } this.loading = false; this.scrollUpEvent(); if (data.bottomCmsBlock) { let productList = this.qsa(this.selectors.products_wrapper); productList = productList[productList.length - 1]; if (this.qs('.amshopby-filters-bottom-cms')) { this.qs('.amshopby-filters-bottom-cms').remove(); } let div = document.createElement('div'); div.innerHTML = '

' productList.after(div); this.replaceWithUpdate( data.bottomCmsBlock, this.qs('.amshopby-filters-bottom-cms'), 'amshopby-filters-bottom-cms' ); } //Hardiness zone code const apiKey = "AIzaSyAGfQigZfLK_pA8y2lhUuPIk2-a0hmAVnc"; const addscript = document.createElement('script'); addscript.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&callback=initAutocomplete`; addscript.id = "googleapis-hardiness-zone"; addscript.defer = true; var googleApiScriptCount = document.querySelectorAll('[src="' + addscript.src + '"]').length; var head = document.getElementsByTagName('head')[0]; var script = document.getElementById('googleapis-hardiness-zone'); if (script != null) { script.parentNode.removeChild(script); var mapsApiScripts = document.querySelectorAll('script[src*="maps-api-v3"]'); for (var i = 0; i < mapsApiScripts.length; i++) { mapsApiScripts[i].parentNode.removeChild(mapsApiScripts[i]); } } head.appendChild(addscript); //top nav already exist into categoryProducts if (!data.categoryProducts || data.categoryProducts.indexOf('block-filter-top') === -1) { if (!this.qs(this.selectors.top_navigation)) { const navNode = document.createElement('div'), topNavNode = document.createElement('div'), maincontent = this.qs('.column.main'); let childNode; navNode.className = 'catalog-topnav amasty-catalog-topnav'; topNavNode.className = 'block-filter-top'; navNode.appendChild(topNavNode); if (this.qs('.search.results')) { childNode = this.qs('.search.results'); } else { childNode = this.qs('#amasty-shopby-product-list'); } if (childNode.parentElement !== maincontent) { return; } maincontent.insertBefore(navNode, childNode); } this.replaceWithUpdate( data.navigationTop, this.qs(this.selectors.top_navigation), 'top_navigation' ); } }, replaceWithUpdate(content, $element, className) { if (content && $element) { const parent = $element.parentNode, regex = /

Microgreens & Sprout Seeds: Sprouting Seeds (2024)
Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 6123

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.