{ let scriptID = 'js-homepage-new-arrivals-slider'; let options = { template: 'product-slider-homepage', config: { category: { products: { limit: 100 } }, nolazy: true, }, }; let newArrivalsUrl = window[''].explore.items['category-explore-new-arrivals'].categoryUrl; let generateProducts = _.template(`
Shop

<%= products %>
`); stencilUtils.api.getPage(newArrivalsUrl, options, (err, response) => { if (err) { return; } let productGrid = new DOMParser().parseFromString(response, 'text/html').querySelector('.product-slider-js'); productGrid.querySelectorAll('.js-product-item ').forEach(lazyImg => { lazyImg.removeAttribute('loading'); lazyImg.src = lazyImg.dataset.src; lazyImg.srcset = lazyImg.dataset.srcset; setTimeout(() => { lazyImg.dataset.src && lazyImg.removeAttribute('data-src'); lazyImg.dataset.srcset && lazyImg.removeAttribute('data-srcset'); }); }); let products = productGrid.innerHTML; document.querySelector('#' + scriptID).outerHTML = generateProducts({ products }); setTimeout(() => { document.querySelector('.js-new-arrivals-slider .js-product-slider-title').textContent = 'New Arrivals'; window.initSliders(".js-new-arrivals-slider .product-slider-js:not(.slick-initialized)"); window.observeLazyImages(); }, 100); }); } //