(() => { window.addEventListener("load", function() { if(window.perfTrackerExtEnabled) { if (window.isValidLcp) { try { const navTiming = getNavTiming(); var telemetryInitializer = function (envelope) { envelope.data.timing = navTiming.timing; envelope.data.navigation = navTiming.navigation; window.fcpEntry.lcp = window.lcpEntry.renderTime || window.lcpEntry.loadTime; envelope.data.paint = window.fcpEntry; window.lcpEntry.resourceTimings = window.resourceTimings.map(entry => { return { name: entry.name, duration: entry.duration, startTime: entry.startTime, responseStart: entry.responseStart, responseEnd: entry.responseEnd }; }); envelope.data.paint.lcpEntry = window.lcpEntry; envelope.data["bStore"] = findCookieValue('bStore'); envelope.data["vsbStore"] = findCookieValue('busPurPerm'); }; window.telemetry.webAnalyticsPlugin.addTelemetryInitializer(telemetryInitializer); } catch (e){} } } else if (window.isFeatureEnabled("perf-tracker-1ds")) { if (window.performance.toJSON === undefined) { console.log("Performance telemetry was not found"); } else { const navTiming = getNavTiming(); try { let lcp; let fcp = window.performance.getEntriesByName('first-contentful-paint')[0].toJSON(); const po = new PerformanceObserver((entryList) => { const entries = entryList.getEntries(); const lastEntry = entries[entries.length - 1]; lcp = lastEntry.renderTime || lastEntry.loadTime; fcp['lcp'] = lcp; var telemetryInitializer = function (envelope) { envelope.data.timing = navTiming.timing; envelope.data.navigation = navTiming.navigation; envelope.data.paint = fcp; envelope.data["bStore"] = findCookieValue('bStore'); envelope.data["vsbStore"] = findCookieValue('busPurPerm'); }; window.telemetry.webAnalyticsPlugin.addTelemetryInitializer(telemetryInitializer); }); po.observe({type: 'largest-contentful-paint', buffered: true}); } catch (e){} } } }); const getNavTiming = () => { if (window.performance.toJSON ) { var json; var stringifiedJson; json = window.performance.toJSON(); stringifiedJson = JSON.stringify(json); var perf = JSON.parse(stringifiedJson); return { timing: perf.timing, navigation: perf.navigation } } else { return { timing: null, navigation: null } } } const findCookieValue = (cname) => { if (!document.cookie) return ''; const cookieString = document.cookie.split('; ').find(c => c.startsWith(cname)); if (cookieString) return cookieString.split('=')[1]; else return ''; } })(); $(document).ready(function() { $('[clickgroup-telemetry-enabled]').each(function() { var anchorCount = $(this).find('a').length; if (anchorCount === 1) { $(this).css('cursor', 'pointer'); } }); $('[clickgroup-telemetry-enabled]').click(function(e) { if ($(e.target).closest('a').length) { // Code to execute when the anchor tag is clicked let currentElement = $(e.target).closest('a'); if ( currentElement && currentElement.html()) { currentElement.data( "telemetry", true ); captureTelemetryPageAction.call(this, currentElement.data()); } } if (!$(e.target).closest('a').length) { // Code to execute when the div (excluding the anchor tags) is clicked let currentElement = retrieveCurrentElement(e); if ( currentElement && currentElement.html()) { // let linkGroup = currentElement.find("a") || currentElement.find(".link-group"); let linkGroup = currentElement.find("a"); var anchorCount = linkGroup.length; // Redirect if there is only one anchor tag if (anchorCount === 1) { let card = currentElement.find(".card"); let linkDataSet = linkGroup[0].dataset; if (card.length>0 && card[0].dataset && card[0].dataset.hasOwnProperty("biCompnm")) { linkDataSet = card[0].dataset; } currentElement.data( "telemetry", true ); captureTelemetryPageAction.call(this, linkDataSet); // Get the href of the first anchor tag inside the div var anchorHref = linkGroup[0].getAttribute('href'); var target = linkGroup[0].getAttribute('target'); if(linkGroup[0].hasAttribute("href") && !linkGroup.hasClass("video-trigger")){ // Redirect the page to the same path as the anchor's href if target is not _blank window.open(anchorHref, target); } else { linkGroup[0].click(); } } } } function captureTelemetryPageAction(linkDataSet) { let content = {}; this.isCapturePageActionLoadedh = function () { return window.telemetry && window.telemetry.webAnalyticsPlugin && window.telemetry.webAnalyticsPlugin.capturePageAction; }; if (this.isCapturePageActionLoadedh()) { content.cN = linkDataSet.biCn; content.cT = linkDataSet.biCt; content.ecn = linkDataSet.biEcn; content.ehn = linkDataSet.biEhn; content.pa = linkDataSet.biPa; content.hn = linkDataSet.biHn; content.compnm = linkDataSet.biCompnm; content.assetid = linkDataSet.biAssetid; content.carpos = linkDataSet.biCarpos; window.telemetry.webAnalyticsPlugin.capturePageAction(null, { behavior: linkDataSet.biBhvr, targetUri: linkDataSet.targetUri, content: content }); } } function retrieveCurrentElement(e) { if ($(e.target).closest("[clickgroup-telemetry-enabled]").html()) { let currentElement = $(e.target).closest("[clickgroup-telemetry-enabled]"); return currentElement; } } }); }); (function() { "use strict"; $('.tabindex-0').attr("tabindex", "0"); })(); (function () { "use strict"; let Util, Modal; onMwfInitialized(() => { Util = window.mwf.Util; Modal = window.mwf.Modal; if (!document.querySelector('[data-mount="modal"] universal-media-player')) return; const modals = document.querySelectorAll('[data-mount="modal"]'); let instances; waitFor( 1000, 3000, () => (instances = Modal.getInstances())?.length >= modals.length ) .then(() => { instances.forEach((modal) => { if (modal.el.querySelector("universal-media-player")) { modal.el.removeEventListener("keydown", modal.onKeydown); // Replace with modified keydown handler modal.onKeydown = keydownHandler.bind(modal); } }); }) .catch((error) => { console.log("Error overriding Moray on Modal keydown handler:", error); }); }); function keydownHandler(event) { const ump = this.el.querySelector("universal-media-player"); const lastShadowDom = ump?.shadowRoot ?.querySelector("ump-controls") ?.shadowRoot?.querySelector("ump-control-bar")?.shadowRoot; // Shadow DOM traversal can't guarantee the order or visibility of elements // Have to assume "Fullscreen" button is the last tabbable element for now this.lastTabbableElement = lastShadowDom?.querySelector( '[data-testid="fullscreen-button"]' ); switch (Util.getKeyCode(event)) { case Util.keyCodes.ESC: { event.preventDefault(); this.hide(); break; } case Util.keyCodes.TAB: { if ( (document.activeElement === this.firstTabbableElement || document.activeElement === this.el) && event.shiftKey ) { event.preventDefault(); this.lastTabbableElement.focus(); } if ( document.activeElement === ump && lastShadowDom.activeElement === this.lastTabbableElement && !event.shiftKey ) { event.preventDefault(); this.firstTabbableElement.focus(); } break; } } } function onMwfInitialized(cb) { if (typeof window !== undefined && window.mwf) cb(); else document.addEventListener("mwfInitialized", () => cb()); } async function waitFor(interval, total, satisfied) { let waited = 0; while (!satisfied() && waited < total) { await new Promise((resolve) => setTimeout(resolve, interval)); waited += interval; } } })();