Skip to content

Commit fa57188

Browse files
committed
Support ads on pallets themes
1 parent 64dccc6 commit fa57188

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

readthedocs/core/static-src/core/js/doc-embed/constants.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var exports = {
44
THEME_RTD: 'sphinx_rtd_theme',
55
THEME_ALABASTER: 'alabaster',
6-
THEME_CELERY: 'sphinx_celery',
76
THEME_MKDOCS_RTD: 'readthedocs',
87

98
DEFAULT_PROMO_PRIORITY: 5,
@@ -15,7 +14,6 @@ var exports = {
1514
exports.PROMO_SUPPORTED_THEMES = [
1615
exports.THEME_RTD,
1716
exports.THEME_ALABASTER,
18-
exports.THEME_CELERY
1917
];
2018

2119
exports.PROMO_TYPES = {

readthedocs/core/static-src/core/js/doc-embed/rtd-data.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ var configMethods = {
1111
return this.get_theme_name() === constants.THEME_RTD;
1212
},
1313

14+
is_alabaster_theme: function () {
15+
// Returns true for Alabaster-like themes (eg. flask, celery)
16+
return this.get_theme_name() === constants.THEME_ALABASTER;
17+
},
18+
1419
theme_supports_promo: function () {
1520
return constants.PROMO_SUPPORTED_THEMES.indexOf(this.get_theme_name()) > -1;
1621
},
@@ -24,14 +29,15 @@ var configMethods = {
2429
},
2530

2631
get_theme_name: function () {
27-
// Crappy heuristic, but people change the theme name on us. So we have to
28-
// do some duck typing.
29-
if (this.theme !== constants.THEME_RTD) {
32+
// Crappy heuristic, but people change the theme name on us.
33+
// So we have to do some duck typing.
34+
if (this.theme !== constants.THEME_RTD && this.theme !== constants.THEME_ALABASTER) {
3035
if (this.theme === constants.THEME_MKDOCS_RTD) {
3136
return constants.THEME_RTD;
32-
}
33-
if ($('div.rst-other-versions').length === 1) {
37+
} else if ($('div.rst-other-versions').length === 1) {
3438
return constants.THEME_RTD;
39+
} else if ($('div.sphinxsidebar > div.sphinxsidebarwrapper').length === 1) {
40+
return constants.THEME_ALABASTER;
3541
}
3642
}
3743
return this.theme;

readthedocs/core/static-src/core/js/doc-embed/sponsorship.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ function create_sidebar_placement() {
2424
} else if (rtd.is_rtd_theme()) {
2525
selector = 'nav.wy-nav-side > div.wy-side-scroll';
2626
class_name = 'ethical-rtd';
27-
} else if (rtd.get_theme_name() === constants.THEME_ALABASTER ||
28-
rtd.get_theme_name() === constants.THEME_CELERY) {
27+
} else if (rtd.is_alabaster_theme()) {
2928
selector = 'div.sphinxsidebar > div.sphinxsidebarwrapper';
3029
class_name = 'ethical-alabaster';
3130
}
@@ -66,8 +65,7 @@ function create_footer_placement() {
6665
if (rtd.is_rtd_theme()) {
6766
selector = $('<div />').insertAfter('footer hr');
6867
class_name = 'ethical-rtd';
69-
} else if (rtd.get_theme_name() === constants.THEME_ALABASTER ||
70-
rtd.get_theme_name() === constants.THEME_CELERY) {
68+
} else if (rtd.is_alabaster_theme()) {
7169
selector = 'div.bodywrapper .body';
7270
class_name = 'ethical-alabaster';
7371
}

0 commit comments

Comments
 (0)