mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Optimizing notebook loading.
This commit is contained in:
parent
bf0353ae47
commit
1e2e086508
@ -1136,7 +1136,7 @@ var IPython = (function (IPython) {
|
||||
};
|
||||
|
||||
|
||||
Notebook.prototype.load_notebook = function (callback) {
|
||||
Notebook.prototype.load_notebook = function () {
|
||||
var that = this;
|
||||
var notebook_id = IPython.save_widget.get_notebook_id();
|
||||
// We do the call with settings so we can set cache to false.
|
||||
@ -1147,9 +1147,6 @@ var IPython = (function (IPython) {
|
||||
dataType : "json",
|
||||
success : function (data, status, xhr) {
|
||||
that.notebook_loaded(data, status, xhr);
|
||||
if (callback !== undefined) {
|
||||
callback();
|
||||
};
|
||||
}
|
||||
};
|
||||
IPython.save_widget.status_loading();
|
||||
@ -1169,12 +1166,10 @@ var IPython = (function (IPython) {
|
||||
if (! this.read_only) {
|
||||
this.start_kernel();
|
||||
}
|
||||
// fromJSON always selects the last cell inserted. We need to wait
|
||||
// until that is done before scrolling to the top.
|
||||
setTimeout(function () {
|
||||
IPython.notebook.select(0);
|
||||
IPython.notebook.scroll_to_top();
|
||||
}, 50);
|
||||
this.select(0);
|
||||
this.notebook.scroll_to_top();
|
||||
IPython.save_widget.update_url();
|
||||
IPython.layout_manager.do_resize();
|
||||
};
|
||||
|
||||
IPython.Notebook = Notebook;
|
||||
|
@ -109,15 +109,8 @@ $(document).ready(function () {
|
||||
$('div#menubar').css('display','block');
|
||||
$('div#main_app').css('display','block');
|
||||
|
||||
// Perform these actions after the notebook has been loaded.
|
||||
// We wait 100 milliseconds because the notebook scrolls to the top after a load
|
||||
// is completed and we need to wait for that to mostly finish.
|
||||
IPython.notebook.load_notebook(function () {
|
||||
setTimeout(function () {
|
||||
IPython.save_widget.update_url();
|
||||
IPython.layout_manager.do_resize();
|
||||
},100);
|
||||
});
|
||||
IPython.layout_manager.do_resize();
|
||||
IPython.notebook.load_notebook();
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user