Skip to content

Commit f2a7325

Browse files
committed
2 parents 3e27a64 + f4cb633 commit f2a7325

File tree

1 file changed

+4
-15
lines changed
  • src/jupyter_contrib_nbextensions/nbextensions/toc2

1 file changed

+4
-15
lines changed

src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
], function(
1313
requirejs,
1414
$,
15-
IPython,
15+
Jupyter,
1616
events,
1717
codecell,
1818
toc2
@@ -23,14 +23,14 @@ define([
2323
var highlight_toc_item = toc2.highlight_toc_item;
2424
var table_of_contents = toc2.table_of_contents;
2525
var toggle_toc = toc2.toggle_toc;
26+
var IPython = Jupyter;
2627

2728
// extra download as html with toc menu
2829
function addSaveAsWithToc() {
2930

3031
if (parseFloat(Jupyter.version.substr(0, 3)) >= 5.1) {
3132
if ($("#download_html_toc").length === 0) {
3233
/* Add an entry in the download menu */
33-
var dwm = $("#download_menu")
3434
var downloadEntry = $('<li id="download_html_toc"><a href="#">HTML with toc (.html)</a></li>')
3535
$("#download_html").after(downloadEntry)
3636
downloadEntry.click(function () {
@@ -63,11 +63,6 @@ define([
6363
}
6464
}
6565

66-
function toggleToc() {
67-
toggle_toc(cfg)
68-
}
69-
70-
7166
var toc_button = function(cfg) {
7267
if (!IPython.toolbar) {
7368
events.on("app_initialized.NotebookApp", function (evt) {
@@ -142,11 +137,6 @@ define([
142137
};
143138
}
144139

145-
146-
function excute_codecell_callback(evt, data) {
147-
highlight_toc_item(evt, data);
148-
}
149-
150140
function rehighlight_running_cells() {
151141
$.each($('.running'), // re-highlight running cells
152142
function(idx, elt) {
@@ -163,8 +153,8 @@ define([
163153
var cfg = toc2.read_config();
164154
// create highlights style section in document
165155
create_additional_css(cfg);
166-
// add toc toggle button (cfg loaded)
167-
toc_button(cfg); //console.log("Adding toc_button")
156+
// add toc toggle button (now that cfg has loaded)
157+
toc_button(cfg);
168158
// call main function with newly loaded config
169159
table_of_contents(cfg);
170160
// event: render toc for each markdown cell modification
@@ -191,7 +181,6 @@ define([
191181

192182
var load_ipython_extension = function() {
193183
load_css(); //console.log("Loading css")
194-
// toc_button(); //console.log("Adding toc_button")
195184

196185
// Wait for the notebook to be fully loaded
197186
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {

0 commit comments

Comments
 (0)