mirror of
https://github.com/discourse/discourse-adplugin.git
synced 2025-07-06 21:32:13 +00:00
master - more consistent naming for dfp settings and removed test folder
This commit is contained in:
parent
8f5c8db352
commit
647eecd95b
@ -39,7 +39,7 @@ PageTracker.current().on('change', function(url) {
|
||||
// Reinitialize script so that the ad can reload
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.id="adsense_loader";
|
||||
ga.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
|
||||
});
|
||||
|
||||
|
@ -76,51 +76,51 @@ function loadGoogle(settings) {
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.topic_list_top_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes));
|
||||
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.dfp_topic_list_top_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.dfp_topic_list_top_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.dfp_topic_list_top_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
var topic_list_top_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_list_top_code, [320,50], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code)), topic_list_top_mobile)
|
||||
}
|
||||
else {
|
||||
var topic_list_top = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
var topic_list_top = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(Discourse.SiteSettings.dfp_topic_list_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.dfp_topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code)), topic_list_top)
|
||||
}
|
||||
}
|
||||
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes));
|
||||
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.dfp_topic_above_post_stream_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.dfp_topic_above_post_stream_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.dfp_topic_above_post_stream_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
var topic_above_post_stream_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_post_stream_code, [320,50], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code)), topic_above_post_stream_mobile)
|
||||
}
|
||||
else {
|
||||
var topic_above_post_stream = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_above_post_stream_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
var topic_above_post_stream = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(Discourse.SiteSettings.dfp_topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.dfp_topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code)), topic_above_post_stream)
|
||||
}
|
||||
}
|
||||
if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.topic_above_suggested_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes));
|
||||
if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.dfp_topic_above_suggested_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.dfp_topic_above_suggested_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.dfp_topic_above_suggested_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
var topic_above_suggested_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_suggested_code, [320,50], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_value_code)), topic_above_suggested_mobile)
|
||||
}
|
||||
else {
|
||||
var topic_above_suggested = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
var topic_above_suggested = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(Discourse.SiteSettings.dfp_topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.dfp_topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_value_code)), topic_above_suggested)
|
||||
}
|
||||
}
|
||||
if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes));
|
||||
if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.dfp_post_bottom_ad_sizes) {
|
||||
const_width = parseInt(splitWidthInt(settings.dfp_post_bottom_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.dfp_post_bottom_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
var post_bottom_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_post_bottom_code, [320,50], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_post_bottom_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_post_bottom_value_code)), post_bottom_mobile)
|
||||
}
|
||||
else {
|
||||
var post_bottom = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_post_bottom_code, [parseInt(splitWidthInt(Discourse.SiteSettings.post_bottom_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
var post_bottom = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_post_bottom_code, [parseInt(splitWidthInt(Discourse.SiteSettings.dfp_post_bottom_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.dfp_post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_post_bottom_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_post_bottom_value_code)), post_bottom)
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
|
||||
.google-dfp-ad {
|
||||
padding: 3px;
|
||||
margin-bottom: 10px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.google-dfp-ad .dfp-ad-unit {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.google-dfp-ad .google-dfp-ad-label {
|
||||
width: 728px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.google-dfp-ad .google-dfp-ad-label h2 {
|
||||
margin: 4px 0 !important;
|
||||
color: #858a8c;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.google-adsense {
|
||||
padding: 3px;
|
||||
margin-bottom: 10px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.google-adsense .adsense-unit {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.google-adsense .google-adsense-label {
|
||||
width: 728px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.google-adsense .google-adsense-label h2 {
|
||||
margin: 4px 0 !important;
|
||||
color: #858a8c;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
|
||||
.google-dfp-ad {
|
||||
padding: 3px;
|
||||
margin-bottom: 10px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.google-dfp-ad .dfp-ad-unit {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.google-adsense {
|
||||
padding: 3px;
|
||||
margin-bottom: 10px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.google-adsense .adsense-unit {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ en:
|
||||
admin:
|
||||
site_settings:
|
||||
categories:
|
||||
ad_plugin: 'DFP Plugin'
|
||||
dfp_plugin: 'DFP Plugin'
|
||||
adsense_plugin: 'Adsense Plugin'
|
@ -102,7 +102,7 @@ adsense_plugin:
|
||||
client: true
|
||||
default: ''
|
||||
|
||||
ad_plugin:
|
||||
dfp_plugin:
|
||||
dfp_publisher_id:
|
||||
client: true
|
||||
default: ''
|
||||
@ -116,7 +116,7 @@ ad_plugin:
|
||||
dfp_mobile_topic_list_top_code:
|
||||
client: true
|
||||
default: ''
|
||||
topic_list_top_ad_sizes:
|
||||
dfp_topic_list_top_ad_sizes:
|
||||
client: true
|
||||
default: '728*90 - leaderboard'
|
||||
type: enum
|
||||
@ -148,7 +148,7 @@ ad_plugin:
|
||||
dfp_mobile_topic_above_post_stream_code:
|
||||
client: true
|
||||
default: ''
|
||||
topic_above_post_stream_ad_sizes:
|
||||
dfp_topic_above_post_stream_ad_sizes:
|
||||
client: true
|
||||
default: '728*90 - leaderboard'
|
||||
type: enum
|
||||
@ -180,7 +180,7 @@ ad_plugin:
|
||||
dfp_mobile_topic_above_suggested_code:
|
||||
client: true
|
||||
default: ''
|
||||
topic_above_suggested_ad_sizes:
|
||||
dfp_topic_above_suggested_ad_sizes:
|
||||
client: true
|
||||
default: '728*90 - leaderboard'
|
||||
type: enum
|
||||
@ -215,7 +215,7 @@ ad_plugin:
|
||||
dfp_nth_post_code:
|
||||
client: true
|
||||
default: ''
|
||||
post_bottom_ad_sizes:
|
||||
dfp_post_bottom_ad_sizes:
|
||||
client: true
|
||||
default: '728*90 - leaderboard'
|
||||
type: enum
|
||||
|
@ -1,22 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Discourse Ad Plugin", { loggedIn: true });
|
||||
|
||||
test("DFP and Adsense Button Appears on Site Settings", () => {
|
||||
visit("/admin/site_settings/category/adsense_plugin");
|
||||
|
||||
andThen(() => {
|
||||
fillIn('#login-account-name', 'eviltrout');
|
||||
// ok(!exists('.tentacle'), "the tentacle is not shown yet");
|
||||
// });
|
||||
|
||||
// click('#show-tentacle');
|
||||
|
||||
// andThen(() => {
|
||||
// ok(exists('.tentacle'), "the tentacle wants to rule the world!");
|
||||
// });
|
||||
});
|
||||
|
||||
|
||||
// Test if dfp and adsense button appear on site settings
|
||||
// Test if AAdsense ad loads
|
||||
// Test if DFP ad loads
|
Loading…
x
Reference in New Issue
Block a user