Potential impact of implementing and scaling up harm reduction and antiretroviral therapy on HIV prevalence and …


“);
}
}

//Check for Disable on Querystring for leaderboard
var 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([992, 0], [[970, 90], [728, 90]]). // Desktop
addSize([768, 0], [[728, 90]]). // Tablet Landscape
addSize([0, 0], [[320, 50], [300, 50]]). // Phone & Tablet Portrait
build();

if ($(“#jbs-fixed-hdr”).length!=0){
//Download Bar Exists
var gptSideBarSizeMapping = googletag.sizeMapping().
addSize([768, 680], [[300, 600], [160, 600], [120, 600]]). // SkyScraper – Desktop (Require min 680 vertical)
addSize([768, 330], [[300, 250]]). // BoomBox Fall Back – Desktop (Require min 330 vertical)
addSize([0, 0], []). // Phone
build();
}
else{
//Download Bar does not exist
var gptSideBarSizeMapping = googletag.sizeMapping().
addSize([768, 630], [[300, 600], [160, 600], [120, 600]]). // SkyScraper – Desktop (Require min 630 vertical)
addSize([768, 280], [[300, 250]]). // BoomBox Fall Back – Desktop (Require min 280 vertical)
addSize([0, 0], []). // Phone
build();
}

var gptSideBarNotStickySizeMapping = googletag.sizeMapping().
addSize([768, 400], [[300, 600], [160, 600], [120, 600]]). // SkyScraper Not Sticky (Require min 400 vertical)
addSize([768, 160], [[300, 250]]). // BoomBox Fall Back – Desktop (Require min 160 vertical)
addSize([0, 0], []). // Phone
build();

var gptBoomBoxSizeMapping = googletag.sizeMapping().
addSize([768, 0], [[300, 250], [336,280]]). // Desktop & Tablet Landscape
addSize([0, 0], []). // Phone
build();

//***********************************************
//End Define Size mapping based on client Viewport
//***********************************************

//***********************************************
//Start detection for ad slots on page
//***********************************************
$(“.gpt-ad”).each(function( index )
{
var gptSite = $(‘#gptSite’).val();
var gptPage = ”;
var adSizeMapping=”;
var adId;
var gptPOS;

if (gptSite == “”) {
gptSite = $(this).data(‘site’);
}
if(typeof gptSite!=”undefined”){
adId = ‘gpt-ad-‘ + index + 1;

gptPOS = parseInt($(this).data(‘pos’)) || -1;
if(gptPOS == -1){
gptPOS = index + 1;
}
gptPage = $(this).data(‘page’);
if(typeof gptPage!=”undefined”){
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;
}
}

//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
//***********************************************
gpt_Target(“LoggedIn”);
gpt_Target(“PII”);

//Check for DFP Test
gpt_GetDFPTestId();

//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);});
});

});
}



Source link

Leave a Reply

Your email address will not be published.