allow notebook tour instantiation to fail

can fail with SecurityError,
depending on browser privacy settings

disable UI Tour menu entry if tour instantiation fails

ref: sorich87/bootstrap-tour#262
pull/37/head
MinRK 12 years ago
parent 79b8ecd9c9
commit b7c1f1d8f6

@ -57,7 +57,11 @@ function (marked) {
IPython.layout_manager = new IPython.LayoutManager();
IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
IPython.quick_help = new IPython.QuickHelp();
IPython.tour = new IPython.NotebookTour();
try {
IPython.tour = new IPython.NotebookTour();
} catch (e) {
console.log("Failed to instantiate Notebook Tour", e);
}
IPython.login_widget = new IPython.LoginWidget('span#login_widget', opts);
IPython.notebook = new IPython.Notebook('div#notebook', opts);
IPython.keyboard_manager = new IPython.KeyboardManager();

@ -280,9 +280,13 @@ var IPython = (function (IPython) {
IPython.notebook.restart_kernel();
});
// Help
this.element.find('#notebook_tour').click(function () {
IPython.tour.start();
});
if (IPython.tour) {
this.element.find('#notebook_tour').click(function () {
IPython.tour.start();
});
} else {
this.element.find('#notebook_tour').addClass("disabled");
}
this.element.find('#keyboard_shortcuts').click(function () {
IPython.quick_help.show_keyboard_shortcuts();
});

Loading…
Cancel
Save