window.trafficedium = $ J.Cookie('TT');} else {var res =(url.indexof(“outbrain”)> -1 || url.indexof(“gclid =”)> -1 || url.indexof(“utm_medium = cpc”)> -1 ||推荐人.indexof(“gclid =”)> -1 ||推荐人.indexof(“odebrain”)> -1 ||推荐人.Intexof(“UTM_MEDIUM = CPC”)> -1)?“支付”:“有机”;window.trafficedium = res;$ j.cookie('tt',res,{domain:'',路径:'/'});}如果($ j.cookie('ts')!==未定义){window.trafficsource = $ j.cookie('ts');}否则如果(window.trafficedium ===“pair”){if(url.indexof(“gclid = fof(”gclid =“)> -1 ||推荐器.indexof(”gclid =“)> -1){window.trafficsource =”谷歌显示“;} varutmesource = geturlquerystringvaluebyname(“utm_source”);if(Utmsource!==未定义&& utmsource!== null && utmsource!==“”){window.trafficsource = utmsource.tolowerCase();} else {if(referrer.indexof(“google.com”)> -1){window.trafficsource =“Google Search”; } } if ($j.cookie('ts') === undefined && window.trafficsource !== undefined && window.trafficsource !== null) { $j.cookie('ts', window.trafficsource, { domain: '', path: '/' }); } window.Context.isMobile = (window.Context.isMobile || (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1) || (window.innerWidth < 768)); var isMobile = window.Context.isMobile; //mobile if (isMobile) { if ($j("#TopLeaderboard").length > 0) $j("#TopLeaderboard").remove(); if ($j("#BottomLeaderboard").length > 0) $j("#BottomLeaderboard").remove(); if (screen.width < 768) { if ($j("#modalHealio5Interstitial").length > 0) $j("#modalHealio5Interstitial").remove(); } if (!window.isTestSection) { if ($j("#MediumRectangle5").length > 0) $j("#MediumRectangle5").remove(); if ($j("#MediumRectangle6").length > 0) $j("#MediumRectangle6").remove(); if ($j("#MediumRectangle7").length > 0) $j("#MediumRectangle7").remove(); if ($j("#MediumRectangle8").length > 0) $j("#MediumRectangle8").remove(); if ($j("#MediumRectangle9").length > 0) $j("#MediumRectangle9").remove(); if ($j("#MediumRectangle10").length > 0) $j("#MediumRectangle10").remove(); } } //desktop else { var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutationRecord) { var ele = $j(mutationRecord.target); if ($j(ele).attr("style") === "display: none;" && $j(ele).is(":visible")) { $j(ele).attr("style", "display: none !important;"); } console.log('style changed!'); }); }); var target = document.getElementById('TopLeaderboard'); if (target !== undefined && target !== null) observer.observe(target, { attributes: true, attributeFilter: ['style'] }); } var adLoadDelay = 400; // time in ms to wait for an ad to render before refreshing the layout. var contentTypeTag = document.querySelector('meta[name="bi:content_type"], meta[name="page_type"]'); var contentSpecialtyTag = document.querySelector('meta[name="bi:primary_specialty"]'); var contentSubspecialtyTag = document.querySelector('meta[name="bi:primary_subspecialty"]'); var contentType = ((contentTypeTag !== undefined && contentTypeTag !== null) ? contentTypeTag.getAttribute("content") : '').replace(/[’']/g, ''); var contentSpecialty = ((contentSpecialtyTag !== undefined && contentSpecialtyTag !== null) ? contentSpecialtyTag.getAttribute("content") : '').replace(/[’']/g, ''); var contentSubspecialty = ((contentSubspecialtyTag !== undefined && contentSubspecialtyTag !== null) ? contentSubspecialtyTag.getAttribute("content") : '').replace(/[’']/g, ''); if ((contentType === "Author" || contentType === "Wyanoke Tag") && (contentSpecialty === "" || contentSpecialty === "Staff")) contentSpecialty = "Primary Care"; if (window.location.hostname.split('.')[0] !== 'www' || window.queryString.notarget !== undefined) googletag.pubads().setTargeting("usertype", "slack"); //negatively target against bad words var bodyText = $j('body').clone().find('script').remove().end().find('style').remove().end().text().trim(); var badWords = ['coronavirus', 'covid', 'covid19', 'covid 19']; var foundWords = []; badWords.forEach(function (value) { var regex = new RegExp(value, 'gi'); var res2 = bodyText.match(regex); if (res2 && res2.length > 0) foundWords.push(value); }); if (foundWords && foundWords.length > 0) { console.log('Found bad words: ' + foundWords.join()); googletag.pubads().setTargeting("keyword", foundWords.join()); } if (window.queryString.notarget === undefined || window.queryString.notarget === '') { var specfunc = function() { var specs = []; if (window.Visitor.usercontentspecialty) specs.push(window.Visitor.usercontentspecialty.replace(/[^a-zA-Z&\/\s]/g, '')); if (window.localStorage) { var specstorage = localStorage.getItem("contentspecialties"); specstorage = specstorage ? specstorage.split(',') : []; if (contentSpecialty && contentSpecialty !== '' && specstorage.indexOf(contentSpecialty) === -1) specstorage.splice(0,0,contentSpecialty.replace(/[^a-zA-Z&\/\s]/g, '')); if(specstorage.length > 3) specstorage.splice(2, 1); localStorage.setItem("contentspecialties", specstorage.toString()); specs = specs.concat(specstorage); } return specs.join(); }; var specstring = specfunc(); if(specstring) googletag.pubads().setTargeting("specialty", specstring); if (contentSpecialty !== '') { googletag.pubads().setTargeting("contentspecialty", contentSpecialty); } // use collection name instead of subspec when available if (("").length > 0) { googletag.pubads().setTargeting("collection", ""); } else { if (contentSubspecialty !== '') { googletag.pubads().setTargeting("contentsubspecialty", contentSubspecialty); } } googletag.pubads().setTargeting("traffictype", window.Visitor.type); if (contentType !== '') googletag.pubads().setTargeting("contenttype", contentType); if ("{9A08EFCB-56BA-41C8-901D-E7CEC8DC5C5F}" !== '') googletag.pubads().setTargeting("documentid", "{9A08EFCB-56BA-41C8-901D-E7CEC8DC5C5F}"); if (window.trafficmedium !== undefined) googletag.pubads().setTargeting("trafficmedium", window.trafficmedium); if (window.trafficsource !== undefined) googletag.pubads().setTargeting("trafficsource", decodeURI(window.trafficsource)); } window.viewedAds = []; googletag.pubads().addEventListener('impressionViewable', function (event) { var slotname = event.slot.getAdUnitPath(); setTimeout(function () { window.viewedAds.push(slotname.replace("/136749668/Healio5_", "")); }, 2000); if (window.ga) ga('send', 'event', 'Viewability', 'Viewed', slotname, 0, { 'nonInteraction': true }); }); window.googletag.cmd.push(function () { window.googletag.pubads().collapseEmptyDivs(true); window.googletag.enableServices(); }); firstLoad(isMobile, adLoadDelay); tryRenderPopup(adLoadDelay); // Drew 2020-06-04: we used to only do this for mobile googletag.pubads().addEventListener('slotRenderEnded', function (event) { // Drew 2020-06-17: we have a different event handler specifically for the popup ad var slotElementId = event.slot.getSlotId().getDomId(); var slotElement = document.getElementById(slotElementId); /*if (window.ga) { var slotname = event.slot.getAdUnitPath(); ga('send', 'event', 'Viewability', 'Slot Loaded', slotname, 0, { 'nonInteraction': true }); }*/ if (slotElement.classList.contains('popup-ad')) return false; // ---- if (!event.isEmpty) { if (console.log && window.queryString.verbose === '1') console.log(event.slot.getSlotId() + ' Ad placed, checking for content.'); if ($("#" + event.slot.getSlotId().getDomId()).html().length > 0) { if (console.log && window.queryString.verbose === '1') console.log(event.slot.getSlotId() + ' We seem to have content.'); // once we have a rendered ad slot it's safe to remove all other stickiness document.getElementsByClassName("sticky-ad").forEach(function (e) { if (e.id !== slotElementId) e.classList.remove("sticky-ad"); }); if (isMobile) { $("#" + event.slot.getSlotId().getDomId()).parent().addClass("article-listing-card"); $(".card--layout").masonry('reloadItems').masonry('layout'); $("#" + event.slot.getSlotId().getDomId()).parent().css('opacity', '1'); } } else { if (console.log && window.queryString.verbose === '1') console.log(event.slot.getSlotId() + ' We do not seem to have content.'); if (console.log && window.queryString.verbose === '1') console.log(event.slot.getSlotId() + ' Ad empty, setting layout.'); $("#" + event.slot.getSlotId().getDomId()).closest('.card-placeholder, .ad-unit').remove(); } } else { if (console.log && window.queryString.verbose === '1') console.log(event.slot.getSlotId() + ' DFP error - Ad empty, setting layout.'); $("#" + event.slot.getSlotId().getDomId()).closest('.card-placeholder, .ad-unit').remove(); } return true; }); var lastDistanceFromTop = $(window).scrollTop(); var scrollTimeout; var throttle = 150; $(window).on('scroll', function () { if (!scrollTimeout) { scrollTimeout = setTimeout(function () { if (isMobile && window.isTestSection) { var distanceFromTop = $(window).scrollTop(); var offset = distanceFromTop - lastDistanceFromTop; //console.log("offset " + Math.round(offset)); lastDistanceFromTop = distanceFromTop; if (offset < 35 && offset > -35) // faster than x and we don't want to load the ads. lazyload(); } else { lazyload(); } scrollTimeout = null; }, throttle); } }); return true; } $j(document).ready(function() { if (window.location.pathname.toLowerCase().indexOf("/news/hematology-oncology") > -1 && document.querySelector('meta[name="bi:content_type"], meta[name="page_type"]').content === "Landing") { $j("body.news").addClass("hematology-oncology"); } if (window.Visitor === undefined && window.sessionStorage) window.Visitor = JSON.parse(sessionStorage.getItem("visitor", "")); if (window.Visitor !== undefined && window.Visitor !== "" && window.Visitor !== null && !window.Visitor.isbot && window.Visitor.type !== "DC") adinit(); else { window.addEventListener("globalsloaded", function () { //dont run if we're a bot if (window.Visitor !== undefined && window.Visitor !== "") { if (window.sessionStorage) sessionStorage.setItem("visitor", JSON.stringify(window.Visitor), "sessionStorage"); if (window.Visitor !== undefined && window.Visitor !== "" && window.Visitor !== null && !window.Visitor.isbot && window.Visitor.type !== "DC") adinit(); } }); } }); window.queryString = (window.queryString || {}); window.location.search.substring(1).split('&').forEach(function (param) { var kvp = param.split('='); if (kvp.length === 2 && kvp[0].length > 0 && kvp[1].length > 0 && !window.queryString.hasOwnProperty(kvp[0])) Object.defineProperty(window.queryString, kvp[0], { value: kvp[1] }); }); if (window.queryString.forcemobile === '1') window.orientation = window.orientation || {};