फिटेन मेटाक्स टेप 50 मार्क [टेपिंग सप्लाई]
0) { const variantJsonScript = document.querySelector('variant-radios script'); if (variantJsonScript && variantJsonScript.textContent.trim() !== '') { try { const variantJson = JSON.parse(variantJsonScript.textContent.trim()); // 1) Add thumbnail images to variant buttons (with spacer for alignment) var hasAnyThumb = variantJson.some(v => v.featured_image); variantRadios.forEach(radio => { const vid = radio.getAttribute('data-variant-id'); const variant = variantJson.find(v => v.id === parseInt(vid)); const label = radio.nextElementSibling; if (!label || label.querySelector('.variant-thumb') || label.querySelector('.variant-thumb-spacer')) return; if (variant && variant.featured_image) { const thumb = document.createElement('img'); thumb.src = variant.featured_image.src.split('?')[0] + '?width=64&height=64&crop=center'; thumb.alt = ''; thumb.className = 'variant-thumb'; thumb.width = 32; thumb.height = 32; thumb.loading = 'lazy'; label.insertBefore(thumb, label.firstChild); } else if (hasAnyThumb) { const spacer = document.createElement('span'); spacer.className = 'variant-thumb-spacer'; spacer.style.cssText = 'display:inline-block;width:32px;height:32px;flex-shrink:0;margin-right:6px;'; label.insertBefore(spacer, label.firstChild); } }); } catch (e) { console.error("Error parsing variant JSON:", e); } } } // --- Slide switching function (always available, independent of variants) --- window._showSlide = function(idx, skipScroll) { var mainSlider = document.getElementById('my-keen-slider'); var thumbSlider = document.getElementById('thumbnails'); if (!mainSlider) return; var slides = mainSlider.querySelectorAll('.keen-slider__slide'); slides.forEach(function(s, si) { if (si === idx) { s.style.display = ''; s.style.minWidth = '100%'; s.style.maxWidth = '100%'; } else { s.style.display = 'none'; var _v = s.querySelector('video'); if (_v) { try { _v.pause(); } catch (e) {} } } }); if (thumbSlider) { thumbSlider.querySelectorAll('.keen-slider__slide').forEach(function(t, ti) { t.classList.toggle('active', ti === idx); }); } if (!skipScroll && window.innerWidth <= 767) { var y = mainSlider.getBoundingClientRect().top + window.scrollY - 80; window.scrollTo({ top: y, behavior: 'smooth' }); } }; // Initial slide: use URL variant or default to 0 (function() { var urlVariant = new URLSearchParams(location.search).get('variant'); var vjs = document.querySelector('variant-radios script'); if (urlVariant && vjs) { try { var vj = JSON.parse(vjs.textContent.trim()); var v = vj.find(function(v) { return v.id === parseInt(urlVariant); }); if (v && v.featured_media) { var el = document.querySelector('[data-media-id$="-' + v.featured_media.id + '"]'); if (el && el.parentElement.id === 'my-keen-slider') { window._showSlide(Array.from(el.parentElement.children).indexOf(el), true); return; } } } catch(e) {} } window._showSlide(0, true); })(); // --- Keen Slider Initialization --- if (typeof KeenSlider !== 'undefined') { function ThumbnailPlugin(main) { return (slider) => { function removeActive() { slider.slides.forEach((s) => s.classList.remove("active")) } function addActive(idx) { slider.slides[idx].classList.add("active") } function addClickEvents() { slider.slides.forEach((slide, idx) => { slide.addEventListener("click", () => { main.moveToIdx(idx) }) }) } slider.on("created", () => { addActive(slider.track.details.rel); addClickEvents(); main.on("animationStarted", (main) => { removeActive(); const next = main.animator.targetIdx || 0; addActive(main.track.absToRel(next)); slider.moveToIdx(Math.min(slider.track.details.maxIdx, next)); }); }); } } const mainSliderEl = document.getElementById('my-keen-slider'); const thumbSliderEl = document.getElementById('thumbnails'); if (mainSliderEl) { // Main slider: managed by _showSlide (no KeenSlider, already initialized above) if (thumbSliderEl) { var thumbCount = thumbSliderEl.querySelectorAll('.keen-slider__slide').length; new KeenSlider(thumbSliderEl, { initial: 0, slides: { perView: Math.min(thumbCount, 6.5), spacing: 4 }, breakpoints: { '(max-width: 767px)': { slides: { perView: Math.min(thumbCount, 4.5), spacing: 4 } }, '(max-width: 400px)': { slides: { perView: Math.min(thumbCount, 3.5), spacing: 4 } }, }, }); // Thumbnail click → switch main slide thumbSliderEl.addEventListener('click', function(event) { var thumbItem = event.target.closest('.keen-slider__slide'); if (!thumbItem) return; var pos = parseInt(thumbItem.getAttribute('data-position')); if (!isNaN(pos)) { window._showSlide(pos); // 動画サムネをクリックしたら自動再生(ユーザー操作由来なので許可される) var _main = document.getElementById('my-keen-slider'); var _t = _main && _main.querySelectorAll('.keen-slider__slide')[pos]; var _vid = _t && _t.querySelector('video'); if (_vid) { _vid.play().catch(function(){}); } } }); } } } else { console.log("KeenSlider library not found. Sliders will not be initialized."); } // --- Lightbox: click/tap main image to open fullscreen gallery --- (function() { var slider = document.getElementById('my-keen-slider'); if (!slider || typeof jQuery === 'undefined' || !jQuery.fn.magnificPopup) return; function getCurrentIdx() { var slides = slider.querySelectorAll('.keen-slider__slide'); for (var i = 0; i < slides.length; i++) { if (slides[i].style.display !== 'none') return i; } return 0; } slider.addEventListener('click', function(e) { var link = e.target.closest('.product-lightbox'); if (!link) return; e.preventDefault(); var items = []; slider.querySelectorAll('.product-lightbox').forEach(function(a) { items.push({ src: a.getAttribute('href'), type: 'image' }); }); jQuery.magnificPopup.open({ items: items, type: 'image', gallery: { enabled: true, navigateByImgClick: true, preload: [1, 1], tCounter: '%curr% / %total%' }, closeBtnInside: false, image: { verticalFit: true }, callbacks: { change: function() { window._showSlide(this.currItem.index, true); } } }, getCurrentIdx()); }); // --- Swipe: touch events for prev/next slide --- var touchStartX = 0, touchStartY = 0; slider.addEventListener('touchstart', function(e) { touchStartX = e.touches[0].clientX; touchStartY = e.touches[0].clientY; }, { passive: true }); slider.addEventListener('touchend', function(e) { var dx = touchStartX - e.changedTouches[0].clientX; var dy = touchStartY - e.changedTouches[0].clientY; if (Math.abs(dx) < 40 || Math.abs(dy) > Math.abs(dx)) return; // too short or vertical scroll var slides = slider.querySelectorAll('.keen-slider__slide'); var total = slides.length; var cur = getCurrentIdx(); if (dx > 0) window._showSlide((cur + 1) % total); else window._showSlide((cur - 1 + total) % total); }, { passive: true }); })(); // --- Short Description "Read More" → Product Description タブへスクロール --- const toggleBtn = document.getElementById('shortdes-toggle'); const descTabs = document.querySelector('.product-single__tabs'); if (toggleBtn && descTabs) { toggleBtn.addEventListener('click', function() { const y = descTabs.getBoundingClientRect().top + window.scrollY - 80; window.scrollTo({ top: y, behavior: 'smooth' }); descTabs.classList.add('highlight'); setTimeout(() => { descTabs.classList.remove('highlight'); }, 1500); }); } // --- Quantity Selector Logic --- const mainQtyInput = document.getElementById('Quantity'); const stickyQtyInput = document.getElementById('StickyQuantity'); function handleQty(btn, delta) { const box = btn.closest('.quantity-selector-box'); const input = box.querySelector('.quantity-input'); if (!input) return; let val = parseInt(input.value) || 1; val = Math.max(1, val + delta); input.value = val; // sync if (mainQtyInput && stickyQtyInput) { if (input.id === 'Quantity') stickyQtyInput.value = val; else if (input.id === 'StickyQuantity') mainQtyInput.value = val; } } document.addEventListener('click', function(e) { var btn = e.target.closest('.quantity-button'); if (!btn) return; e.stopImmediatePropagation(); handleQty(btn, btn.classList.contains('plus') ? 1 : -1); }, true); // --- Sticky Bar Logic --- const stickyBar = document.getElementById('sticky-add-to-cart-bar'); const originalAddToCartWrapper = document.querySelector('.action-wrapper'); const mobileNav = document.getElementById('stickymenu_bottom_mobile'); const stickyAddToCartButton = document.getElementById('StickyAddToCart'); const mainAddToCartButton = document.getElementById('AddToCart'); if (stickyAddToCartButton && mainAddToCartButton) { stickyAddToCartButton.addEventListener('click', function() { mainAddToCartButton.click(); }); } function adjustStickyBarPosition() { if (window.innerWidth <= 767 && mobileNav && stickyBar) { const mobileNavHeight = mobileNav.offsetHeight; stickyBar.style.bottom = `${mobileNavHeight}px`; } else if (stickyBar) { stickyBar.style.bottom = '0px'; } } if (stickyBar && originalAddToCartWrapper) { const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { stickyBar.classList.remove('visible'); } else { stickyBar.classList.add('visible'); } }, { rootMargin: "0px 0px 0px 0px", threshold: 0 } ); observer.observe(originalAddToCartWrapper); } // Initial adjustment on load adjustStickyBarPosition(); window.addEventListener('resize', adjustStickyBarPosition); window.addEventListener('resize', adjustStickyBarPosition); const stickyButton = document.getElementById('StickyAddToCart'); const stickyButtonSpan = document.getElementById('StickyAddToCartText'); if (stickyButton && stickyButtonSpan) { const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.attributeName === 'disabled' && stickyButton.hasAttribute('disabled')) { setTimeout(function() { if (stickyButton.hasAttribute('disabled')) { stickyButton.removeAttribute('disabled'); stickyButton.style.pointerEvents = 'auto'; stickyButton.classList.remove('btn--loader-active'); const addToCartText = "कार्ट में जोड़ें"; stickyButtonSpan.textContent = addToCartText || 'Add to cart'; } }, 1500); // 1.5秒 } }); }); observer.observe(stickyButton, { attributes: true }); } } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', _initProductPage); } else { _initProductPage(); } })(); function openPaymentsPopup() { const modal = document.getElementById('payments-modal'); modal.style.display = 'flex'; setTimeout(() => { // Allow display change to register before adding class modal.classList.add('visible'); }, 10); } function closePaymentsPopup() { const modal = document.getElementById('payments-modal'); modal.classList.remove('visible'); modal.addEventListener('transitionend', function(e) { if (e.propertyName === 'opacity' && !modal.classList.contains('visible')) { modal.style.display = 'none'; } }, { once: true }); } document.addEventListener('click', function(e) { if (e.target.id === 'payments-modal') { closePaymentsPopup(); } });
- AED د.إ
- ARS $
- AUD $
- BAM КМ
- BBD $
- BDT ৳
- BND $
- BRL R$
- BWP P
- CAD $
- CHF CHF
- CLP $
- CNY ¥
- CRC ₡
- CZK Kč
- DJF Fdj
- DKK kr.
- DZD د.ج
- EGP ج.م
- ETB Br
- EUR €
- GBP £
- GNF Fr
- HKD $
- HNL L
- HUF Ft
- IDR Rp
- ILS ₪
- INR ₹
- ISK kr
- JMD $
- JPY ¥
- KES KSh
- KHR ៛
- KRW ₩
- KZT ₸
- LAK ₭
- LBP ل.ل
- LKR ₨
- MAD د.م.
- MKD ден
- MMK K
- MNT ₮
- MOP P
- MUR ₨
- MXN $
- MYR RM
- NGN ₦
- NOK kr
- NPR Rs.
- NZD $
- PEN S/
- PHP ₱
- PKR ₨
- PLN zł
- PYG ₲
- QAR ر.ق
- RON Lei
- RSD РСД
- RWF FRw
- SAR ر.س
- SEK kr
- SGD $
- THB ฿
- TRY ₺
- TTD $
- TWD $
- TZS Sh
- UAH ₴
- UGX USh
- USD $
- UYU $U
- UZS so'm
- VND ₫
- WST T
- XOF Fr
- ZAR R
- AED د.إ
- ARS $
- AUD $
- BAM КМ
- BBD $
- BDT ৳
- BND $
- BRL R$
- BWP P
- CAD $
- CHF CHF
- CLP $
- CNY ¥
- CRC ₡
- CZK Kč
- DJF Fdj
- DKK kr.
- DZD د.ج
- EGP ج.م
- ETB Br
- EUR €
- GBP £
- GNF Fr
- HKD $
- HNL L
- HUF Ft
- IDR Rp
- ILS ₪
- INR ₹
- ISK kr
- JMD $
- JPY ¥
- KES KSh
- KHR ៛
- KRW ₩
- KZT ₸
- LAK ₭
- LBP ل.ل
- LKR ₨
- MAD د.م.
- MKD ден
- MMK K
- MNT ₮
- MOP P
- MUR ₨
- MXN $
- MYR RM
- NGN ₦
- NOK kr
- NPR Rs.
- NZD $
- PEN S/
- PHP ₱
- PKR ₨
- PLN zł
- PYG ₲
- QAR ر.ق
- RON Lei
- RSD РСД
- RWF FRw
- SAR ر.س
- SEK kr
- SGD $
- THB ฿
- TRY ₺
- TTD $
- TWD $
- TZS Sh
- UAH ₴
- UGX USh
- USD $
- UYU $U
- UZS so'm
- VND ₫
- WST T
- XOF Fr
- ZAR R