Merge pull request #8 from team-melbourne-rgsoc2015/mobile-works

Successful mobile slots - default to 320*50
This commit is contained in:
ladydanger 2015-09-01 10:10:09 +10:00
commit 7f13e0a1fb
2 changed files with 15 additions and 4 deletions

View File

@ -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();

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;
@ -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;