Γ
Page Deck Use this one – Creatine Gummies
Skip to content
var BB_DISCOUNT = {1: 30, 2: 35, 3: 40, 4: 45};
function bbSyncPrice() {
var box = document.getElementById('bundle-builder');
if (!box) return;
var row = box.querySelector('.bb-tier-row.bb-selected');
if (!row) return;
var sub = box.querySelector('.bb-sub-toggle');
var isSub = sub ? sub.checked : false;
var cents = parseInt(row.getAttribute(isSub ? 'data-sub-price' : 'data-onetime-price'), 10);
var price = '$' + (cents / 100).toFixed(2);
var el = document.querySelector('.product-price-container .price ins .amount .money')
|| document.querySelector('.product-price-container .price ins .amount');
if (el) el.textContent = price;
var pill = document.querySelector('.product-price-container .badge.onsale');
if (pill) {
if (isSub) {
var n = parseInt(row.getAttribute('data-serving-count'), 10);
var pct = BB_DISCOUNT[n] || 0;
pill.textContent = pct ? 'Save ' + pct + '%' : 'Save';
pill.style.display = pct ? '' : 'none';
} else {
pill.style.display = 'none';
}
}
var del = document.querySelector('.product-price-container .price del');
if (del) del.style.display = 'none';
}
function bbBindEvents() {
var box = document.getElementById('bundle-builder');
if (!box || box.dataset.bbBound) return false;
if (!box.querySelector('.bb-tier-row.bb-selected')) return false;
box.querySelectorAll('.bb-tier-row').forEach(function(r) {
r.addEventListener('click', function() { setTimeout(bbSyncPrice, 50); });
});
var sub = box.querySelector('.bb-sub-toggle');
if (sub) sub.addEventListener('change', function() { setTimeout(bbSyncPrice, 50); });
box.dataset.bbBound = 'true';
bbSyncPrice();
return true;
}
var bbTries = 0;
var bbPoll = setInterval(function() {
bbTries++;
if (bbBindEvents() || bbTries >= 40) clearInterval(bbPoll);
}, 250);
/* ── ATC Spinner Override ──
Replace "Adding..." / "Added!" text with the built-in CSS spinner.
Watches the button text span for mutations and toggles .loading class instead.
*/
(function() {
var atcBtn = document.getElementById('BundleAddToCart');
if (!atcBtn) return;
var textSpan = atcBtn.querySelector('.single-add-to-cart-button--text');
if (!textSpan) return;
var mo = new MutationObserver(function() {
var newText = textSpan.textContent.trim();
if (newText === 'Adding...' || newText === 'Loading...') {
mo.disconnect();
textSpan.textContent = 'Add to Cart';
atcBtn.classList.add('loading');
mo.observe(textSpan, { childList: true, characterData: true, subtree: true });
} else if (newText === 'Added!') {
mo.disconnect();
textSpan.textContent = 'Add to Cart';
atcBtn.classList.remove('loading');
mo.observe(textSpan, { childList: true, characterData: true, subtree: true });
} else if (newText === 'Add to Cart') {
atcBtn.classList.remove('loading');
}
});
var spinnerTries = 0;
var spinnerPoll = setInterval(function() {
spinnerTries++;
if (atcBtn.classList.contains('bb-btn-active') || spinnerTries >= 40) {
mo.observe(textSpan, { childList: true, characterData: true, subtree: true });
clearInterval(spinnerPoll);
}
}, 250);
})();