Don't hard-code center justify of AdSense ads. Let position be customized with CSS.

This commit is contained in:
Neil Lalonde 2016-04-04 16:51:34 -04:00
parent c0361c0e90
commit ef45e3290e
3 changed files with 8 additions and 4 deletions

View File

@ -115,7 +115,7 @@ export default Ember.Component.extend({
}, },
adWrapperStyle: function() { adWrapperStyle: function() {
return `width: ${this.get('ad_width')}px; height: ${this.get('ad_height')}px; margin:0 auto;`.htmlSafe(); return `width: ${this.get('ad_width')}px; height: ${this.get('ad_height')}px;`.htmlSafe();
}.property('ad_width', 'ad_height'), }.property('ad_width', 'ad_height'),
adInsStyle: function() { adInsStyle: function() {
@ -123,7 +123,7 @@ export default Ember.Component.extend({
}.property('adWrapperStyle'), }.property('adWrapperStyle'),
adWrapperStyleMobile: function() { adWrapperStyleMobile: function() {
return `width: ${this.get('ad_mobile_width')}px; height: ${this.get('ad_mobile_height')}px; margin:0 auto;`.htmlSafe(); return `width: ${this.get('ad_mobile_width')}px; height: ${this.get('ad_mobile_height')}px;`.htmlSafe();
}.property('ad_mobile_width', 'ad_mobile_height'), }.property('ad_mobile_width', 'ad_mobile_height'),
adTitleStyleMobile: function() { adTitleStyleMobile: function() {

View File

@ -1,7 +1,7 @@
{{#if checkTrustLevels}} {{#if checkTrustLevels}}
{{#if site.mobileView}} {{#if site.mobileView}}
<div class="google-adsense-label" style={{adTitleStyleMobile}}><h2>ADVERTISEMENT</h2></div> <div class="google-adsense-label" style={{adTitleStyleMobile}}><h2>ADVERTISEMENT</h2></div>
<div style={{adWrapperStyleMobile}}> <div class="google-adsense-content" style={{adWrapperStyleMobile}}>
<ins class="adsbygoogle" <ins class="adsbygoogle"
style={{adInsStyleMobile}} style={{adInsStyleMobile}}
data-ad-client="ca-pub-{{publisher_id}}" data-ad-client="ca-pub-{{publisher_id}}"
@ -14,7 +14,7 @@
</div> </div>
{{else}} {{else}}
<div class="google-adsense-label"><h2>ADVERTISEMENT</h2></div> <div class="google-adsense-label"><h2>ADVERTISEMENT</h2></div>
<div style={{adWrapperStyle}}> <div class="google-adsense-content" style={{adWrapperStyle}}>
<ins class="adsbygoogle" <ins class="adsbygoogle"
style={{adInsStyle}} style={{adInsStyle}}
data-ad-client="ca-pub-{{publisher_id}}" data-ad-client="ca-pub-{{publisher_id}}"

View File

@ -63,6 +63,10 @@ register_css <<CSS
font-weight: normal; font-weight: normal;
} }
.google-adsense .google-adsense-content {
margin: 0 auto;
}
.google-dfp-ad .google-dfp-ad-label { .google-dfp-ad .google-dfp-ad-label {
width: 728px; width: 728px;
margin: 0 auto; margin: 0 auto;