Added working product links
This commit is contained in:
parent
b4f177d947
commit
cc2572e3f1
|
@ -1,14 +1,11 @@
|
||||||
var amazon_code = '';
|
|
||||||
var amazon_width = '';
|
var amazon_width = '';
|
||||||
var amazon_height = '';
|
var amazon_height = '';
|
||||||
var amazon_mobile_width = 320;
|
var mobile_amazon_width = '';
|
||||||
var amazon_mobile_height = 50;
|
var mobile_amazon_height = '';
|
||||||
var user_input = '';
|
var user_input = '';
|
||||||
|
var user_input_mobile = '';
|
||||||
var currentUser = Discourse.User.current();
|
var currentUser = Discourse.User.current();
|
||||||
var product_type = 'Product/Easy Banner Link';
|
var product_type = 'Product/Easy Banner Link';
|
||||||
var custom_type = 'Native Shopping Ad - Recommended';
|
|
||||||
var recommended_type = 'Native Shopping Ad - Custom';
|
|
||||||
var search_type = 'Native Shopping Ad - Search';
|
|
||||||
|
|
||||||
function splitWidthInt(value) {
|
function splitWidthInt(value) {
|
||||||
var str = value.substring(0, 3);
|
var str = value.substring(0, 3);
|
||||||
|
@ -20,62 +17,108 @@ function splitHeightInt(value) {
|
||||||
return str.trim();
|
return str.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Discourse.SiteSettings.amazon_topic_list_top_src_code) {
|
var data = {
|
||||||
if (Discourse.SiteSettings.amazon_topic_list_top_ad_category === 'Product/Easy Banner Link' && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level))) {
|
"topic-list-top" : {},
|
||||||
user_input = Discourse.SiteSettings.amazon_topic_list_top_src_code;
|
"topic-above-post-stream" : {},
|
||||||
amazon_width = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_width_code);
|
"topic-above-suggested" : {},
|
||||||
amazon_height = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_height_code);
|
"post-bottom" : {}
|
||||||
}
|
|
||||||
//if (Discourse.Mobile.mobileView && Discourse.SiteSettings.adsense_mobile_topic_list_top_code) {
|
|
||||||
// data["topic-list-top"]["ad_mobile_code"] = Discourse.SiteSettings.adsense_mobile_topic_list_top_code;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Discourse.SiteSettings.amazon_topic_list_top_ad_category === "Native Shopping Ad - Recommended") {
|
|
||||||
user_input = Discourse.SiteSettings.amazon_topic_list_top_src_code;
|
if (Discourse.SiteSettings.amazon_topic_list_top_ad_category === 'Product/Easy Banner Link' && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level))) {
|
||||||
|
if (!Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_topic_list_top_src_code) {
|
||||||
|
data["topic-list-top"]["user_input"] = Discourse.SiteSettings.amazon_topic_list_top_src_code;
|
||||||
|
data["topic-list-top"]["amazon_width"] = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_width_code);
|
||||||
|
data["topic-list-top"]["amazon_height"] = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_mobile_topic_list_top_src_code) {
|
||||||
|
data["topic-list-top"]["user_input_mobile"] = Discourse.SiteSettings.amazon_mobile_topic_list_top_src_code;
|
||||||
|
data["topic-list-top"]["mobile_amazon_width"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_width_code);
|
||||||
|
data["topic-list-top"]["mobile_amazon_height"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_topic_above_post_stream_src_code) {
|
||||||
|
data["topic-above-post-stream"]["user_input"] = Discourse.SiteSettings.amazon_topic_above_post_stream_src_code;
|
||||||
|
data["topic-above-post-stream"]["amazon_width"] = parseInt(Discourse.SiteSettings.amazon_topic_above_post_stream_ad_width_code);
|
||||||
|
data["topic-above-post-stream"]["amazon_height"] = parseInt(Discourse.SiteSettings.amazon_topic_above_post_stream_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_src_code) {
|
||||||
|
data["topic-above-post-stream"]["user_input_mobile"] = Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_src_code;
|
||||||
|
data["topic-above-post-stream"]["mobile_amazon_width"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_width_code);
|
||||||
|
data["topic-above-post-stream"]["mobile_amazon_height"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_topic_above_suggested_src_code) {
|
||||||
|
data["topic-above-suggested"]["user_input"] = Discourse.SiteSettings.amazon_topic_above_suggested_src_code;
|
||||||
|
data["topic-above-suggested"]["amazon_width"] = parseInt(Discourse.SiteSettings.amazon_topic_above_suggested_ad_width_code);
|
||||||
|
data["topic-above-suggested"]["amazon_height"] = parseInt(Discourse.SiteSettings.amazon_topic_above_suggested_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_mobile_topic_above_sugggested_src_code) {
|
||||||
|
data["topic-above-suggested"]["user_input_mobile"] = Discourse.SiteSettings.amazon_mobile_topic_above_suggested_src_code;
|
||||||
|
data["topic-above-suggested"]["mobile_amazon_width"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_width_code);
|
||||||
|
data["topic-above-suggested"]["mobile_amazon_height"] = parseInt(Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_post_bottom_src_code) {
|
||||||
|
data["post-bottom"]["user_input"] = Discourse.SiteSettings.amazon_post_bottom_src_code;
|
||||||
|
data["post-bottom"]["amazon_width"] = parseInt(Discourse.SiteSettings.amazon_post_bottom_ad_width_code);
|
||||||
|
data["post-bottom"]["amazon_height"] = parseInt(Discourse.SiteSettings.amazon_post_bottom_ad_height_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Discourse.Mobile.mobileView && Discourse.SiteSettings.amazon_mobile_post_bottom_src_code) {
|
||||||
|
data["post-bottom"]["user_input_mobile"] = Discourse.SiteSettings.amazon_mobile_post_bottom_src_code;
|
||||||
|
data["post-bottom"]["mobile_amazon_width"] = parseInt(Discourse.SiteSettings.amazon_mobile_post_bottom_ad_width_code);
|
||||||
|
data["post-bottom"]["mobile_amazon_height"] = parseInt(Discourse.SiteSettings.amazon_mobile_post_bottom_ad_height_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* amazon_tracking_id_code: "Choose Tracking ID Code"
|
|
||||||
amazon_region_code: "Choose the Generic Amazon Marketplace Region"
|
// amazon_nth_post_code: "Choose the Nth position for your ad to show"
|
||||||
amazon_topic_list_top_src_code: "Input your Src code"
|
// amazon_through_trust_level: "Input trust level" */
|
||||||
amazon_topic_list_top_title_code: "Input your Ad Description"
|
|
||||||
amazon_topic_list_top_ad_width_code: "Choose your ad width"
|
|
||||||
amazon_topic_list_top_ad_height_code: "Choose your ad height"
|
|
||||||
amazon_topic_list_top_custom_product_id_code: "Input relevant ad codes"
|
|
||||||
amazon_topic_list_top_link_id_code: "Input your Link ID"
|
|
||||||
amazon_topic_list_top_ad_mode_code: "Choose either manual (custom), auto (recommended), search (search)"
|
|
||||||
amazon_topic_list_top_fallback_mode_value_code: "Input value that corresponds to type: search"
|
|
||||||
amazon_topic_list_top_row_ads_code: "Input number of ad display rows"
|
|
||||||
amazon_topic_list_top_default_category_code: "Input default category"
|
|
||||||
amazon_topic_list_top_search_phrase_code: "Input search phrase"
|
|
||||||
amazon_nth_post_code: "Choose the Nth position for your ad to show"
|
|
||||||
amazon_through_trust_level: "Input trust level" */
|
|
||||||
|
|
||||||
// Ember component - the class is the adblock and css
|
// Ember component - the class is the adblock and css
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
amazon_width: amazon_width,
|
amazon_width: amazon_width,
|
||||||
amazon_height: amazon_height,
|
amazon_height: amazon_height,
|
||||||
amazon_mobile_width: amazon_mobile_width,
|
mobile_amazon_width: mobile_amazon_width,
|
||||||
amazon_mobile_height: amazon_mobile_height,
|
mobile_amazon_height: mobile_amazon_height,
|
||||||
user_input: user_input,
|
user_input: user_input,
|
||||||
|
user_input_mobile: user_input_mobile,
|
||||||
product_type: product_type,
|
product_type: product_type,
|
||||||
recommended_type: recommended_type,
|
// recommended_type: recommended_type,
|
||||||
search_type: search_type,
|
// search_type: search_type,
|
||||||
custom_type: custom_type,
|
// custom_type: custom_type,
|
||||||
|
|
||||||
classNames: ['amazon-product-links'],
|
classNames: ['amazon-product-links'],
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this.set('user_input', data[this.placement]["user_input"] );
|
||||||
|
this.set('amazon_width', data[this.placement]["amazon_width"] );
|
||||||
|
this.set('amazon_height', data[this.placement]["amazon_height"] );
|
||||||
|
this.set('user_input_mobile', data[this.placement]["user_input_mobile"] );
|
||||||
|
this.set('mobile_amazon_height', data[this.placement]["mobile_amazon_height"] );
|
||||||
|
this.set('mobile_amazon_width', data[this.placement]["mobile_amazon_width"] );
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
|
||||||
adWrapperStyle: function() {
|
adWrapperStyle: function() {
|
||||||
return `width: ${this.get('amazon_width')}px; height: ${this.get('amazon_height')}px;`.htmlSafe();
|
return `width: ${this.get('amazon_width')}px; height: ${this.get('amazon_height')}px;`.htmlSafe();
|
||||||
}.property('amazon_width', 'amazon_height'),
|
}.property('amazon_width', 'amazon_height'),
|
||||||
|
|
||||||
adWrapperStyleMobile: function() {
|
adWrapperStyleMobile: function() {
|
||||||
return `width: ${this.get('amazon_mobile_width')}px; height: ${this.get('amazon_mobile_height')}px;`.htmlSafe();
|
return `width: ${this.get('mobile_amazon_width')}px; height: ${this.get('mobile_amazon_height')}px;`.htmlSafe();
|
||||||
}.property('amazon_mobile_width', 'amazon_mobile_height'),
|
}.property('mobile_amazon_width', 'mobile_amazon_height'),
|
||||||
|
|
||||||
userInput: function() {
|
userInput: function() {
|
||||||
return `${this.get('user_input')}`.htmlSafe();
|
return `${this.get('user_input')}`.htmlSafe();
|
||||||
}.property('user_input'),
|
}.property('user_input'),
|
||||||
|
|
||||||
|
userInputMobile: function() {
|
||||||
|
return `${this.get('user_input_mobile')}`.htmlSafe();
|
||||||
|
}.property('user_input_mobile'),
|
||||||
|
|
||||||
checkTrustLevels: function() {
|
checkTrustLevels: function() {
|
||||||
return !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level));
|
return !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level));
|
||||||
}.property('trust_level'),
|
}.property('trust_level'),
|
||||||
|
@ -84,15 +127,15 @@ export default Ember.Component.extend({
|
||||||
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('product_type');
|
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('product_type');
|
||||||
}.property('product_type'),
|
}.property('product_type'),
|
||||||
|
|
||||||
typeRecommendedCategory: function() {
|
// typeRecommendedCategory: function() {
|
||||||
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('recommended_type');
|
// return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('recommended_type');
|
||||||
}.property('recommended_type'),
|
// }.property('recommended_type'),
|
||||||
|
|
||||||
typeSearchCategory: function() {
|
// typeSearchCategory: function() {
|
||||||
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('search_type');
|
// return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('search_type');
|
||||||
}.property('search_type'),
|
// }.property('search_type'),
|
||||||
|
|
||||||
typeCustomCategory: function() {
|
// typeCustomCategory: function() {
|
||||||
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('custom_type');
|
// return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('custom_type');
|
||||||
}.property('custom_type'),
|
// }.property('custom_type'),
|
||||||
});
|
});
|
|
@ -4,3 +4,6 @@
|
||||||
{{#if postSpecificCountDFP}}
|
{{#if postSpecificCountDFP}}
|
||||||
{{google-dfp-ad placement="post-bottom"}}
|
{{google-dfp-ad placement="post-bottom"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if postSpecificCountAmazon}}
|
||||||
|
{{amazon-product-links placement="post-bottom"}}
|
||||||
|
{{/if}}
|
|
@ -4,3 +4,6 @@
|
||||||
{{#if siteSettings.dfp_topic_above_post_stream_code}}
|
{{#if siteSettings.dfp_topic_above_post_stream_code}}
|
||||||
{{google-dfp-ad placement="topic-above-post-stream"}}
|
{{google-dfp-ad placement="topic-above-post-stream"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if siteSettings.amazon_topic_above_post_stream_src_code}}
|
||||||
|
{{amazon-product-links placement="topic-above-post-stream"}}
|
||||||
|
{{/if}}
|
|
@ -4,3 +4,6 @@
|
||||||
{{#if siteSettings.dfp_topic_above_suggested_code}}
|
{{#if siteSettings.dfp_topic_above_suggested_code}}
|
||||||
{{google-dfp-ad placement="topic-above-suggested"}}
|
{{google-dfp-ad placement="topic-above-suggested"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if siteSettings.amazon_topic_above_suggested_src_code}}
|
||||||
|
{{amazon-product-links placement="topic-above-suggested"}}
|
||||||
|
{{/if}}
|
|
@ -3,6 +3,6 @@ en:
|
||||||
admin:
|
admin:
|
||||||
site_settings:
|
site_settings:
|
||||||
categories:
|
categories:
|
||||||
dfp_plugin: 'DFP Plugin'
|
dfp_plugin: 'DFP'
|
||||||
adsense_plugin: 'Adsense Plugin'
|
adsense_plugin: 'Adsense'
|
||||||
amazon_plugin: 'Amazon Plugin'
|
amazon_plugin: 'Amazon Links/Banners'
|
|
@ -62,3 +62,24 @@ en:
|
||||||
amazon_topic_list_top_search_phrase_code: "Input search phrase"
|
amazon_topic_list_top_search_phrase_code: "Input search phrase"
|
||||||
amazon_nth_post_code: "Choose the Nth position for your ad to show"
|
amazon_nth_post_code: "Choose the Nth position for your ad to show"
|
||||||
amazon_through_trust_level: "Input trust level"
|
amazon_through_trust_level: "Input trust level"
|
||||||
|
amazon_mobile_topic_list_top_src_code: "Input your Src code (Mobile)"
|
||||||
|
amazon_mobile_topic_list_top_ad_width_code: "Choose your ad width (Mobile)"
|
||||||
|
amazon_mobile_topic_list_top_ad_height_code: "Choose your ad height (Mobile)"
|
||||||
|
amazon_topic_above_post_stream_src_code: "Input your Src code"
|
||||||
|
amazon_topic_above_post_stream_ad_width_code: "Choose your ad width"
|
||||||
|
amazon_topic_above_post_stream_ad_height_code: "Choose your ad height"
|
||||||
|
amazon_mobile_topic_above_post_stream_src_code: "Input your Src code (Mobile)"
|
||||||
|
amazon_mobile_topic_above_post_stream_ad_width_code: "Choose your ad width (Mobile)"
|
||||||
|
amazon_mobile_topic_above_post_stream_ad_height_code: "Choose your ad height (Mobile)"
|
||||||
|
amazon_topic_above_suggested_src_code: "Input your Src code"
|
||||||
|
amazon_topic_above_suggested_ad_width_code: "Choose your ad width"
|
||||||
|
amazon_topic_above_suggested_ad_height_code: "Choose your ad height"
|
||||||
|
amazon_mobile_topic_above_suggested_src_code: "Input your Src code (Mobile)"
|
||||||
|
amazon_mobile_topic_above_suggested_ad_width_code: "Choose your ad width (Mobile)"
|
||||||
|
amazon_mobile_topic_above_suggested_ad_height_code: "Choose your ad height (Mobile)"
|
||||||
|
amazon_post_bottom_src_code: "Input your Src code"
|
||||||
|
amazon_post_bottom_ad_width_code: "Choose your ad width"
|
||||||
|
amazon_post_bottom_ad_height_code: "Choose your ad height"
|
||||||
|
amazon_mobile_post_bottom_src_code: "Input your Src code (Mobile)"
|
||||||
|
amazon_mobile_post_bottom_ad_width_code: "Choose your ad width (Mobile)"
|
||||||
|
amazon_mobile_post_bottom_ad_height_code: "Choose your ad height (Mobile)"
|
|
@ -296,6 +296,69 @@ amazon_plugin:
|
||||||
amazon_through_trust_level:
|
amazon_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
|
amazon_mobile_topic_list_top_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_list_top_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_list_top_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_post_stream_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_post_stream_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_post_stream_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_post_stream_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_post_stream_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_post_stream_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_suggested_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_suggested_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_topic_above_suggested_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_suggested_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_suggested_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_topic_above_suggested_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_post_bottom_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
amazon_nth_post_code:
|
amazon_nth_post_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ''
|
||||||
|
amazon_post_bottom_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_post_bottom_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_post_bottom_src_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_post_bottom_ad_width_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
||||||
|
amazon_mobile_post_bottom_ad_height_code:
|
||||||
|
client: true
|
||||||
|
default: ''
|
Loading…
Reference in New Issue