FIX: HTMLBars doesn't allow `<SCRIPT>` tags

This commit is contained in:
Robin Ward 2016-11-08 16:46:09 -05:00
parent dee247d0fd
commit a70491c720
2 changed files with 11 additions and 9 deletions

View File

@ -106,7 +106,7 @@ export default Ember.Component.extend({
mobile_width: mobile_width,
mobile_height: mobile_height,
init: function() {
init() {
this.set('ad_width', data[this.placement]["ad_width"] );
this.set('ad_height', data[this.placement]["ad_height"] );
this.set('ad_code', data[this.placement]["ad_code"] );
@ -114,6 +114,16 @@ export default Ember.Component.extend({
this._super();
},
_triggerAds() {
const adsbygoogle = window.adsbygoogle || [];
adsbygoogle.push({});
},
didInsertElement() {
this._super();
Ember.run.scheduleOnce('afterRender', this, this._triggerAds);
},
adWrapperStyle: function() {
return `width: ${this.get('ad_width')}px; height: ${this.get('ad_height')}px;`.htmlSafe();
}.property('ad_width', 'ad_height'),

View File

@ -7,10 +7,6 @@
data-ad-client="ca-pub-{{publisher_id}}"
data-ad-slot={{ad_mobile_code}}>
</ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
{{else}}
<div class="google-adsense-label"><h2>ADVERTISEMENT</h2></div>
@ -20,10 +16,6 @@
data-ad-client="ca-pub-{{publisher_id}}"
data-ad-slot={{ad_code}}>
</ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
{{/if}}
{{/if}}