Prettier
This commit is contained in:
parent
19f0457e8c
commit
51c1b89a62
|
@ -1,5 +1,8 @@
|
|||
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
|
||||
import { default as computed, observes } from "ember-addons/ember-computed-decorators";
|
||||
import {
|
||||
default as computed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
|
||||
const publisherId = Discourse.SiteSettings.adbutler_publisher_id;
|
||||
|
@ -18,7 +21,9 @@ function loadAdbutler() {
|
|||
return _promise;
|
||||
}
|
||||
|
||||
_promise = loadScript('https://' + adserverHostname + '/app.js', { scriptTag: true }).then(function() {
|
||||
_promise = loadScript("https://" + adserverHostname + "/app.js", {
|
||||
scriptTag: true
|
||||
}).then(function() {
|
||||
_loaded = true;
|
||||
});
|
||||
|
||||
|
@ -26,34 +31,33 @@ function loadAdbutler() {
|
|||
}
|
||||
|
||||
export default AdComponent.extend({
|
||||
|
||||
divs: null,
|
||||
|
||||
init() {
|
||||
let dimensions = [728,90];
|
||||
let configKey = 'adbutler_';
|
||||
let className = 'adbutler-';
|
||||
let dimClassName = 'adbutler-ad';
|
||||
let dimensions = [728, 90];
|
||||
let configKey = "adbutler_";
|
||||
let className = "adbutler-";
|
||||
let dimClassName = "adbutler-ad";
|
||||
|
||||
this.set('divs', []);
|
||||
this.set("divs", []);
|
||||
|
||||
if (this.site.mobileView) {
|
||||
dimensions = [320,50];
|
||||
configKey += 'mobile_';
|
||||
className += 'mobile-';
|
||||
dimClassName = 'adbutler-mobile-ad';
|
||||
dimensions = [320, 50];
|
||||
configKey += "mobile_";
|
||||
className += "mobile-";
|
||||
dimClassName = "adbutler-mobile-ad";
|
||||
}
|
||||
|
||||
configKey += this.get("placement").replace(/-/g, '_') + '_zone_id';
|
||||
configKey += this.get("placement").replace(/-/g, "_") + "_zone_id";
|
||||
this.set("configKey", configKey);
|
||||
|
||||
className += this.get("placement");
|
||||
this.set("className", className + ' ' + dimClassName);
|
||||
this.set("className", className + " " + dimClassName);
|
||||
|
||||
let zoneId = this.siteSettings[configKey];
|
||||
this.set("zoneId", zoneId);
|
||||
|
||||
let divId = 'placement-' + zoneId + '-' + _c;
|
||||
let divId = "placement-" + zoneId + "-" + _c;
|
||||
this.set("divId", divId);
|
||||
_c++;
|
||||
this.divs.push({
|
||||
|
@ -68,17 +72,30 @@ export default AdComponent.extend({
|
|||
},
|
||||
|
||||
_triggerAds() {
|
||||
loadAdbutler().then(function() {
|
||||
if(this.divs.length > 0) {
|
||||
let abkw = window.abkw || '';
|
||||
loadAdbutler().then(
|
||||
function() {
|
||||
if (this.divs.length > 0) {
|
||||
let abkw = window.abkw || "";
|
||||
AdButler.ads.push({
|
||||
handler: function(opt){
|
||||
AdButler.register(opt.place.publisherId, opt.place.zoneId, opt.place.dimensions, opt.place.divId, opt);
|
||||
handler: function(opt) {
|
||||
AdButler.register(
|
||||
opt.place.publisherId,
|
||||
opt.place.zoneId,
|
||||
opt.place.dimensions,
|
||||
opt.place.divId,
|
||||
opt
|
||||
);
|
||||
},
|
||||
opt: { place: this.divs.pop(), keywords: abkw, domain: adserverHostname, click:'CLICK_MACRO_PLACEHOLDER' }
|
||||
opt: {
|
||||
place: this.divs.pop(),
|
||||
keywords: abkw,
|
||||
domain: adserverHostname,
|
||||
click: "CLICK_MACRO_PLACEHOLDER"
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
@ -108,7 +125,7 @@ export default AdComponent.extend({
|
|||
"showToTrustLevel",
|
||||
"showToGroups",
|
||||
"showAfterPost",
|
||||
"showOnCurrentPage",
|
||||
"showOnCurrentPage"
|
||||
)
|
||||
showAd(showToTrustLevel, showToGroups, showAfterPost, showOnCurrentPage) {
|
||||
return (
|
||||
|
@ -127,5 +144,4 @@ export default AdComponent.extend({
|
|||
}
|
||||
return this.isNthPost(parseInt(this.siteSettings.adbutler_nth_post));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -248,7 +248,8 @@
|
|||
height: 50px;
|
||||
}
|
||||
|
||||
.adbutler-topic-list-top, .adbutler-topic-above-suggested {
|
||||
.adbutler-topic-list-top,
|
||||
.adbutler-topic-above-suggested {
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -261,7 +262,6 @@
|
|||
margin: 10px 0px 10px 56px;
|
||||
}
|
||||
|
||||
|
||||
.adplugin-mgmt {
|
||||
.house-ads-actions {
|
||||
.btn {
|
||||
|
|
Loading…
Reference in New Issue