From e3dded27d9c004633ba6a45fb7a3c152a77bab31 Mon Sep 17 00:00:00 2001 From: vi Date: Fri, 28 Aug 2015 15:25:11 +1000 Subject: [PATCH] how to approach the .setTargeting issue --- .../discourse/components/google-dfp-ad.js.es6 | 19 +++++++++++++++++-- .../initializers/extend-post-model.js.es6 | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index f4e0be3..4ac5b76 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -78,9 +78,24 @@ function loadGoogle(settings) { } else { googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + 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') - .setTargeting(settings.dfp_target_topic_above_suggested_key_code, valueParse(settings.dfp_target_topic_above_suggested_value_code)) + + googletag.setTargeting(settings.dfp_target_topic_above_suggested_key_code, valueParse(settings.dfp_target_topic_above_suggested_value_code)) // This hardcoded code works: .setTargeting('category', ["clothes", "handbags", "makeup"]) - .addService(googletag.pubads()); + googletag.addService(googletag.pubads()); + + + var Foo = function() {} + Foo.prototype.bar = function() { + // Stuff + return this; + } + + var f = new Foo(); + f.bar().bar().bar(); + f.bar(); + f.bar(); + f.bar(); + } } if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) { diff --git a/assets/javascripts/initializers/extend-post-model.js.es6 b/assets/javascripts/initializers/extend-post-model.js.es6 index 053035d..22f911d 100644 --- a/assets/javascripts/initializers/extend-post-model.js.es6 +++ b/assets/javascripts/initializers/extend-post-model.js.es6 @@ -9,7 +9,7 @@ export default { }.property('post_number'), postSpecificCountAdsense: function() { - return this.get('post_number') === parseInt(Discourse.SiteSettings.adsense_nth_post_code); + return this.get('post_number') === parseInt(Discourse.SiteSettings.adsense_nth_post_code); }.property('post_number'), }); }