##// END OF EJS Templates
Optimizing notebook loading.
Brian Granger -
Show More
@@ -1136,7 +1136,7 b' var IPython = (function (IPython) {'
1136 };
1136 };
1137
1137
1138
1138
1139 Notebook.prototype.load_notebook = function (callback) {
1139 Notebook.prototype.load_notebook = function () {
1140 var that = this;
1140 var that = this;
1141 var notebook_id = IPython.save_widget.get_notebook_id();
1141 var notebook_id = IPython.save_widget.get_notebook_id();
1142 // We do the call with settings so we can set cache to false.
1142 // We do the call with settings so we can set cache to false.
@@ -1147,9 +1147,6 b' var IPython = (function (IPython) {'
1147 dataType : "json",
1147 dataType : "json",
1148 success : function (data, status, xhr) {
1148 success : function (data, status, xhr) {
1149 that.notebook_loaded(data, status, xhr);
1149 that.notebook_loaded(data, status, xhr);
1150 if (callback !== undefined) {
1151 callback();
1152 };
1153 }
1150 }
1154 };
1151 };
1155 IPython.save_widget.status_loading();
1152 IPython.save_widget.status_loading();
@@ -1169,12 +1166,10 b' var IPython = (function (IPython) {'
1169 if (! this.read_only) {
1166 if (! this.read_only) {
1170 this.start_kernel();
1167 this.start_kernel();
1171 }
1168 }
1172 // fromJSON always selects the last cell inserted. We need to wait
1169 this.select(0);
1173 // until that is done before scrolling to the top.
1170 this.notebook.scroll_to_top();
1174 setTimeout(function () {
1171 IPython.save_widget.update_url();
1175 IPython.notebook.select(0);
1172 IPython.layout_manager.do_resize();
1176 IPython.notebook.scroll_to_top();
1177 }, 50);
1178 };
1173 };
1179
1174
1180 IPython.Notebook = Notebook;
1175 IPython.Notebook = Notebook;
@@ -109,15 +109,8 b' $(document).ready(function () {'
109 $('div#menubar').css('display','block');
109 $('div#menubar').css('display','block');
110 $('div#main_app').css('display','block');
110 $('div#main_app').css('display','block');
111
111
112 // Perform these actions after the notebook has been loaded.
112 IPython.layout_manager.do_resize();
113 // We wait 100 milliseconds because the notebook scrolls to the top after a load
113 IPython.notebook.load_notebook();
114 // is completed and we need to wait for that to mostly finish.
115 IPython.notebook.load_notebook(function () {
116 setTimeout(function () {
117 IPython.save_widget.update_url();
118 IPython.layout_manager.do_resize();
119 },100);
120 });
121
114
122 });
115 });
123
116
General Comments 0
You need to be logged in to leave comments. Login now