$(document).ready(function () { "use strict"; if ($(".highlight .card-background picture img")) { var highlightImgAsset = $('img[id^="img-highlight-"]'); var cardBodyLG = $('div[id^="card-body-highlight-"] .link-group'); if (highlightImgAsset.length > 0) { for (var i = 0; i < highlightImgAsset.length; i++) { if (highlightImgAsset[i]) { var assetSrc = highlightImgAsset[i].src; if (cardBodyLG[i]) { if (cardBodyLG[i].children.length > 0) { for (var j = 0; j < cardBodyLG[i].children.length; j++) { if (!cardBodyLG[i].children[j].getAttribute("data-bi-assetid")) { cardBodyLG[i].children[j].setAttribute("data-bi-assetid", assetSrc); } } } } } } } } function highlightComponentV1() { let subscriptEles = document.querySelectorAll(".highlight sup"); let footnoteEle = `Footnote`; subscriptEles.forEach(ele => { if (ele.children.length == 0) ele.insertAdjacentHTML('afterbegin', footnoteEle) }) } highlightComponentV1(); document.querySelectorAll("div.highlight .link-group > a").forEach(function (item) { // Read the Heading text of highlight component var jsllHeading = item.closest(".card-body"); var parentComponent = item.closest(".carousel-highlight"); if (jsllHeading) { var heading = jsllHeading.querySelector("h1, h2, h3, h4, h5, h6"); if (heading && heading.textContent) { // assign to data-bi-ehn attribute if (!item.dataset.biEhn) { item.dataset.biEhn = heading.textContent.trim(); } // assign to data-bi-hn attribute if (!item.dataset.biHn) { item.dataset.biHn = heading.textContent.trim(); } } // Set the data-bi-compname attribute to Highlight Carousel if it is part of the Highlight Carousel component if (!item.dataset.biCompnm) { if (parentComponent) { item.dataset.biCompnm = "Highlight Carousel"; } else { // Read the Component name and assign to data-bi-compname attribute var compName = jsllHeading.getAttribute("data-highlight-compname"); if (compName) { item.dataset.biCompnm = jsllHeading.getAttribute("data-highlight-compname"); } else { item.dataset.biCompnm = "Highlight"; } } } } if ($("html").length > 0 && $("html").attr("lang").length > 0) { var currentLocale = $("html").attr("lang"); var anchorTag = $(item); var productID = ""; var URL_BUYBOX = ""; if (anchorTag) { if (jsllHeading && jsllHeading.getElementsByClassName("product-check-id").length > 0) { productID = jsllHeading.getElementsByClassName("product-check-id")[0].value; } if (jsllHeading && jsllHeading.getElementsByClassName("buyBoxEndPoint").length > 0) { URL_BUYBOX = jsllHeading.getElementsByClassName("buyBoxEndPoint")[0].value; } if (productID.length > 0 && URL_BUYBOX.length > 0) { $.ajax({ url: URL_BUYBOX + "?productId=" + productID + "&locale=" + currentLocale, type: "GET", success: function (response, status) { if (status === 'success') { if (response && response['skuInfo']) { let skuInfo = response['skuInfo']; if (Object.keys(skuInfo).length > 0) { let skuFirstObejct = skuInfo[Object.keys(skuInfo)[0]] if (skuFirstObejct['CallToAction'] && skuFirstObejct['CallToAction']['enabledConditions'] && skuFirstObejct['CallToAction']['enabledConditions'][0] && (skuFirstObejct['CallToAction']['enabledConditions'][0]['value'] === false)) { if (anchorTag[0].hasAttribute('data-bi-ct') && anchorTag[0].getAttribute('data-bi-ct') === "button") { var buildButtonTag = $('