document.addEventListener("DOMContentLoaded",() => {const root = document.querySelector(".ronin-product"); if (!root) return; // ===== Thumbnail click \2192  swap main image ===== const mainImg = root.querySelector("#RoninMainImage"); root.querySelectorAll(".ronin-thumb").forEach(thumb => {thumb.addEventListener("click",() => {if (mainImg) mainImg.src = thumb.dataset.full; root.querySelectorAll(".ronin-thumb").forEach(t => t.classList.remove("active")); thumb.classList.add("active");});}); // ===== Variant swatch \2192  update hidden select + label ===== const select = root.querySelector("#RoninVariantSelect"); function syncVariant() {const chosen = [...root.querySelectorAll(".ronin-swatches input:checked")].map(i => i.value); root.querySelectorAll(".ronin-swatch").forEach(l => {l.classList.toggle("active",l.querySelector("input").checked);}); root.querySelectorAll(".ronin-option").forEach(optBox => {const checked = optBox.querySelector("input:checked"); const lbl = optBox.querySelector(".ronin-option__selected"); if (checked && lbl) lbl.textContent = checked.value;}); if (!select) return; [...select.options].forEach(opt => {if (chosen.length && chosen.every(v => opt.text.includes(v))) {select.value = opt.value;}});} root.querySelectorAll(".ronin-swatches input").forEach(i => i.addEventListener("change",syncVariant)); // ===== Real toggle tabs ===== const tabs = root.querySelectorAll(".ronin-tab"); const panels = root.querySelectorAll(".ronin-tab-content"); tabs.forEach(tab => {tab.addEventListener("click",e => {e.preventDefault(); tabs.forEach(t => t.classList.remove("active")); panels.forEach(p => p.classList.remove("active")); tab.classList.add("active"); const target = root.querySelector("#" + tab.dataset.target); if (target) target.classList.add("active");});});});{}
/*# sourceMappingURL=/cdn/shop/t/13/assets/ronin-product.css.map */
