Merged and added dropdown
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
import loadScript from 'discourse/lib/load-script';
|
||||
|
||||
const const_width = 300;
|
||||
const const_height = 250;
|
||||
var const_width = '';
|
||||
var const_height = '';
|
||||
|
||||
var _loaded = false,
|
||||
_promise = null;
|
||||
|
||||
|
||||
function splitWidthInt(value) {
|
||||
var str = value.substring(0, 3);
|
||||
return str.trim();
|
||||
}
|
||||
|
||||
function splitHeightInt(value) {
|
||||
var str = value.substring(4, 7);
|
||||
return str.trim();
|
||||
}
|
||||
|
||||
function loadGoogle(settings) {
|
||||
if (_loaded) {
|
||||
return Ember.RSVP.resolve();
|
||||
@@ -26,17 +36,25 @@ function loadGoogle(settings) {
|
||||
|
||||
// Define our ad units - extend for mobile view.
|
||||
googletag.cmd.push(function() {
|
||||
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top) {
|
||||
googletag.defineSlot(settings.dfp_topic_list_top_code, [parseInt(settings.dfp_size_topic_list_top_width_code), parseInt(settings.dfp_size_topic_list_top_height_code)], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
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_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 (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream) {
|
||||
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(settings.dfp_size_topic_above_post_stream_width_code), parseInt(settings.dfp_size_topic_above_post_stream_height_code)], 'div-gpt-ad-topic-above-post-stream').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) {
|
||||
const_width = parseInt(splitWidthInt(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 (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested) {
|
||||
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(settings.dfp_size_topic_above_suggested_width_code), parseInt(settings.dfp_size_topic_above_suggested_height_code)], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
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_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 (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom) {
|
||||
googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(settings.dfp_size_post_bottom_width_code), parseInt(settings.dfp_size_post_bottom_height_code)], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
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_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());
|
||||
}
|
||||
googletag.pubads().enableSingleRequest();
|
||||
googletag.enableServices();
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
{{#if postSpecificCount}}
|
||||
{{google-dfp-ad placement="post-bottom"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user