(function () { const tabs = document.querySelectorAll('.buy-now-v2 [data-tab-target]'); const tabContents = document.querySelectorAll('.buy-now-v2 [data-tab-content]'); const tabListSection = document.querySelector('.inner-tab-content'); const innerTabs = document.querySelectorAll('.buy-now-v2 [data-inner-tab-target]'); const imageAreaEle = document.querySelectorAll('.buy-now-v2 .LinkNavigation.includes .Imagearea'); const imagePopup = document.querySelectorAll('.buy-now-v2 .LinkNavigation.includes .popoverdialog'); const closeIcon = document.querySelectorAll('.buy-now-v2 .LinkNavigation.includes .closebutton'); const cards = document.querySelectorAll('.buy-now-v2 .ContainerBuy'); let monthlyPriceEleText = cards[0].querySelector('.cc-card-flex-grow .sku1price'); let yearlyPriceEleText = cards[0].querySelector('.cc-card-flex-grow .sku2price'); if (!yearlyPriceEleText || !monthlyPriceEleText) { tabListSection.style.display= 'none'; } const setActivePrice = (currentFreq) => { cards?.forEach((card) => { const monthlyPriceEle = card.querySelector('.sku1-price'); const yearlyPriceEle = card.querySelector('.sku2-price'); const bottomMonthlyPriceEle = card.querySelector('.link-group .sku2price a'); const bottomYearlyPriceEle = card.querySelector('.link-group .sku1price a'); const yearlyButton = card.querySelector('a[data-bi-ct="button"][data-bi-rpid="Yearly"]'); const monthlyButton = card.querySelector('a[data-bi-ct="button"][data-bi-rpid="Monthly"]'); const yearlyCta = card.querySelector('a[data-bi-ct="cta"][data-bi-rpid="Yearly"]'); const monthlyCta = card.querySelector('a[data-bi-ct="cta"][data-bi-rpid="Monthly"]'); let bottomMonthlyPrice = bottomMonthlyPriceEle ? bottomMonthlyPriceEle.innerText : ''; let bottomYearlyPrice = bottomYearlyPriceEle ? bottomYearlyPriceEle.innerText : ''; if (bottomMonthlyPrice && bottomMonthlyPriceEle) { bottomMonthlyPrice = bottomMonthlyPriceEle.innerText.trim(); } if (bottomYearlyPrice && bottomYearlyPriceEle) { bottomYearlyPrice = bottomYearlyPriceEle.innerText.trim(); } const buyPriceLink = card.querySelector('.skuprice a'); if (currentFreq == '#yearly') { if (buyPriceLink) buyPriceLink.innerText = `${bottomMonthlyPrice}`; if (monthlyPriceEle) monthlyPriceEle.style.display = 'none'; if (yearlyPriceEle) yearlyPriceEle.style.display = 'block'; if (monthlyButton) monthlyButton.style.display = 'none'; if (yearlyButton) yearlyButton.style.display = 'table'; if (monthlyCta) monthlyCta.style.display = 'table'; if (yearlyCta) yearlyCta.style.display = 'none'; } else { if (buyPriceLink) buyPriceLink.innerText = `${bottomYearlyPrice}`; if (monthlyPriceEle) monthlyPriceEle.style.display = 'block'; if (yearlyPriceEle) yearlyPriceEle.style.display = 'none'; if (yearlyButton) yearlyButton.style.display = 'none'; if (monthlyButton) monthlyButton.style.display = 'table'; if (monthlyCta) monthlyCta.style.display = 'none'; if (yearlyCta) yearlyCta.style.display = 'table'; } }); }; innerTabs.forEach(tab => { tab.addEventListener('click', (event) => { const currentFreq = event.target.dataset.innerTabTarget; innerTabs.forEach(tab => { tab.classList.remove('active'); tab.setAttribute("aria-selected",false); }) tab.classList.add('active'); tab.setAttribute("aria-selected",true); setActivePrice(currentFreq); }) }); imageAreaEle.forEach(function(ele, i) { ele.addEventListener('click', function(e) { e.preventDefault(); imagePopup.forEach(function(ele, i) { ele.style.display = 'none'; }); if (this.nextElementSibling && this.nextElementSibling.classList.contains('popoverdialog')) { const activeImgLeft = this.offsetLeft + 58; const activeImgTop = this.offsetTop + 54; this.nextElementSibling.style.left = activeImgLeft + 'px'; this.nextElementSibling.style.top = activeImgTop + 'px'; this.nextElementSibling.style.display = 'block'; } }); }); closeIcon.forEach(function(ele, i) { ele.addEventListener('click', function(e) { e.target.closest('.popoverdialog').style.display = 'none'; }); }); window.setInnerTabContentHeight = function() { var firstContainerEle = document.querySelector('[data-inner-tab-content].active .ContainerBuy:first-child .cc-card-flex-grow'); var secondContainerEle = document.querySelector('[data-inner-tab-content].active .ContainerBuy:last-child .cc-card-flex-grow'); firstContainerEle.style.height = 'auto'; secondContainerEle.style.height = 'auto'; setTimeout(function() { var firstContainer = document.querySelector('[data-inner-tab-content].active .ContainerBuy:first-child .cc-card-flex-grow').scrollHeight; var secondContainer = document.querySelector('[data-inner-tab-content].active .ContainerBuy:last-child .cc-card-flex-grow').scrollHeight; var activeContainer = firstContainer > secondContainer ? firstContainer : secondContainer; var innerSections = document.querySelectorAll('[data-inner-tab-content].active .ContainerBuy .cc-card-flex-grow'); innerSections?.forEach(function(val) { val.style.height = activeContainer + 'px'; }) }, 1000); } window.addEventListener('DOMContentLoaded', function() { setInnerTabContentHeight(); }); window.addEventListener("resize",function(){ if($('.buy-now-v2 .cc-card-flex-grow') && ($('.buy-now-v2 .cc-card-flex-grow').css('padding-top')) ){ $('.buy-now-v2 .cc-card-flex-grow').removeAttr("style"); } setInnerTabContentHeight(); if(window.innerWidth > 859){ badgeHeightBuyNow(); } else{ setBadgePaddingMobile(); } imagePopup.forEach(function(ele, i) { ele.style.display = 'none'; }); }); })(); if(window.innerWidth > 859){ badgeHeightBuyNow(); } function badgeHeightBuyNow(){ let badgesLengthBN = $('.buy-now-v2 .badge').length; let onlyHeightBN=[]; let tempBN; if(badgesLengthBN > 1){ for(let i=0; i <= badgesLengthBN; i++){ if($('.buy-now-v2 .badge.bg-primary.position-absolute.top-2')[i]){ tempBN = $('.buy-now-v2 .badge.bg-primary.position-absolute.top-2')[i].offsetHeight; onlyHeightBN.push(tempBN); } } let indexNeededBN = onlyHeightBN.indexOf(Math.max(...onlyHeightBN)); let maxHeightBN = $('.buy-now-v2 .badge.bg-primary.position-absolute.top-2')[indexNeededBN].offsetHeight; if(maxHeightBN > 28){ maxHeightBN = (maxHeightBN * 0.0625)+3; maxHeightBN = "padding:"+maxHeightBN+'rem 0 0 0!important'; var elemsBN = document.querySelectorAll(".buy-now-v2 .cc-card-flex-grow.pt-5"); var indexBN = 0, lengthBN = elemsBN.length; for ( ; indexBN < lengthBN; indexBN++) { elemsBN[indexBN].style.cssText = maxHeightBN; } } } else { let maxHeightBN = $('.buy-now-v2 .badge.bg-primary.position-absolute.top-2')[0].offsetHeight; if(maxHeightBN > 28){ maxHeightBN = (maxHeightBN * 0.0625)+2; maxHeightBN = "padding:"+maxHeightBN+"rem 0 0 0!important"; var elemsBN = document.querySelectorAll(".buy-now-v2 .cc-card-flex-grow.pt-5"); var indexBN = 0, lengthBN = elemsBN.length; for ( ; indexBN < lengthBN; indexBN++) { elemsBN[indexBN].style.cssText = maxHeightBN; } } } } function setBadgePaddingMobile(){ let badgesLengthBN = $('.buy-now-v2 .badge').length; if(badgesLengthBN){ var cardEle = document.querySelectorAll(".buy-now-v2 .cc-card-flex-grow"); var i = 0, cardlength = cardEle.length; for ( ; i < cardlength; i++) { cardEle[i].style.cssText = "padding-top:0 !important"; } } } var buyNowv2 = document.querySelector(".buy-now-v2"); var wdp = buyNowv2.querySelector(".discounted-price-text").dataset.wdp; if (buyNowv2) { var sku1OriginalPrice = buyNowv2.querySelector(".buy-now-price .sku1-original-price"); var sku2OriginalPrice = buyNowv2.querySelector(".buy-now-price .sku2-original-price"); var discountedText = buyNowv2.querySelector(".discounted-price-text"); if(typeof msauth == "object" && wdp == "true"){ if(sku1OriginalPrice.classList.contains(".hide-text")){ sku1OriginalPrice.classList.remove("hide.text"); } if(sku2OriginalPrice.classList.contains(".hide-text")){ sku2OriginalPrice.classList.remove("hide.text"); } var buynowUrl = document.getElementsByClassName("product-buynow-v2-url")[0].value; if(buynowUrl){ var productsIds = buynowUrl.split("productIds=")[1].split("&")[0].split("%2C"); var productsLength = productsIds.length; for (let i = 0; i < productsLength; i++){ $('.buy-now-v2 .ContainerBuy')[i].classList.add(productsIds[i]); } $.ajax({ url : buynowUrl, type : 'GET', headers: { "compactticket": msauth.AuthTicket }, data : { }, dataType:'json', success : function(data) { var myJSONLength = JSON.stringify(data.products.length); var jsonArray = []; for(var counter = 0; counterFootnote`; subscriptEles.forEach(ele=>{ if(ele.children.length==0) ele.insertAdjacentHTML('afterbegin',footnoteEle) }) } addFootnotes();