diff --git a/assets/javascripts/discourse/components/google-adsense.js.es6 b/assets/javascripts/discourse/components/google-adsense.js.es6 index 74e5a1d..db946f7 100644 --- a/assets/javascripts/discourse/components/google-adsense.js.es6 +++ b/assets/javascripts/discourse/components/google-adsense.js.es6 @@ -6,6 +6,8 @@ var ad_code = ''; var publisher_id = Discourse.SiteSettings.adsense_publisher_code; var preGoogleVars = null; var postGoogleVars = null; +var mobile_width = 320; +var mobile_height = 50; function splitWidthInt(value) { @@ -99,6 +101,9 @@ export default Ember.Component.extend({ ad_width: ad_width, ad_height: ad_height, + mobile_width: mobile_width, + mobile_height: mobile_height, + init: function() { this.set('ad_width', data[this.placement]["ad_width"] ); this.set('ad_height', data[this.placement]["ad_height"] ); @@ -115,8 +120,8 @@ export default Ember.Component.extend({ }.property('adWrapperStyle'), adWrapperStyleMobile: function() { - return `width: 320px; height: 50px; margin:0 auto;`.htmlSafe(); - }, + return `width: ${this.get('mobile_width')}px; height: ${this.get('mobile_height')}px; margin:0 auto;`.htmlSafe(); + }.property('mobile_width', 'mobile_height'), adInsStyleMobile: function() { return `display: inline-block; ${this.get('adWrapperStyleMobile')}`.htmlSafe(); diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index 80db160..6b55990 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -4,6 +4,9 @@ import loadScript from 'discourse/lib/load-script'; var const_width = ''; var const_height = ''; +var mobile_width = 320; +var mobile_height = 50; + var _loaded = false, _promise = null; @@ -163,6 +166,9 @@ export default Ember.Component.extend({ classNames: ['google-dfp-ad'], loadedGoogletag: false, + mobile_width: mobile_width, + mobile_height: mobile_height, + // Part of the divID of the div part of the GPT divId: function() { return "div-gpt-ad-" + this.get('placement'); @@ -173,8 +179,8 @@ export default Ember.Component.extend({ }.property('const_width', 'const_height'), adWrapperStyleMobile: function() { - return `width: 320px; height: 50px;`.htmlSafe(); - }, + return `width: ${this.get('mobile_width')}px; height: ${this.get('mobile_height')}px; margin:0 auto;`.htmlSafe(); + }.property('mobile_width', 'mobile_height'), _initGoogleDFP: function() { var self = this;