@@ -12,7 +12,7 @@ define([
12
12
] , function (
13
13
requirejs ,
14
14
$ ,
15
- IPython ,
15
+ Jupyter ,
16
16
events ,
17
17
codecell ,
18
18
toc2
@@ -23,14 +23,14 @@ define([
23
23
var highlight_toc_item = toc2 . highlight_toc_item ;
24
24
var table_of_contents = toc2 . table_of_contents ;
25
25
var toggle_toc = toc2 . toggle_toc ;
26
+ var IPython = Jupyter ;
26
27
27
28
// extra download as html with toc menu
28
29
function addSaveAsWithToc ( ) {
29
30
30
31
if ( parseFloat ( Jupyter . version . substr ( 0 , 3 ) ) >= 5.1 ) {
31
32
if ( $ ( "#download_html_toc" ) . length === 0 ) {
32
33
/* Add an entry in the download menu */
33
- var dwm = $ ( "#download_menu" )
34
34
var downloadEntry = $ ( '<li id="download_html_toc"><a href="#">HTML with toc (.html)</a></li>' )
35
35
$ ( "#download_html" ) . after ( downloadEntry )
36
36
downloadEntry . click ( function ( ) {
@@ -137,11 +137,6 @@ define([
137
137
} ;
138
138
}
139
139
140
-
141
- function excute_codecell_callback ( evt , data ) {
142
- highlight_toc_item ( evt , data ) ;
143
- }
144
-
145
140
function rehighlight_running_cells ( ) {
146
141
$ . each ( $ ( '.running' ) , // re-highlight running cells
147
142
function ( idx , elt ) {
@@ -158,6 +153,8 @@ define([
158
153
var cfg = toc2 . read_config ( ) ;
159
154
// create highlights style section in document
160
155
create_additional_css ( cfg ) ;
156
+ // add toc toggle button (now that cfg has loaded)
157
+ toc_button ( cfg ) ;
161
158
// call main function with newly loaded config
162
159
table_of_contents ( cfg ) ;
163
160
// event: render toc for each markdown cell modification
@@ -175,7 +172,7 @@ define([
175
172
addSaveAsWithToc ( ) ;
176
173
} )
177
174
178
- // add a save as HTML with toc included
175
+ // add a save as HTML with toc included
179
176
addSaveAsWithToc ( ) ;
180
177
// Highlight cell on execution
181
178
patch_CodeCell_get_callbacks ( )
@@ -184,11 +181,10 @@ define([
184
181
185
182
var load_ipython_extension = function ( ) {
186
183
load_css ( ) ; //console.log("Loading css")
187
- toc_button ( ) ; //console.log("Adding toc_button")
188
184
189
185
// Wait for the notebook to be fully loaded
190
186
if ( Jupyter . notebook !== undefined && Jupyter . notebook . _fully_loaded ) {
191
- // this tests if the notebook is fully loaded
187
+ // this tests if the notebook is fully loaded
192
188
console . log ( "[toc2] Notebook fully loaded -- toc2 initialized " )
193
189
toc_init ( ) ;
194
190
} else {
0 commit comments