Mobile slots now within htmlSafe

This commit is contained in:
Sarah Ni 2015-08-20 10:58:31 +10:00
parent c566f0c71d
commit 3271acf840
1 changed files with 24 additions and 4 deletions

View File

@ -38,22 +38,42 @@ function loadGoogle(settings) {
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.topic_list_top_ad_sizes) { if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.topic_list_top_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)); const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes));
const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes));
googletag.defineSlot(settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(settings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads()); if (Discourse.Mobile.mobileView) {
googletag.defineSlot(settings.dfp_topic_list_top_code, [320,50], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(settings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
}
} }
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) { if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)); const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes));
const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes));
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads()); if (Discourse.Mobile.mobileView) {
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [320,50], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
}
} }
if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.topic_above_suggested_ad_sizes) { if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.topic_above_suggested_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)); const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes));
const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes));
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads()); if (Discourse.Mobile.mobileView) {
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [320,50], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
}
} }
if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) { if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes)); const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes));
const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes)); const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes));
googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(splitWidthInt(settings.post_bottom_ad_sizes)), parseInt(splitHeightInt(settings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads()); if (Discourse.Mobile.mobileView) {
googletag.defineSlot(settings.dfp_post_bottom_code, [320,50], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(splitWidthInt(settings.post_bottom_ad_sizes)), parseInt(splitHeightInt(settings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
}
} }
googletag.pubads().enableSingleRequest(); googletag.pubads().enableSingleRequest();
googletag.enableServices(); googletag.enableServices();