Untitled
unknown
plain_text
a month ago
12 kB
4
Indexable
Never
(function () { try { /* main variables */ var debug = 0; var variation_name = ""; var $; /* all Pure helper functions */ function waitForElement(selector, trigger, delayInterval, delayTimeout) { var interval = setInterval(function () { if ( document && document.querySelector(selector) && document.querySelectorAll(selector).length > 0 ) { clearInterval(interval); trigger(); } }, delayInterval); setTimeout(function () { clearInterval(interval); }, delayTimeout); } var marginRight; let progressbar = `<div class="eg-progressbar"> <div class="eg-shippingmessage"> <p class="eg-shipping">Free Shipping!</p> <p class="eg-message">Add $75 worth of products to unlock FREE SHIPPING!</p> </div> <div class="eg-progresscontainer"> <div class="eg-bar"> <div style="width: 0%;"></div> </div> <div class="eg-worthofproduct"> <p></p> </div> <div class="eg-amount"> <p>$0</p> <p>FREE <br> SHIPPING</p> </div> </div> </div>`; let egstring = `<div class="eg-minicartprice"> <p class="eg-shippingmessage"><span>Shipping</span><span></span></p> <p class="eg-total"><span>Total</span><span></span></p> </div>` let egPriceNew; function getPriceFromString(priceString) { return parseFloat(priceString.replace('$', '').replace('USD', '').trim()); } function animateProgressBar(targetWidth) { const barElement = document.querySelector('.eg-progressbar .eg-progresscontainer .eg-bar > div'); let currentWidth = parseFloat(barElement.style.width) || 0; marginRight = (100 - targetWidth); const difference = targetWidth - currentWidth; const increment = difference / 100; const interval = setInterval(function () { currentWidth += increment; if ((increment > 0 && currentWidth >= targetWidth) || (increment < 0 && currentWidth <= targetWidth)) { currentWidth = targetWidth; clearInterval(interval); } barElement.style.width = currentWidth + '%'; }, 10); document.querySelector('.AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct p').style.marginRight = marginRight + '%'; } function updateProgressBar() { let barShip = document.querySelector('.AB031 .eg-progressbar .eg-progresscontainer .eg-amount p:last-of-type'); let congratulationMsg = document.querySelector('.AB031 .eg-progressbar .eg-shippingmessage .eg-shipping'); let shippingmsg = document.querySelector('.AB031 .eg-progressbar .eg-shippingmessage .eg-message'); let remainingMsg = document.querySelector('.AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct'); let egPrice = document.querySelector('.eg-minicartprice .eg-total > span:last-of-type'); let free = document.querySelector('.eg-minicartprice .eg-shippingmessage > span:last-of-type'); const minicartPriceElement = document.querySelector('.footer .slidecart-subtotal span'); let cartprice = document.querySelector('.AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct p'); if (minicartPriceElement) { const minicartPrice = egPriceNew; // let priceelement = minicartPriceElement.textContent.trim(); if (minicartPrice >= 75) { animateProgressBar(100); congratulationMsg.innerText = 'Congratulations!'; shippingmsg.innerText = 'Your order will ship to you for free.'; remainingMsg.style.display = 'none'; egPrice.innerText = '$' + minicartPrice + ' USD'; free.innerText = 'FREE'; cartprice.style.display = "none"; cartprice.style.fontSize = "12px !important"; barShip.style.marginRight = '0px'; } else if (minicartPrice < 75) { const targetWidth = (minicartPrice / 75) * 100; animateProgressBar(targetWidth); const amountNeeded = 75 - minicartPrice; congratulationMsg.innerText = 'Free Shipping!'; shippingmsg.innerText = `Add $${amountNeeded.toFixed(2)} worth of products to unlock FREE SHIPPING!`; remainingMsg.style.display = 'flex'; cartprice.innerText = '$' + minicartPrice; egPrice.innerText = '$' + (minicartPrice + 5).toFixed(2) + ' USD'; free.innerText = '$5 USD'; cartprice.style.display = "block"; } if(minicartPrice > 70){ cartprice.style.fontSize = "10px"; barShip.style.marginRight = '-15px'; document.querySelector('.AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct p').style.marginRight = (marginRight+4) + '%'; } } } function init() { if (!document.querySelector('.eg-progressbar')) { document.body.classList.add("AB031"); document.querySelector('#slidecarthq .header').insertAdjacentHTML('afterend', progressbar); waitForElement('.footer > .footer-row:not([style])', function () { document.querySelector('.footer > .footer-row:not([style])').insertAdjacentHTML('afterend', egstring); }, 50, 2000); } setTimeout(() => { var slideCartHQ = document.querySelector('#slidecarthq .slidecarthq'); var progressBar = document.querySelector('.eg-progressbar'); if (slideCartHQ.classList.contains('cartEmpty')) { progressBar.style.display = 'none'; } else { progressBar.style.display = 'block'; } updateProgressBar(); }, 1000); } function update() { var cartCount = 0; const send = XMLHttpRequest.prototype.send XMLHttpRequest.prototype.send = function () { this.addEventListener('load', function () { if (this.responseURL.indexOf('/cart.js') != -1) { var data = JSON.parse(this.responseText); var cartNewCount = data.item_count; egPriceNew = (data.total_price / 100); if (cartNewCount == 0 || cartNewCount == '0') { document.querySelector('.eg-progressbar') && document.querySelector('.eg-progressbar').remove(); return; } if (cartCount != cartNewCount && cartNewCount != 0) { cartCount = data.item_count; init(); } } }) return send.apply(this, arguments) } } update(); waitForElement('.footer .slidecart-subtotal span', init, 100, 15000); } catch (e) { if (debug) console.log(e, "error in Test" + variation_name); } })(); .AB031 #slidecarthq #AB-018-banner { display: none !important; } .AB031 .eg-progressbar { background: #F2F2F2; padding: 12px 24px 12px 14px; } .AB031 .eg-progressbar .eg-shippingmessage p { font-family: Roboto; font-size: 14px; font-weight: 700; line-height: 16.8px; letter-spacing: 0.382999986410141px; text-align: center; } .AB031 .eg-progressbar .eg-shippingmessage .eg-message { font-size: 12px !important; font-weight: 400 !important; line-height: 14.4px !important; margin-top: 8px; } .AB031 .eg-progressbar .eg-progresscontainer .eg-amount p:first-of-type { font-size: 12px !important; } .AB031 .eg-progressbar .eg-progresscontainer .eg-bar { background: #FFFFFF !important; width: 100%; height: 10px; border-radius: 100px; margin-top: 14px; margin-bottom: 7px; } .AB031 .eg-progressbar .eg-progresscontainer .eg-bar>div { background: #A02447; width: 50%; height: 10px; border-radius: 100px; position: relative; } .AB031 .eg-progressbar .eg-progresscontainer .eg-bar>div:after { content: ''; display: flex; width: 17px; height: 17px; position: absolute; right: -1px; border: 1px solid #FFFFFF; background: #A02447; border-radius: 100px; top: -3px; } .AB031 .eg-progressbar .eg-progresscontainer .eg-amount { display: flex; justify-content: space-between; align-items: center; } .AB031 .eg-progressbar .eg-progresscontainer .eg-amount p, .AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct p { font-family: Roboto !important; font-size: 7px; font-weight: 400; line-height: 8px; letter-spacing: 0.382999986410141px; text-align: center; } .AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct p { font-size: 12px !important; line-height: 14.4px !important; width: 40px; overflow: hidden; } .AB031 .eg-progressbar .eg-progresscontainer { position: relative; } .AB031 .eg-progressbar .eg-progresscontainer .eg-worthofproduct { position: absolute; bottom: 0px; width: 100%; display: flex; justify-content: flex-end; } .AB031 .eg-minicartprice { display: flex; flex-direction: column; grid-gap: 10px; margin-bottom: 15px; } .AB031 .eg-minicartprice>p { display: flex; justify-content: space-between; } .AB031 .eg-minicartprice>p span { font-family: SF Pro Text; font-size: 16px; font-weight: 600; line-height: 19.09px; text-align: left; color: #000000; } .AB031 .eg-progressbar .eg-progresscontainer .eg-amount p:last-of-type{ margin-right: -10px; } .AB031 .footer>.footer-row:not([style]) { border-bottom: unset !important; padding-bottom: 10px !important; } .AB031 .eg-progressbar .eg-progresscontainer .eg-bar:after { content: ''; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAqCAYAAADBNhlmAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAATnSURBVHgBxVlvaFtVFD/3vaT9sDLTqnQw0bRJpP3SRdEKKi6TZc0nbdwXoZ1JPlmQucGgChOWflA2Ycj0i/oliVQEQdeJyNKW+Yab0imYibiiSZOqlXaOGjVlLH/e3T2vTffSvPdyX5JmP0jeffee9+4v59xz7rknBBrAxz3PPlQUBTcQ0U4ptQMlNmWA0CwByALICUtJToykLyxCnSBgEh85vXspEA8lJAgU7FwPUciwb8kqF8JmyXITRGIyCGHW9EBjkEQBjh76NX6VR7gmwYjdYyOW9ghrDkMzQSHKo1FDgorWiBDlNqVZMNMLRA6+lJy5qCci6A3EXENHmEmlbSOHIGDHOWIu7xE9EVGrM+Y8cII5wkloGYjP3+WAqdVUlSarTBxz7n+egjgFdwGE0mAgNR2r6FPfRPo8dlJs/5E1bXBXQLPWUtGt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DJat2hUPK8pCdimA9i5ZOKZB/7GVFoPqZo6dYjRuQQ3EX0iMvrJlR4B5pQRGfre6IWsTJM/w0R6fPZSYmeACTKa3qWFOPWxcq9F3mJ3Xm0ASBZKMhugcAeituk+o8cQjKyTBehJCRCGSUhqQu3AZ9mYnOUcWUpAAAAAElFTkSuQmCC'); width: 19px; display: flex; background-size: contain; position: absolute; height: 20px; right: -1px; top: -6px; background-repeat: no-repeat; }
Leave a Comment