https://www.qispackaging.com.au/cdn/shop/t/14/assets/quantity-tabl…?v=180389084454199736981788919418
1(function(){"use strict";let observer=null,isInitialized=!1;function initQuantityTableObserver(){observer&&observer.disconnect(),observer=new MutationObserver(mutations=>{if(window.facetUpdateInProgress){console.log("\u23F8\uFE0F Skipping quantity table update - facet update in progress");return}mutations.forEach(mutation=>{mutation.addedNodes.length&&processExistingTables()})});const targetNode=document.querySelector("body"),config={childList:!0,subtree:!0};observer.observe(targetNode,config),console.log("\u2705 Quantity table script initialized"),setTimeout(function(){processExistingTables()},5e3),setTimeout(function(){processExistingTables()},6500),setTimeout(function(){processExistingTables()},8e3),setTimeout(function(){processExistingTables()},1e4)}function processExistingTables(){console.log("processExistingTables");const tableWrapper=document.querySelector(".bss-b2b-qty-table-wrapper:not([data-processed])");tableWrapper&&isTableFullyLoaded(tableWrapper)&&(rebuildQuantityTable(tableWrapper,"product-page"),tableWrapper.dataset.processed="true"),document.querySelectorAll(".bss-b2b-qb-table:not([data-processed])").forEach((cardTable,index)=>{if(cardTable.children.length>0){const loadStatus=isTableFullyLoaded(cardTable);if(loadStatus==="ready")rebuildQuantityTable(cardTable,"product-card"),cardTable.dataset.processed="true";else if(loadStatus==="injecting"){const injectingCount=parseInt(cardTable.dataset.injectingCount||"0")+1;cardTable.dataset.injectingCount=injectingCount,injectingCount>=10&&(console.warn("\u26A0\uFE0F Table stuck injecting - processing with base price only"),rebuildQuantityTable(cardTable,"product-card"),cardTable.dataset.processed="true")}else if(loadStatus==="no-rows"){const attemptCount=parseInt(cardTable.dataset.attemptCount||"0")+1;cardTable.dataset.attemptCount=attemptCount,attemptCount>=5&&(console.warn("\u26A0\uFE0F No BSS rows found - processing with base price only"),rebuildQuantityTable(cardTable,"product-card"),cardTable.dataset.processed="true")}}})}function isTableFullyLoaded(container){if(container.classList.contains("bss-b2b-qb-table")){const hasWrapper=container.querySelector(".bss-b2b-qty-table-wrapper"),bssRows=container.querySelectorAll(".bss-b2b-qty-table-row[data-min]");if(hasWrapper&&bssRows.length===0)return"injecting";if(!hasWrapper&&bssRows.length===0)return"no-rows";let hasValidPrices=!0;return bssRows.forEach((row,idx)=>{const priceCell=row.querySelector("td:nth-child(2)");(!priceCell||!priceCell.textContent.includes("$"))&&(hasValidPrices=!1)}),hasValidPrices?"ready":"waiting-prices"}return container.classList.contains("bss-b2b-qty-table-wrapper")?container.querySelectorAll(".bss-b2b-qty-table-row[data-min]").length>0?"ready":"no-rows":"unknown"}function rebuildQuantityTable(container,context){try{let variantPrice=0,originalRows=[];if(context==="product-page"){const firstRow=container.querySelector(".bss-b2b-qty-table-row");if(firstRow){const priceCell=firstRow.querySelector("td:nth-child(2)");priceCell&&(variantPrice=parseFloat(priceCell.textContent.replace(/[^0-9.]/g,"")))}if(!variantPrice||variantPrice===0){console.warn("\u26A0\uFE0F Could not find variant price for product page");return}originalRows=container.querySelectorAll(".bss-b2b-qty-table-row[data-min]")}else if(context==="product-card"){if(variantPrice=parseFloat(container.dataset.variantPrice)/100,!variantPrice){const card=container.closest("product-card"),priceElement=card?card.querySelector(".price .money"):null;priceElement&&(variantPrice=parseFloat(priceElement.textContent.replace(/[^0-9.]/g,"")))}if(!variantPrice){console.warn("\u26A0\uFE0F Could not find variant price for product card");return}originalRows=container.querySelectorAll(".bss-b2b-qty-table-row[data-min]")}const quantities=["1+"],minimumQuantity=parseInt(container.getAttribute("data-minimum-quantity")),enquiryOnly=container.getAttribute("data-enquiry-only"),loggedIn=document.querySelector("body").classList.contains("logged-in");minimumQuantity>0&&(quantities[0]=minimumQuantity+"+");const prices=[variantPrice],memberPrices=[variantPrice*.95];originalRows.forEach(row=>{const minQty=row.getAttribute("data-min");if(minQty){const quantity=minQty+"+",priceCell=row.querySelector("td:nth-child(2)");if(priceCell){const price=parseFloat(priceCell.textContent.replace(/[^0-9.]/g,""));price>0&&(quantities.push(quantity),prices.push(price),memberPrices.push(price*.95))}}});const tableHTML=` 2 <style> 3 .quantity-discounts { font-size: 13px !important; line-height: 1.4 !important; } 4 .quantity-discounts th, .quantity-discounts td { padding: 8px !important; font-size: 13px !important; } 5 .quantity-discounts .price { font-weight: 600 !important; font-size: 13px !important; } 6 .quantity-discounts .gst { font-size: 11px !important; color: #666 !important; display: block !important; } 7 .quantity-discounts .modal-trigger svg { width: 14px !important; height: 14px !important; vertical-align: middle !important; margin-left: 4px !important; } 8 </style> 9 <table class="table table-bordered table-condensed quantity-discounts"> 10 <thead> 11 <tr> 12 <th class="header">Quantity discounts:</th> 13 ${quantities.map(qty=>`<th class="units">${qty}</th>`).join("")} 14 </tr> 15 </thead> 16 <tbody> 17 <tr> 18 <th scope="row"> 19 ${enquiryOnly?"<b>Price</b> (Per Bag)":"<b>Non-Member</b>"} 20 </th> 21 ${prices.map((price,index)=>` 22 <td>
23 <span class="price" data-member="${enquiryOnly&&index>0?+(Math.ceil(price/.95+"e2")+"e-2"):price.toFixed(2)}">$${price.toFixed(2)}</span> 24 <span class="gst">(inc. GST)</span> 25 </td> 26 `).join("")} 27 </tr> 28 <tr ${enquiryOnly?'class="d-none"':""}> 29 <th scope="row"> 30 <a href="#" data-toggle="modal" data-target="#member-benefit"> 31 <b>Member</b><span class="modal-trigger"><svg height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><g id="Layer_2" data-name="Layer 2"><circle cx="12" cy="12" fill="#2196f3" r="10"/><g fill="#fff"><circle cx="12" cy="7.38" r="1.25"/><path d="m12 17.88a1 1 0 0 1 -1-1v-5a1 1 0 0 1 0-2h1a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1z"/><path d="m13 17.88h-2a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2z"/></g></g></svg></span> 32 </a> 33 </th> 34 ${memberPrices.map((price,index)=>` 35 <td> 36 <span class="price">$${price.toFixed(2)}</span> 37 <span class="gst">(inc. GST)</span> 38 </td> 39 `).join("")} 40 </tr> 41 </tbody> 42 </table> 43 `,tableHTMLLoggedIn=` 44 <style> 45 .quantity-discounts { font-size: 13px !important; line-height: 1.4 !important; } 46 .quantity-discounts th, .quantity-discounts td { padding: 8px !important; font-size: 13px !important; } 47 .quantity-discounts .price { font-weight: 600 !important; font-size: 13px !important; } 48 .quantity-discounts .gst { font-size: 11px !important; color: #666 !important; display: block !important; } 49 .quantity-discounts .modal-trigger svg { width: 14px !important; height: 14px !important; vertical-align: middle !important; margin-left: 4px !important; } 50 </style> 51 <table class="table table-bordered table-condensed quantity-discounts table-loggedin"> 52 <thead> 53 <tr> 54 <th class="header">Quantity discounts:</th> 55 ${quantities.map(qty=>`<th class="units">${qty}</th>`).join("")} 56 </tr> 57 </thead> 58 <tbody> 59 <tr ${enquiryOnly?'class="d-none3"':""}> 60 <th scope="row"> 61 <a href="#" data-toggle="modal" data-target="#member-benefit"> 62 <b>Member</b><span class="modal-trigger"><svg height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><g id="Layer_2" data-name="Layer 2"><circle cx="12" cy="12" fill="#2196f3" r="10"/><g fill="#fff"><circle cx="12" cy="7.38" r="1.25"/><path d="m12 17.88a1 1 0 0 1 -1-1v-5a1 1 0 0 1 0-2h1a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1z"/><path d="m13 17.88h-2a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2z"/></g></g></svg></span> 63 </a> 64 </th> 65 ${prices.map((price,index)=>` 66 <td> 67 <span class="price">$${index==0?memberPrices[0].toFixed(2):price.toFixed(2)}</span> 68 <span class="gst">(inc. GST)</span> 69 </td> 70 `).join("")} 71 </tr> 72 </tbody> 73 </table> 74 `;var oldTable=container.querySelector(".bss-b2b-cart-item-qty-table");oldTable&&(oldTable.style.display="none");var thumbSelected=container.closest(".js-pagination-result"),parentResult=thumbSelected.parentNode;loggedIn&&!enquiryOnly?thumbSelected==parentResult.firstElementChild?container.insertAdjacentHTML("beforeend",tableHTMLLoggedIn):container.innerHTML=tableHTMLLoggedIn:thumbSelected==parentResult.firstElementChild?container.insertAdjacentHTML("beforeend",tableHTML):container.innerHTML=tableHTML,container.style.display="block"}catch(error){console.error("\u274C Error rebuilding quantity table:",error)}}function initModalHandlers(){document.addEventListener("click",function(e){e.target.closest('[data-target="#member-benefit"]')&&(e.preventDefault(),openModal())});function openModal(){const modal=document.getElementById("member-benefit"),overlay=document.querySelector(".modal-overlay");modal&&overlay&&(modal.style.display="block",overlay.style.display="block",document.body.style.overflow="hidden")}function closeModal(){const modal=document.getElementById("member-benefit"),overlay=document.querySelector(".modal-overlay");modal&&overlay&&(modal.style.display="none",overlay.style.display="none",document.body.style.overflow="")}document.addEventListener("click",function(e){e.target.matches(".modal
74-overlay, .close, .btn-secondary")&&closeModal()}),document.addEventListener("keydown",function(e){e.key==="Escape"&&closeModal()})}function reinitializeAfterFacetUpdate(){setTimeout(()=>{console.log("\u{1F504} Reinitializing quantity tables after facet update"),document.querySelectorAll("[data-processed]").forEach(el=>{el.removeAttribute("data-processed")}),initQuantityTableObserver()},200)}function initialize(){isInitialized||(initQuantityTableObserver(),initModalHandlers(),document.addEventListener("on:facet-filters:updated",reinitializeAfterFacetUpdate),isInitialized=!0)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initialize):initialize(),window.reinitializeQuantityTables=reinitializeAfterFacetUpdate})(); 75//# sourceMappingURL=/cdn/shop/t/14/assets/quantity-table-universal.js.map?v=180389084454199736981788919418
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.