20
20
/* Customizations to the Sphinx auto module plugin output */
21
21
function auto_index ( ) {
22
22
var targets = $ ( "dl.class>dt,dl.function>dt" ) ;
23
-
24
23
var li_node = $ ( "li.current>span>a.current.reference.internal" ) . parent ( ) . parent ( ) ;
25
24
var html = "<ul id='autodoc'>" ;
26
25
if ( li_node . length > 0 ) {
27
- for ( var i = 0 ; i < targets . length ; ++ i ) {
28
- var id = $ ( targets [ i ] ) . attr ( 'id' ) ;
29
- if ( id ) {
30
- var paths = id . split ( '.' )
31
- if ( paths . length >= 2 ) {
32
- var id_simple = paths . pop ( ) ;
33
- id_simple = paths . pop ( ) + "." + id_simple ;
34
- } else {
35
- var id_simple = id ;
26
+ if ( targets . length > 0 ) {
27
+ for ( var i = 0 ; i < targets . length ; ++ i ) {
28
+ var id = $ ( targets [ i ] ) . attr ( 'id' ) ;
29
+ if ( id ) {
30
+ var paths = id . split ( '.' )
31
+ if ( paths . length >= 2 ) {
32
+ var id_simple = paths . pop ( ) ;
33
+ id_simple = paths . pop ( ) + "." + id_simple ;
34
+ } else {
35
+ var id_simple = id ;
36
+ }
37
+ html += "<li><span class='link-wrapper'><a class='reference internal' href='#" ;
38
+ html += id ;
39
+ html += "'>" + id_simple + "</a></span</li>" ;
36
40
}
37
- html += "<li><span class='link-wrapper'><a class='reference internal' href='#" ;
38
- html += id ;
39
- html += "'>" + id_simple + "</a></span</li>" ;
40
41
}
42
+ html += "</ul>" ;
43
+ li_node . append ( html ) ;
44
+ li_node . prepend ( "<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>" )
41
45
}
42
- html += "</ul>" ;
43
- li_node . append ( html ) ;
44
- li_node . prepend ( "<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>" )
45
46
} else {
46
47
setTimeout ( auto_index , 500 ) ;
47
48
}
49
+
48
50
}
49
51
$ ( document ) . ready ( auto_index ) ;
0 commit comments