Commit adc8b1d 1 parent 6d3968a commit adc8b1d Copy full SHA for adc8b1d
File tree 5 files changed +104
-1
lines changed
theme/pydata_sphinx_theme/sections
5 files changed +104
-1
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,33 @@ if (themeSwitchBtns) {
350
350
) ;
351
351
}
352
352
353
+ /*******************************************************************************
354
+ * MutationObserver to move the ReadTheDocs button
355
+ */
356
+
357
+ function initRTDObserver ( ) {
358
+ const mutatedCallback = ( mutationList , observer ) => {
359
+ mutationList . forEach ( ( mutation ) => {
360
+ // Check whether the mutation is for RTD, which will have a specific structure
361
+ if ( mutation . addedNodes . length === 0 ) {
362
+ return ;
363
+ }
364
+ if ( mutation . addedNodes [ 0 ] . data === undefined ) {
365
+ return ;
366
+ }
367
+ if ( mutation . addedNodes [ 0 ] . data . search ( "Inserted RTD Footer" ) != - 1 ) {
368
+ mutation . addedNodes . forEach ( ( node ) => {
369
+ document . getElementById ( "rtd-footer-container" ) . append ( node ) ;
370
+ } ) ;
371
+ }
372
+ } ) ;
373
+ } ;
374
+
375
+ const observer = new MutationObserver ( mutatedCallback ) ;
376
+ const config = { childList : true } ;
377
+ observer . observe ( document . body , config ) ;
378
+ }
379
+
353
380
/*******************************************************************************
354
381
* Finalize
355
382
*/
@@ -361,3 +388,4 @@ $(scrollToActive);
361
388
$ ( addTOCInteractivity ) ;
362
389
$ ( setupSearchButtons ) ;
363
390
$ ( '[data-toggle="tooltip"]' ) . tooltip ( { delay : { show : 500 , hide : 100 } } ) ;
391
+ $ ( initRTDObserver ) ;
Original file line number Diff line number Diff line change
1
+ .bd-sidebar-primary div #rtd-footer-container {
2
+ position : sticky ;
3
+ bottom : -1rem ;
4
+ margin : -1rem ; // ignore sidebar padding
5
+
6
+ .rst-versions.rst-badge {
7
+ position : unset ;
8
+ font-size : 0.9em ;
9
+ font-family : var (--pst-font-family-base );
10
+ max-width : unset ;
11
+
12
+ .rst-current-version {
13
+ display : flex ;
14
+ align-items : center ;
15
+ gap : 0.2rem ;
16
+ height : 2.5rem ;
17
+ transition : background-color 0.2s ease-out ;
18
+ background-color : var (--pst-color-background );
19
+ color : var (--pst-color-success );
20
+ border-top : 1px solid var (--pst-color-border );
21
+ }
22
+
23
+ .fa.fa-book {
24
+ color : var (--pst-color-text-muted );
25
+ margin-right : auto ;
26
+
27
+ & ::after {
28
+ color : var (--pst-color-text-base );
29
+ content : " Read The Docs" ;
30
+ font-family : var (--pst-font-family-base );
31
+ font-weight : var (--pst-font-weight-heading );
32
+ }
33
+ }
34
+ .fa.fa-caret-down {
35
+ color : var (--pst-color-text-muted );
36
+ }
37
+ }
38
+
39
+ .rst-versions.rst-badge.shift-up {
40
+ .rst-current-version {
41
+ border-bottom : 1px solid var (--pst-color-border );
42
+ }
43
+ }
44
+
45
+ .rst-other-versions {
46
+ background-color : var (--pst-color-surface );
47
+ color : var (--pst-color-text-base );
48
+
49
+ dl {
50
+ dd a {
51
+ color : var (--pst-color-text-muted );
52
+ }
53
+ }
54
+
55
+ hr {
56
+ background-color : var (--pst-color-border );
57
+ }
58
+
59
+ small a {
60
+ color : var (--pst-color-link );
61
+ }
62
+
63
+ input {
64
+ padding-left : 0.5rem ;
65
+ border : 1px solid var (--pst-color-border );
66
+ background-color : var (--pst-color-surface );
67
+ }
68
+ }
69
+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ $grid-breakpoints: (
55
55
@import " ./components/toc-inpage" ;
56
56
@import " ./components/versionmodified" ;
57
57
@import " ./components/indices" ;
58
+ @import " ./components/readthedocs-switcher" ;
58
59
59
60
// Content blocks in standard Sphinx
60
61
@import " ./content/admonitions" ;
Original file line number Diff line number Diff line change 34
34
</ div >
35
35
{% endif %}
36
36
37
- {# Items that will snap to the bottom of the screen#}
37
+ {# Items that will snap to the bottom of the screen #}
38
38
< div class ="sidebar-end-items sidebar-primary__section ">
39
39
{%- for sidebartemplate in theme_primary_sidebar_end %}
40
40
< div class ="sidebar-end-items__item ">
41
41
{%- include sidebartemplate %}
42
42
</ div >
43
43
{%- endfor %}
44
44
</ div >
45
+
46
+ {# add the rtd flyout in the sidebar if existing #}
47
+ < div id ="rtd-footer-container "> </ div >
45
48
{% endblock %}
Original file line number Diff line number Diff line change 79
79
< div class ="sidebar-end-items__item ">
80
80
</ div >
81
81
</ div >
82
+ < div id ="rtd-footer-container ">
83
+ </ div >
82
84
</ div >
You can’t perform that action at this time.
0 commit comments