diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index acb92f5..a4f5f5f 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -3,6 +3,7 @@ import loadScript from 'discourse/lib/load-script'; var const_width = ''; var const_height = ''; +var currentUser = Discourse.User.current(); var _loaded = false, _promise = null; @@ -91,7 +92,7 @@ function loadGoogle(settings) { } googletag.cmd.push(function() { - 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 && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.dfp_through_trust_level))) { const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes)); if (Discourse.Mobile.mobileView) { @@ -99,11 +100,12 @@ function loadGoogle(settings) { } else { googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + 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') - custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code))) - googletag.addService(googletag.pubads()); + .setTargeting('gender', ['female']) + //custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code))) + .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 && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.dfp_through_trust_level))) { const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes)); if (Discourse.Mobile.mobileView) { @@ -116,7 +118,7 @@ function loadGoogle(settings) { .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 && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.dfp_through_trust_level))) { const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)); const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes)); if (Discourse.Mobile.mobileView) { @@ -130,7 +132,7 @@ function loadGoogle(settings) { googletag.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 && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.dfp_through_trust_level))) { const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes)); const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes)); if (Discourse.Mobile.mobileView) { diff --git a/assets/javascripts/discourse/templates/components/google-dfp-ad.hbs b/assets/javascripts/discourse/templates/components/google-dfp-ad.hbs index 486c4b0..ca96b4c 100755 --- a/assets/javascripts/discourse/templates/components/google-dfp-ad.hbs +++ b/assets/javascripts/discourse/templates/components/google-dfp-ad.hbs @@ -1,5 +1,3 @@ -
- {{#if site.mobileView}} {{#if loadedGoogletag}}