var initialPortraitHeight = null; document.addEventListener('DOMContentLoaded', function () { // wistia var videoId = 'x923mlkxu2'; var ctpUrl = 'https://d2z65klgtz99km.cloudfront.net/AWN/awn_birthright_0325/AWN_BIRTHRIGHT_CTP_DESKTOP_HANDWRITTENPRESSPLAY_FS_0325.gif'; /* Full-screen Mobile Logic */ var hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0; preSetVideoHeight(); if (hasTouchScreen && window.innerHeight > window.innerWidth) { // Detect mobile portrait mode videoId = '4p0n1vsz7t'; ctpUrl = 'https://d2z65klgtz99km.cloudfront.net/AWN/awn_birthright_0325/AWN_BIRTHRIGHT_CTP_MOBILE_HANDWRITTENPRESSPLAY_NODECK_0325.gif'; } /* / Full-screen Mobile Logic */ var poptime = 2274; document.querySelector('.wistia_embed').classList.add('wistia_async_' + videoId); const ofLink = 'https://pro.paradigmnewsletters.org/o/awn_birthright_0325/LAWN5432?cake_s1=740c0877d1e143b594d91c3ca86a216c&SID=3415790118458890266&h=true'; const ctaUrl = ofLink.concat((ofLink.indexOf('?') === -1) ? '?pagetype=VSL' : '&pagetype=VSL'); window._wq = window._wq || []; _wq.push({ id: videoId, /* CTA in Video */ options: { stillUrl: ctpUrl, plugin: { 'midrollLink-v1': { links: [ { time: poptime, duration: 500000000000000000000000000, text: 'JOIN NOW', url: ctaUrl }, ], }, } }, /* / CTA in Video */ onReady: function (video) { var video = Wistia.api(videoId); var hidden = true; /* set size of video player */ adjustVideoHeight(); window.addEventListener('resize', adjustVideoHeight); window.addEventListener('orientationchange', handleOrientationChange); /* / set size of video player */ /* play stats */ video.bind('play', function () { const key = 'wistiaPlay_' + video.hashedId(); if (!sessionStorage.getItem(key)) { sessionStorage.setItem(key, '1'); window.dataLayer = window.dataLayer || []; dataLayer.push({ event: 'wistiaplay', videoId: video.hashedId() }); } }); /* play stats*/ video.bind('crosstime', poptime, function () { document.querySelector('.cta-wrapper').classList.remove('hidden'); hidden = false; /* add event for tracking */ window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'cta-pop' }); /* end add event for tracking */ }); video.bind('end', function () { if (hidden == true) { document.querySelector('.cta-wrapper').classList.remove('hidden'); hidden = false; }; window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'onehundreded' }); }); video.bind('percentwatchedchanged', function (percent, lastPercent) { if (percent == .25) { console.log('The viewer has watched 25% of the video! '); window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'twentyfive' }); }// if 25 if (percent == .50) { console.log('The viewer has watched 50% of the video! '); window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'fifty' }); }// if 50 if (percent == .75) { console.log('The viewer has watched 75% of the video! '); window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'seventyfive' }); }// if 75 }); } }); // final review added to all cta links var ctaBtns = document.querySelectorAll('a[class^="cta"]'); // @param {object} node ctaBtns.forEach(elem => { var final_review_elem = document.createElement('p'); final_review_elem.classList = 'cta-subtext'; final_review_elem.innerText = 'You Can Review Your Order Before it’s Final'; final_review_elem.classList.add("text-white"); elem.insertAdjacentElement('afterend', final_review_elem); }); // exit pop setTimeout(function () { document.addEventListener('mouseout', trigger_pop); function trigger_pop(e) { if (!e.relatedTarget || e.relatedTarget.nodeName === 'HTML') { showPop(); } } function showPop() { var modalBG = document.querySelector('#modalBG'); const focusableElemsString = 'a[href], button, input, textarea, select, details' const focusableElems = modalBG.querySelectorAll(focusableElemsString) var firstFocus = focusableElems[0]; var lastFocus = focusableElems[focusableElems.length - 1]; modalBG.classList.remove('hidden'); firstFocus.focus(); document.querySelector('#modalClose').addEventListener('click', close_modal); document.querySelectorAll('.watchVideo').forEach(function (elem) { elem.addEventListener('click', close_modal); }); document.addEventListener('keydown', trap_tab_key); document.addEventListener('keydown', function (e) { if (e.code === 'Escape') { close_modal(); } }); modalBG.addEventListener('click', function (e) { if (e.target === modalBG) { close_modal(); } }); function trap_tab_key(e) { if (e.keyCode === 9) { if (e.shiftKey) { if (document.activeElement === firstFocus) { e.preventDefault(); lastFocus.focus(); } } else { if (document.activeElement === lastFocus) { e.preventDefault(); firstFocus.focus(); } } } } function close_modal(e) { modalBG.classList.add('hidden'); document.removeEventListener('mouseout', trigger_pop); document.removeEventListener('keydown', trap_tab_key); } } }, 60000); }); var promoVars = { "imprint": "PP", "pubCode": "AWN", "signoffDate": "February 2025", "pageType": "VSL", "showTestimonials": "true" } var imprint = promoVars.imprint; var pubpromo = promoVars.pubCode;