"); } } if(responsiveDesign==1){ //Page is responsive design, check if it is an article page if($("[data-widget-def='UX3articleContent']").length!=0){ //Its an article page, disable the sticky sidebar disableStickySidebar = 1; } } if(disableStickySidebar==0){ //Check for disableStickySidebar in Querystring disableStickySidebar = gpt_GetQuerystring('disableStickySidebar',0); } if(disableStickySidebar!=0){ //Disable the sticky leaderbard //Check for page flag, if it does not exist, create it. if($('#disableStickySidebar').length==0){ $("body").append("
'); } googletag.cmd.push(function() { var gptAdSlots = []; //*********************************************** //Start Define Size mapping based on client Viewport //*********************************************** var gptLeaderboardSizeMapping = googletag.sizeMapping(). addSize([768, 0], [[728, 90]]). // Leaderboard addSize([0, 0], [[320, 50], [300, 50]]). // Mobile Leaderboard build(); var gptSideBarSizeMapping = googletag.sizeMapping(). addSize([1140, 800], [[160, 600], [300, 250]]). // SkyScraper - Desktop (Require min 800 vertical), Fall back to Boombox addSize([1140, 450], [[300, 250]]). // BoomBox - Desktop (Require min 450 vertical) addSize([0, 0], []). // Phone-Tablet build(); var gptSideBarNotResponsiveSizeMapping = googletag.sizeMapping(). addSize([1140, 800], [[160, 600]]). // SkyScraper - Desktop (Require min 800 vertical) addSize([0, 0], []). // Phone-Tablet build(); var gptSideBarNotStickySizeMapping = googletag.sizeMapping(). addSize([1140, 800], [[160, 600], [300, 250]]). // SkyScraper Not Sticky (Require min 800 vertical), Fall back to Boombox addSize([1140, 450], [[300, 250]]). // BoomBox Not Sticky (Require min 450 vertical) addSize([0, 0], []). // Phone-Tablet build(); //*********************************************** //End Define Size mapping based on client Viewport //*********************************************** //*********************************************** //Start detection for ad slots on page //*********************************************** $(".gpt-ad").each(function( index ) { var gptSite = GPT_CheckForNULL($('#gptSite').val()); var gptPage = ''; var adSizeMapping=''; var adId; var gptPOS; var gptMasterPage = GPT_CheckForNULL($('#gptPage').val()); if (gptSite == null) { gptSite = GPT_CheckForNULL($('#gptAltSite').val()); if (gptSite == null) { gptSite = GPT_CheckForNULL($(this).data('site')); } } if (gptSite == null) { gptSite = GPT_CheckForNULL($('#gptDefaultSite').val()); } if(gptSite!=null){ adId = 'gpt-ad-' + index + 1; gptPOS = parseInt($(this).data('pos')) || -1; if(gptPOS == -1){ gptPOS = index + 1; } if (gptMasterPage != null) { gptPage = '/' + gptMasterPage; } else { gptPage = GPT_CheckForNULL($(this).data('page')); if (gptPage != null) { gptPage = '/' + gptPage; } else { gptPage = ''; } } //Determine sizemapping based on data-adsize switch($(this).data('adsize')) { case 'cell-leaderboard': adSizeMapping = gptLeaderboardSizeMapping; if(gptPOS==1){ $(this).addClass('GPT-Leaderboard-Cell'); } break; case 'leaderboard': adSizeMapping = gptLeaderboardSizeMapping; $(this).addClass('GPT-Leaderboard'); break; case 'boombox': adSizeMapping = gptBoomBoxSizeMapping; break; case 'skyscraper': if($(this).hasClass("disableStickySidebar")){ adSizeMapping = gptSideBarNotStickySizeMapping; } else{ $(this).addClass('GPT-StickySideBar'); adSizeMapping = gptSideBarSizeMapping; } break; case 'skyscrapernotresponsive': adSizeMapping = gptSideBarNotResponsiveSizeMapping; break; } } //Ignore any invalid adsizes that could be on the page if(adSizeMapping!='') { $(this).addClass('gpt-ad-defined'); $(this).attr('id',adId); gptAdSlots[index] = googletag.defineSlot('/6053/els.' + gptSite + gptPage, [], adId).defineSizeMapping(adSizeMapping).addService(googletag.pubads()).setTargeting("pos", gptPOS); } else { $(this).remove(); } }); //*********************************************** //End detection for ad slots on page //*********************************************** //*********************************************** //Start page level targeting //*********************************************** //Logged in or IP Access gpt_TargetAccessType(); //Check for DFP Test gpt_GetDFPTestId(); //Check for Staging gpt_CheckForStaging(); //Check for Additional Targeting gpt_GetAdditionalTargeting() //*********************************************** //End page level targeting //*********************************************** //Enable google dfp services googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); googletag.enableServices(); //Add Listener for Leaderboard googletag.pubads().addEventListener('slotRenderEnded', function(event) { if (!event.isEmpty) { $('#' + event.slot.getSlotElementId()).closest(".GPT-ad-placeholder").css("display", "block"); //Sticky LeaderBoard JBS if ($('#' + event.slot.getSlotElementId()).hasClass("GPT-Leaderboard")) { if($('#disableStickyLeaderboard').length==0){ $('body').addClass("hasLeaderboard"); // INJECT SOME CSS FOR STICKY LEADERBOARD // THIS INCLUDES CHANGING THE TOP OF THE STICKY HEADER #jbs-fixed-hdr $("body").append("
"); setTimeout(handleStickyLeaderboard, 8000); } } //Sticky LeaderBoard Cell if ($('#' + event.slot.getSlotElementId()).hasClass("GPT-Leaderboard-Cell")) { if($('#disableStickyLeaderboard').length==0){ $("body").append('
'); $("div.cell-top-head").attr("style","display:block !important;"); $("body").append(""); var tmp; tmp = $(".article.enhanced .tab-nav").attr("style"); tmp = "top:110px;" + tmp; $(".article.enhanced .tab-nav").removeAttr("style"); $(".article.enhanced .tab-nav").attr("style",tmp); tmp = $(".article.enhanced #fixedPane").attr("style"); tmp = "top:148px;" + tmp; $(".article.enhanced #fixedPane").removeAttr("style"); $(".article.enhanced #fixedPane").attr("style",tmp); setTimeout(handleStickyLeaderboard_CELL, 8000); } // THE FOLLOWING MAKES SURE THAT THE FIGURES PANE POPULATES // (there might be a bug on the live site) $("li.showFullText a").click(); } //Sticky SideBar if ($('#' + event.slot.getSlotElementId()).hasClass("GPT-StickySideBar")){ if($('#disableStickySidebar').length==0){ enableStickySideBar(); } } } }); //Populate Defined Ad Slots $(".gpt-ad-defined").each(function( index ) { var adId = $(this).attr('id'); googletag.cmd.push(function() {googletag.display(adId);}); }); }); }