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 that = this;
|
||||||
var notebook_id = IPython.save_widget.get_notebook_id();
|
var notebook_id = IPython.save_widget.get_notebook_id();
|
||||||
// We do the call with settings so we can set cache to false.
|
// We do the call with settings so we can set cache to false.
|
||||||
@ -1147,9 +1147,6 @@ var IPython = (function (IPython) {
|
|||||||
dataType : "json",
|
dataType : "json",
|
||||||
success : function (data, status, xhr) {
|
success : function (data, status, xhr) {
|
||||||
that.notebook_loaded(data, status, xhr);
|
that.notebook_loaded(data, status, xhr);
|
||||||
if (callback !== undefined) {
|
|
||||||
callback();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
IPython.save_widget.status_loading();
|
IPython.save_widget.status_loading();
|
||||||
@ -1169,12 +1166,10 @@ var IPython = (function (IPython) {
|
|||||||
if (! this.read_only) {
|
if (! this.read_only) {
|
||||||
this.start_kernel();
|
this.start_kernel();
|
||||||
}
|
}
|
||||||
// fromJSON always selects the last cell inserted. We need to wait
|
this.select(0);
|
||||||
// until that is done before scrolling to the top.
|
this.notebook.scroll_to_top();
|
||||||
setTimeout(function () {
|
IPython.save_widget.update_url();
|
||||||
IPython.notebook.select(0);
|
IPython.layout_manager.do_resize();
|
||||||
IPython.notebook.scroll_to_top();
|
|
||||||
}, 50);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IPython.Notebook = Notebook;
|
IPython.Notebook = Notebook;
|
||||||
|
@ -109,15 +109,8 @@ $(document).ready(function () {
|
|||||||
$('div#menubar').css('display','block');
|
$('div#menubar').css('display','block');
|
||||||
$('div#main_app').css('display','block');
|
$('div#main_app').css('display','block');
|
||||||
|
|
||||||
// Perform these actions after the notebook has been loaded.
|
IPython.layout_manager.do_resize();
|
||||||
// We wait 100 milliseconds because the notebook scrolls to the top after a load
|
IPython.notebook.load_notebook();
|
||||||
// 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);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user