Successful mobile slots - default to 320*50

This commit is contained in:
Sarah Ni 2015-08-28 15:34:14 +10:00
parent f94bf79192
commit 6d93faf871
2 changed files with 15 additions and 4 deletions

View File

@ -8,6 +8,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) {
@ -101,6 +103,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"] );
@ -117,8 +122,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();

View File

@ -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;
@ -115,6 +118,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');
@ -125,8 +131,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;