From 8989d9c5ea8143fd07ec34c28c2c1b14de2b0ecd Mon Sep 17 00:00:00 2001 From: Sarah Ni Date: Mon, 31 Aug 2015 13:49:09 +1000 Subject: [PATCH] fixed up with Jo's help setTargeting base method --- .../discourse/components/google-dfp-ad.js.es6 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index 0d9e10b..7b4f6a3 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -39,19 +39,20 @@ function keyParse(word) { } // This sets the key and value for custom targeting -var Foo = function(key, value) { +var Foo = function(key, value, googletag) { this.locationKey = key; this.locationValue = value; + this.googletag = googletag; } // setTargeting is not defined. We want to return as a method - PROBLEM 1 Foo.prototype.bar = function() { - return setTargeting((this.locationKey), (this.locationValue)); + return googletag.setTargeting((this.locationKey), (this.locationValue)); } // This should call googletag.setTargeting(key for that location, value for that location) -var googletag = new Foo(keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code), valueParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code)); -googletag.bar(); +var f = new Foo(keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code), valueParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code), googletag); +f.bar(); // END of Coaches Note