File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
readthedocs/core/static-src/core/js/doc-embed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 3
3
var exports = {
4
4
THEME_RTD : 'sphinx_rtd_theme' ,
5
5
THEME_ALABASTER : 'alabaster' ,
6
- THEME_CELERY : 'sphinx_celery' ,
7
6
THEME_MKDOCS_RTD : 'readthedocs' ,
8
7
9
8
DEFAULT_PROMO_PRIORITY : 5 ,
@@ -15,7 +14,6 @@ var exports = {
15
14
exports . PROMO_SUPPORTED_THEMES = [
16
15
exports . THEME_RTD ,
17
16
exports . THEME_ALABASTER ,
18
- exports . THEME_CELERY
19
17
] ;
20
18
21
19
exports . PROMO_TYPES = {
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ var configMethods = {
11
11
return this . get_theme_name ( ) === constants . THEME_RTD ;
12
12
} ,
13
13
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
+
14
19
theme_supports_promo : function ( ) {
15
20
return constants . PROMO_SUPPORTED_THEMES . indexOf ( this . get_theme_name ( ) ) > - 1 ;
16
21
} ,
@@ -24,14 +29,15 @@ var configMethods = {
24
29
} ,
25
30
26
31
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 ) {
30
35
if ( this . theme === constants . THEME_MKDOCS_RTD ) {
31
36
return constants . THEME_RTD ;
32
- }
33
- if ( $ ( 'div.rst-other-versions' ) . length === 1 ) {
37
+ } else if ( $ ( 'div.rst-other-versions' ) . length === 1 ) {
34
38
return constants . THEME_RTD ;
39
+ } else if ( $ ( 'div.sphinxsidebar > div.sphinxsidebarwrapper' ) . length === 1 ) {
40
+ return constants . THEME_ALABASTER ;
35
41
}
36
42
}
37
43
return this . theme ;
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ function create_sidebar_placement() {
24
24
} else if ( rtd . is_rtd_theme ( ) ) {
25
25
selector = 'nav.wy-nav-side > div.wy-side-scroll' ;
26
26
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 ( ) ) {
29
28
selector = 'div.sphinxsidebar > div.sphinxsidebarwrapper' ;
30
29
class_name = 'ethical-alabaster' ;
31
30
}
@@ -66,8 +65,7 @@ function create_footer_placement() {
66
65
if ( rtd . is_rtd_theme ( ) ) {
67
66
selector = $ ( '<div />' ) . insertAfter ( 'footer hr' ) ;
68
67
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 ( ) ) {
71
69
selector = 'div.bodywrapper .body' ;
72
70
class_name = 'ethical-alabaster' ;
73
71
}
You can’t perform that action at this time.
0 commit comments