1function zakekeProductPage() { 2 function handlePreviews() { 3 function createPreviewWindowEl() { 4 const container = document.createElement('DIV'); 5 container.classList.add('zakeke-cart-preview-window'); 6 container.style.display = 'none'; 7 8 container.appendChild(document.createElement('IMG')); 9 10 const labelContainer = document.createElement('DIV'); 11 labelContainer.classList.add('zakeke-cart-preview-window-label'); 12 labelContainer.appendChild(document.createElement('H3')); 13 14 container.appendChild(labelContainer); 15 16 container.addEventListener('click', e => { 17 container.style.display = 'none'; 18 e.stopPropagation(); 19 }); 20 21 document.body.appendChild(container); 22 23 return container; 24 } 25 26 function getOrCreatePreviewWindowEl() { 27 return document.querySelector('.zakeke-cart-preview-window') 28 || createPreviewWindowEl(); 29 } 30 31 function handlePreview(previewEl) { 32 previewEl.addEventListener('click', () => { 33 const previewWindowEl = getOrCreatePreviewWindowEl(); 34 previewWindowEl.querySelector('img').src = previewEl.dataset.url; 35 previewWindowEl.querySelector('h3').textContent = previewEl.dataset.label; 36 previewWindowEl.style.display = 'flex'; 37 }); 38 } 39 40 function handleSliding(previewsEl) { 41 new Glide(previewsEl, { 42 perView: 2 43 }).mount(); 44 45 if (previewsEl.querySelectorAll('li').length <= 2) { 46 previewsEl.querySelector('div[data-glide-el="controls"]').style.display = 'none'; 47 } 48 49 previewsEl.querySelectorAll('.zakeke-cart-preview').forEach(handlePreview); 50 } 51 52 if (!window.Glide) { 53 return; 54 } 55 56 document.querySelectorAll('.zakeke-cart-previews').forEach(handleSliding); 57 setInterval(() => { 58 Array.from(document.querySelectorAll('.zakeke-cart-previews')).filter(el => !el.classList.contains('glide--slider')).forEach(handleSliding); 59 }, 500); 60 } 61 62 function handleAjaxAddToCart() { 63 document.querySelectorAll('.ajax_add_to_cart.product-type-zakeke').forEach(element => { 64 element.addEventListener('click', e => e.stopPropagation()); 65 }); 66 } 67 68 function handleProductQuicklook() { 69 if (document.querySelector('.single-product')) { 70 return; 71 } 72 73 let handledFormList = []; 74 75 setInterval(() => { 76 const forms = Array.from(document.querySelectorAll('form.cart')); 77 78 forms 79 .filter(form => !handledFormList.includes(form)) 80 .filter(form => { 81 const zakekeInput = form.querySelector('input[name=zdesign]'); 82 return zakekeInput && zakekeInput.value === 'new'; 83 }) 84 .forEach(form => { 85 handledFormList.push(form); 86 87 form.addEventListener('submit', (e) => { 88 e.stopPropagation(); 89 }); 90 }); 91 }, 500); 92 } 93 94 handlePreviews(); 95 handleAjaxAddToCart(); 96 handleProductQuicklook(); 97} 98 99if (document.readyState === 'complete' 100 || document.readyState === 'loaded' 101 || document.readyState === 'interactive') { 102 zakekeProductPage(); 103} else { 104 document.addEventListener('DOMContentLoaded', zakekeProductPage); 105}
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.