Show More
@@ -1,750 +1,762 | |||||
1 |
|
1 | |||
2 | //============================================================================ |
|
2 | //============================================================================ | |
3 | // Notebook |
|
3 | // Notebook | |
4 | //============================================================================ |
|
4 | //============================================================================ | |
5 |
|
5 | |||
6 | var IPython = (function (IPython) { |
|
6 | var IPython = (function (IPython) { | |
7 |
|
7 | |||
8 | var utils = IPython.utils; |
|
8 | var utils = IPython.utils; | |
9 |
|
9 | |||
10 | var Notebook = function (selector) { |
|
10 | var Notebook = function (selector) { | |
11 | this.element = $(selector); |
|
11 | this.element = $(selector); | |
12 | this.element.scroll(); |
|
12 | this.element.scroll(); | |
13 | this.element.data("notebook", this); |
|
13 | this.element.data("notebook", this); | |
14 | this.next_prompt_number = 1; |
|
14 | this.next_prompt_number = 1; | |
15 | this.kernel = null; |
|
15 | this.kernel = null; | |
16 | this.msg_cell_map = {}; |
|
16 | this.msg_cell_map = {}; | |
17 | this.style(); |
|
17 | this.style(); | |
18 | this.create_elements(); |
|
18 | this.create_elements(); | |
19 | this.bind_events(); |
|
19 | this.bind_events(); | |
20 | }; |
|
20 | }; | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | Notebook.prototype.style = function () { |
|
23 | Notebook.prototype.style = function () { | |
24 | $('div#notebook').addClass('border-box-sizing'); |
|
24 | $('div#notebook').addClass('border-box-sizing'); | |
25 | }; |
|
25 | }; | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | Notebook.prototype.create_elements = function () { |
|
28 | Notebook.prototype.create_elements = function () { | |
29 | // We add this end_space div to the end of the notebook div to: |
|
29 | // We add this end_space div to the end of the notebook div to: | |
30 | // i) provide a margin between the last cell and the end of the notebook |
|
30 | // i) provide a margin between the last cell and the end of the notebook | |
31 | // ii) to prevent the div from scrolling up when the last cell is being |
|
31 | // ii) to prevent the div from scrolling up when the last cell is being | |
32 | // edited, but is too low on the page, which browsers will do automatically. |
|
32 | // edited, but is too low on the page, which browsers will do automatically. | |
33 | this.element.append($('<div class="end_space"></div>').height(50)); |
|
33 | this.element.append($('<div class="end_space"></div>').height(50)); | |
34 | $('div#notebook').addClass('border-box-sizing'); |
|
34 | $('div#notebook').addClass('border-box-sizing'); | |
35 | }; |
|
35 | }; | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | Notebook.prototype.bind_events = function () { |
|
38 | Notebook.prototype.bind_events = function () { | |
39 | var that = this; |
|
39 | var that = this; | |
40 | $(document).keydown(function (event) { |
|
40 | $(document).keydown(function (event) { | |
41 | // console.log(event); |
|
41 | // console.log(event); | |
42 | if (event.which === 38) { |
|
42 | if (event.which === 38) { | |
43 | var cell = that.selected_cell(); |
|
43 | var cell = that.selected_cell(); | |
44 | if (cell.at_top()) { |
|
44 | if (cell.at_top()) { | |
45 | event.preventDefault(); |
|
45 | event.preventDefault(); | |
46 | that.select_prev(); |
|
46 | that.select_prev(); | |
47 | }; |
|
47 | }; | |
48 | } else if (event.which === 40) { |
|
48 | } else if (event.which === 40) { | |
49 | var cell = that.selected_cell(); |
|
49 | var cell = that.selected_cell(); | |
50 | if (cell.at_bottom()) { |
|
50 | if (cell.at_bottom()) { | |
51 | event.preventDefault(); |
|
51 | event.preventDefault(); | |
52 | that.select_next(); |
|
52 | that.select_next(); | |
53 | }; |
|
53 | }; | |
54 | } else if (event.which === 13 && event.shiftKey) { |
|
54 | } else if (event.which === 13 && event.shiftKey) { | |
55 | that.execute_selected_cell(); |
|
55 | that.execute_selected_cell(); | |
56 | return false; |
|
56 | return false; | |
57 | } else if (event.which === 13 && event.ctrlKey) { |
|
57 | } else if (event.which === 13 && event.ctrlKey) { | |
58 | that.execute_selected_cell({terminal:true}); |
|
58 | that.execute_selected_cell({terminal:true}); | |
59 | return false; |
|
59 | return false; | |
60 | }; |
|
60 | }; | |
61 | }); |
|
61 | }); | |
62 |
|
62 | |||
63 | this.element.bind('collapse_pager', function () { |
|
63 | this.element.bind('collapse_pager', function () { | |
64 | var app_height = $('div#main_app').height(); // content height |
|
64 | var app_height = $('div#main_app').height(); // content height | |
65 | var splitter_height = $('div#pager_splitter').outerHeight(true); |
|
65 | var splitter_height = $('div#pager_splitter').outerHeight(true); | |
66 | var new_height = app_height - splitter_height; |
|
66 | var new_height = app_height - splitter_height; | |
67 | that.element.animate({height : new_height + 'px'}, 'fast'); |
|
67 | that.element.animate({height : new_height + 'px'}, 'fast'); | |
68 | }); |
|
68 | }); | |
69 |
|
69 | |||
70 | this.element.bind('expand_pager', function () { |
|
70 | this.element.bind('expand_pager', function () { | |
71 | var app_height = $('div#main_app').height(); // content height |
|
71 | var app_height = $('div#main_app').height(); // content height | |
72 | var splitter_height = $('div#pager_splitter').outerHeight(true); |
|
72 | var splitter_height = $('div#pager_splitter').outerHeight(true); | |
73 | var pager_height = $('div#pager').outerHeight(true); |
|
73 | var pager_height = $('div#pager').outerHeight(true); | |
74 | var new_height = app_height - pager_height - splitter_height; |
|
74 | var new_height = app_height - pager_height - splitter_height; | |
75 | that.element.animate({height : new_height + 'px'}, 'fast'); |
|
75 | that.element.animate({height : new_height + 'px'}, 'fast'); | |
76 | }); |
|
76 | }); | |
77 |
|
77 | |||
78 | this.element.bind('collapse_left_panel', function () { |
|
78 | this.element.bind('collapse_left_panel', function () { | |
79 | var splitter_width = $('div#left_panel_splitter').outerWidth(true); |
|
79 | var splitter_width = $('div#left_panel_splitter').outerWidth(true); | |
80 | var new_margin = splitter_width; |
|
80 | var new_margin = splitter_width; | |
81 | $('div#notebook_panel').animate({marginLeft : new_margin + 'px'}, 'fast'); |
|
81 | $('div#notebook_panel').animate({marginLeft : new_margin + 'px'}, 'fast'); | |
82 | }); |
|
82 | }); | |
83 |
|
83 | |||
84 | this.element.bind('expand_left_panel', function () { |
|
84 | this.element.bind('expand_left_panel', function () { | |
85 | var splitter_width = $('div#left_panel_splitter').outerWidth(true); |
|
85 | var splitter_width = $('div#left_panel_splitter').outerWidth(true); | |
86 | var left_panel_width = IPython.left_panel.width; |
|
86 | var left_panel_width = IPython.left_panel.width; | |
87 | var new_margin = splitter_width + left_panel_width; |
|
87 | var new_margin = splitter_width + left_panel_width; | |
88 | $('div#notebook_panel').animate({marginLeft : new_margin + 'px'}, 'fast'); |
|
88 | $('div#notebook_panel').animate({marginLeft : new_margin + 'px'}, 'fast'); | |
89 | }); |
|
89 | }); | |
90 |
|
90 | |||
91 | $(window).bind('beforeunload', function () { |
|
91 | $(window).bind('beforeunload', function () { | |
92 | var kill_kernel = $('#kill_kernel').prop('checked'); |
|
92 | var kill_kernel = $('#kill_kernel').prop('checked'); | |
93 | if (kill_kernel) { |
|
93 | if (kill_kernel) { | |
94 | that.kernel.kill(); |
|
94 | that.kernel.kill(); | |
95 | return "You are about to exit this notebook and kill the kernel."; |
|
95 | return "You are about to exit this notebook and kill the kernel."; | |
96 | } else { |
|
96 | } else { | |
97 | return "You are about the exit this notebook and leave the kernel running."; |
|
97 | return "You are about the exit this notebook and leave the kernel running."; | |
98 | }; |
|
98 | }; | |
99 | }); |
|
99 | }); | |
100 | }; |
|
100 | }; | |
101 |
|
101 | |||
102 |
|
102 | |||
103 | Notebook.prototype.scroll_to_bottom = function () { |
|
103 | Notebook.prototype.scroll_to_bottom = function () { | |
104 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); |
|
104 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); | |
105 | }; |
|
105 | }; | |
106 |
|
106 | |||
107 |
|
107 | |||
108 | Notebook.prototype.scroll_to_top = function () { |
|
108 | Notebook.prototype.scroll_to_top = function () { | |
109 | this.element.animate({scrollTop:0}, 0); |
|
109 | this.element.animate({scrollTop:0}, 0); | |
110 | }; |
|
110 | }; | |
111 |
|
111 | |||
112 |
|
112 | |||
113 | // Cell indexing, retrieval, etc. |
|
113 | // Cell indexing, retrieval, etc. | |
114 |
|
114 | |||
115 |
|
115 | |||
116 | Notebook.prototype.cell_elements = function () { |
|
116 | Notebook.prototype.cell_elements = function () { | |
117 | return this.element.children("div.cell"); |
|
117 | return this.element.children("div.cell"); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 |
|
120 | |||
121 | Notebook.prototype.ncells = function (cell) { |
|
121 | Notebook.prototype.ncells = function (cell) { | |
122 | return this.cell_elements().length; |
|
122 | return this.cell_elements().length; | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 |
|
125 | |||
126 | // TODO: we are often calling cells as cells()[i], which we should optimize |
|
126 | // TODO: we are often calling cells as cells()[i], which we should optimize | |
127 | // to cells(i) or a new method. |
|
127 | // to cells(i) or a new method. | |
128 | Notebook.prototype.cells = function () { |
|
128 | Notebook.prototype.cells = function () { | |
129 | return this.cell_elements().toArray().map(function (e) { |
|
129 | return this.cell_elements().toArray().map(function (e) { | |
130 | return $(e).data("cell"); |
|
130 | return $(e).data("cell"); | |
131 | }); |
|
131 | }); | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 |
|
134 | |||
135 | Notebook.prototype.find_cell_index = function (cell) { |
|
135 | Notebook.prototype.find_cell_index = function (cell) { | |
136 | var result = null; |
|
136 | var result = null; | |
137 | this.cell_elements().filter(function (index) { |
|
137 | this.cell_elements().filter(function (index) { | |
138 | if ($(this).data("cell") === cell) { |
|
138 | if ($(this).data("cell") === cell) { | |
139 | result = index; |
|
139 | result = index; | |
140 | }; |
|
140 | }; | |
141 | }); |
|
141 | }); | |
142 | return result; |
|
142 | return result; | |
143 | }; |
|
143 | }; | |
144 |
|
144 | |||
145 |
|
145 | |||
146 | Notebook.prototype.index_or_selected = function (index) { |
|
146 | Notebook.prototype.index_or_selected = function (index) { | |
147 | return index || this.selected_index() || 0; |
|
147 | return index || this.selected_index() || 0; | |
148 | } |
|
148 | } | |
149 |
|
149 | |||
150 |
|
150 | |||
151 | Notebook.prototype.select = function (index) { |
|
151 | Notebook.prototype.select = function (index) { | |
152 | if (index !== undefined && index >= 0 && index < this.ncells()) { |
|
152 | if (index !== undefined && index >= 0 && index < this.ncells()) { | |
153 | if (this.selected_index() !== null) { |
|
153 | if (this.selected_index() !== null) { | |
154 | this.selected_cell().unselect(); |
|
154 | this.selected_cell().unselect(); | |
155 | }; |
|
155 | }; | |
156 | this.cells()[index].select(); |
|
156 | this.cells()[index].select(); | |
157 | if (index === (this.ncells()-1)) { |
|
157 | if (index === (this.ncells()-1)) { | |
158 | this.scroll_to_bottom(); |
|
158 | this.scroll_to_bottom(); | |
159 | }; |
|
159 | }; | |
160 | }; |
|
160 | }; | |
161 | return this; |
|
161 | return this; | |
162 | }; |
|
162 | }; | |
163 |
|
163 | |||
164 |
|
164 | |||
165 | Notebook.prototype.select_next = function () { |
|
165 | Notebook.prototype.select_next = function () { | |
166 | var index = this.selected_index(); |
|
166 | var index = this.selected_index(); | |
167 | if (index !== null && index >= 0 && (index+1) < this.ncells()) { |
|
167 | if (index !== null && index >= 0 && (index+1) < this.ncells()) { | |
168 | this.select(index+1); |
|
168 | this.select(index+1); | |
169 | }; |
|
169 | }; | |
170 | return this; |
|
170 | return this; | |
171 | }; |
|
171 | }; | |
172 |
|
172 | |||
173 |
|
173 | |||
174 | Notebook.prototype.select_prev = function () { |
|
174 | Notebook.prototype.select_prev = function () { | |
175 | var index = this.selected_index(); |
|
175 | var index = this.selected_index(); | |
176 | if (index !== null && index >= 0 && (index-1) < this.ncells()) { |
|
176 | if (index !== null && index >= 0 && (index-1) < this.ncells()) { | |
177 | this.select(index-1); |
|
177 | this.select(index-1); | |
178 | }; |
|
178 | }; | |
179 | return this; |
|
179 | return this; | |
180 | }; |
|
180 | }; | |
181 |
|
181 | |||
182 |
|
182 | |||
183 | Notebook.prototype.selected_index = function () { |
|
183 | Notebook.prototype.selected_index = function () { | |
184 | var result = null; |
|
184 | var result = null; | |
185 | this.cell_elements().filter(function (index) { |
|
185 | this.cell_elements().filter(function (index) { | |
186 | if ($(this).data("cell").selected === true) { |
|
186 | if ($(this).data("cell").selected === true) { | |
187 | result = index; |
|
187 | result = index; | |
188 | }; |
|
188 | }; | |
189 | }); |
|
189 | }); | |
190 | return result; |
|
190 | return result; | |
191 | }; |
|
191 | }; | |
192 |
|
192 | |||
193 |
|
193 | |||
194 | Notebook.prototype.cell_for_msg = function (msg_id) { |
|
194 | Notebook.prototype.cell_for_msg = function (msg_id) { | |
195 | var cell_id = this.msg_cell_map[msg_id]; |
|
195 | var cell_id = this.msg_cell_map[msg_id]; | |
196 | var result = null; |
|
196 | var result = null; | |
197 | this.cell_elements().filter(function (index) { |
|
197 | this.cell_elements().filter(function (index) { | |
198 | cell = $(this).data("cell"); |
|
198 | cell = $(this).data("cell"); | |
199 | if (cell.cell_id === cell_id) { |
|
199 | if (cell.cell_id === cell_id) { | |
200 | result = cell; |
|
200 | result = cell; | |
201 | }; |
|
201 | }; | |
202 | }); |
|
202 | }); | |
203 | return result; |
|
203 | return result; | |
204 | }; |
|
204 | }; | |
205 |
|
205 | |||
206 |
|
206 | |||
207 | Notebook.prototype.selected_cell = function () { |
|
207 | Notebook.prototype.selected_cell = function () { | |
208 | return this.cell_elements().eq(this.selected_index()).data("cell"); |
|
208 | return this.cell_elements().eq(this.selected_index()).data("cell"); | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 |
|
211 | |||
212 | // Cell insertion, deletion and moving. |
|
212 | // Cell insertion, deletion and moving. | |
213 |
|
213 | |||
214 |
|
214 | |||
215 | Notebook.prototype.delete_cell = function (index) { |
|
215 | Notebook.prototype.delete_cell = function (index) { | |
216 | var i = index || this.selected_index(); |
|
216 | var i = index || this.selected_index(); | |
217 | if (i !== null && i >= 0 && i < this.ncells()) { |
|
217 | if (i !== null && i >= 0 && i < this.ncells()) { | |
218 | this.cell_elements().eq(i).remove(); |
|
218 | this.cell_elements().eq(i).remove(); | |
219 | if (i === (this.ncells())) { |
|
219 | if (i === (this.ncells())) { | |
220 | this.select(i-1); |
|
220 | this.select(i-1); | |
221 | } else { |
|
221 | } else { | |
222 | this.select(i); |
|
222 | this.select(i); | |
223 | }; |
|
223 | }; | |
224 | }; |
|
224 | }; | |
225 | return this; |
|
225 | return this; | |
226 | }; |
|
226 | }; | |
227 |
|
227 | |||
228 |
|
228 | |||
229 | Notebook.prototype.append_cell = function (cell) { |
|
229 | Notebook.prototype.append_cell = function (cell) { | |
230 | this.element.find('div.end_space').before(cell.element); |
|
230 | this.element.find('div.end_space').before(cell.element); | |
231 | return this; |
|
231 | return this; | |
232 | }; |
|
232 | }; | |
233 |
|
233 | |||
234 |
|
234 | |||
235 | Notebook.prototype.insert_cell_after = function (cell, index) { |
|
235 | Notebook.prototype.insert_cell_after = function (cell, index) { | |
236 | var ncells = this.ncells(); |
|
236 | var ncells = this.ncells(); | |
237 | if (ncells === 0) { |
|
237 | if (ncells === 0) { | |
238 | this.append_cell(cell); |
|
238 | this.append_cell(cell); | |
239 | return this; |
|
239 | return this; | |
240 | }; |
|
240 | }; | |
241 | if (index >= 0 && index < ncells) { |
|
241 | if (index >= 0 && index < ncells) { | |
242 | this.cell_elements().eq(index).after(cell.element); |
|
242 | this.cell_elements().eq(index).after(cell.element); | |
243 | }; |
|
243 | }; | |
244 | return this |
|
244 | return this | |
245 | }; |
|
245 | }; | |
246 |
|
246 | |||
247 |
|
247 | |||
248 | Notebook.prototype.insert_cell_before = function (cell, index) { |
|
248 | Notebook.prototype.insert_cell_before = function (cell, index) { | |
249 | var ncells = this.ncells(); |
|
249 | var ncells = this.ncells(); | |
250 | if (ncells === 0) { |
|
250 | if (ncells === 0) { | |
251 | this.append_cell(cell); |
|
251 | this.append_cell(cell); | |
252 | return this; |
|
252 | return this; | |
253 | }; |
|
253 | }; | |
254 | if (index >= 0 && index < ncells) { |
|
254 | if (index >= 0 && index < ncells) { | |
255 | this.cell_elements().eq(index).before(cell.element); |
|
255 | this.cell_elements().eq(index).before(cell.element); | |
256 | }; |
|
256 | }; | |
257 | return this; |
|
257 | return this; | |
258 | }; |
|
258 | }; | |
259 |
|
259 | |||
260 |
|
260 | |||
261 | Notebook.prototype.move_cell_up = function (index) { |
|
261 | Notebook.prototype.move_cell_up = function (index) { | |
262 | var i = index || this.selected_index(); |
|
262 | var i = index || this.selected_index(); | |
263 | if (i !== null && i < this.ncells() && i > 0) { |
|
263 | if (i !== null && i < this.ncells() && i > 0) { | |
264 | var pivot = this.cell_elements().eq(i-1); |
|
264 | var pivot = this.cell_elements().eq(i-1); | |
265 | var tomove = this.cell_elements().eq(i); |
|
265 | var tomove = this.cell_elements().eq(i); | |
266 | if (pivot !== null && tomove !== null) { |
|
266 | if (pivot !== null && tomove !== null) { | |
267 | tomove.detach(); |
|
267 | tomove.detach(); | |
268 | pivot.before(tomove); |
|
268 | pivot.before(tomove); | |
269 | this.select(i-1); |
|
269 | this.select(i-1); | |
270 | }; |
|
270 | }; | |
271 | }; |
|
271 | }; | |
272 | return this; |
|
272 | return this; | |
273 | } |
|
273 | } | |
274 |
|
274 | |||
275 |
|
275 | |||
276 | Notebook.prototype.move_cell_down = function (index) { |
|
276 | Notebook.prototype.move_cell_down = function (index) { | |
277 | var i = index || this.selected_index(); |
|
277 | var i = index || this.selected_index(); | |
278 | if (i !== null && i < (this.ncells()-1) && i >= 0) { |
|
278 | if (i !== null && i < (this.ncells()-1) && i >= 0) { | |
279 | var pivot = this.cell_elements().eq(i+1) |
|
279 | var pivot = this.cell_elements().eq(i+1) | |
280 | var tomove = this.cell_elements().eq(i) |
|
280 | var tomove = this.cell_elements().eq(i) | |
281 | if (pivot !== null && tomove !== null) { |
|
281 | if (pivot !== null && tomove !== null) { | |
282 | tomove.detach(); |
|
282 | tomove.detach(); | |
283 | pivot.after(tomove); |
|
283 | pivot.after(tomove); | |
284 | this.select(i+1); |
|
284 | this.select(i+1); | |
285 | }; |
|
285 | }; | |
286 | }; |
|
286 | }; | |
287 | return this; |
|
287 | return this; | |
288 | } |
|
288 | } | |
289 |
|
289 | |||
290 |
|
290 | |||
291 | Notebook.prototype.sort_cells = function () { |
|
291 | Notebook.prototype.sort_cells = function () { | |
292 | var ncells = this.ncells(); |
|
292 | var ncells = this.ncells(); | |
293 | var sindex = this.selected_index(); |
|
293 | var sindex = this.selected_index(); | |
294 | var swapped; |
|
294 | var swapped; | |
295 | do { |
|
295 | do { | |
296 | swapped = false |
|
296 | swapped = false | |
297 | for (var i=1; i<ncells; i++) { |
|
297 | for (var i=1; i<ncells; i++) { | |
298 | current = this.cell_elements().eq(i).data("cell"); |
|
298 | current = this.cell_elements().eq(i).data("cell"); | |
299 | previous = this.cell_elements().eq(i-1).data("cell"); |
|
299 | previous = this.cell_elements().eq(i-1).data("cell"); | |
300 | if (previous.input_prompt_number > current.input_prompt_number) { |
|
300 | if (previous.input_prompt_number > current.input_prompt_number) { | |
301 | this.move_cell_up(i); |
|
301 | this.move_cell_up(i); | |
302 | swapped = true; |
|
302 | swapped = true; | |
303 | }; |
|
303 | }; | |
304 | }; |
|
304 | }; | |
305 | } while (swapped); |
|
305 | } while (swapped); | |
306 | this.select(sindex); |
|
306 | this.select(sindex); | |
307 | return this; |
|
307 | return this; | |
308 | }; |
|
308 | }; | |
309 |
|
309 | |||
310 |
|
310 | |||
311 | Notebook.prototype.insert_code_cell_before = function (index) { |
|
311 | Notebook.prototype.insert_code_cell_before = function (index) { | |
312 | // TODO: Bounds check for i |
|
312 | // TODO: Bounds check for i | |
313 | var i = this.index_or_selected(index); |
|
313 | var i = this.index_or_selected(index); | |
314 | var cell = new IPython.CodeCell(this); |
|
314 | var cell = new IPython.CodeCell(this); | |
315 | cell.set_input_prompt(); |
|
315 | cell.set_input_prompt(); | |
316 | this.insert_cell_before(cell, i); |
|
316 | this.insert_cell_before(cell, i); | |
317 | this.select(this.find_cell_index(cell)); |
|
317 | this.select(this.find_cell_index(cell)); | |
318 | return cell; |
|
318 | return cell; | |
319 | } |
|
319 | } | |
320 |
|
320 | |||
321 |
|
321 | |||
322 | Notebook.prototype.insert_code_cell_after = function (index) { |
|
322 | Notebook.prototype.insert_code_cell_after = function (index) { | |
323 | // TODO: Bounds check for i |
|
323 | // TODO: Bounds check for i | |
324 | var i = this.index_or_selected(index); |
|
324 | var i = this.index_or_selected(index); | |
325 | var cell = new IPython.CodeCell(this); |
|
325 | var cell = new IPython.CodeCell(this); | |
326 | cell.set_input_prompt(); |
|
326 | cell.set_input_prompt(); | |
327 | this.insert_cell_after(cell, i); |
|
327 | this.insert_cell_after(cell, i); | |
328 | this.select(this.find_cell_index(cell)); |
|
328 | this.select(this.find_cell_index(cell)); | |
329 | return cell; |
|
329 | return cell; | |
330 | } |
|
330 | } | |
331 |
|
331 | |||
332 |
|
332 | |||
333 | Notebook.prototype.insert_html_cell_before = function (index) { |
|
333 | Notebook.prototype.insert_html_cell_before = function (index) { | |
334 | // TODO: Bounds check for i |
|
334 | // TODO: Bounds check for i | |
335 | var i = this.index_or_selected(index); |
|
335 | var i = this.index_or_selected(index); | |
336 | var cell = new IPython.HTMLCell(this); |
|
336 | var cell = new IPython.HTMLCell(this); | |
337 | cell.config_mathjax(); |
|
337 | cell.config_mathjax(); | |
338 | this.insert_cell_before(cell, i); |
|
338 | this.insert_cell_before(cell, i); | |
339 | this.select(this.find_cell_index(cell)); |
|
339 | this.select(this.find_cell_index(cell)); | |
340 | return cell; |
|
340 | return cell; | |
341 | } |
|
341 | } | |
342 |
|
342 | |||
343 |
|
343 | |||
344 | Notebook.prototype.insert_html_cell_after = function (index) { |
|
344 | Notebook.prototype.insert_html_cell_after = function (index) { | |
345 | // TODO: Bounds check for i |
|
345 | // TODO: Bounds check for i | |
346 | var i = this.index_or_selected(index); |
|
346 | var i = this.index_or_selected(index); | |
347 | var cell = new IPython.HTMLCell(this); |
|
347 | var cell = new IPython.HTMLCell(this); | |
348 | cell.config_mathjax(); |
|
348 | cell.config_mathjax(); | |
349 | this.insert_cell_after(cell, i); |
|
349 | this.insert_cell_after(cell, i); | |
350 | this.select(this.find_cell_index(cell)); |
|
350 | this.select(this.find_cell_index(cell)); | |
351 | return cell; |
|
351 | return cell; | |
352 | } |
|
352 | } | |
353 |
|
353 | |||
354 |
|
354 | |||
355 | Notebook.prototype.insert_markdown_cell_before = function (index) { |
|
355 | Notebook.prototype.insert_markdown_cell_before = function (index) { | |
356 | // TODO: Bounds check for i |
|
356 | // TODO: Bounds check for i | |
357 | var i = this.index_or_selected(index); |
|
357 | var i = this.index_or_selected(index); | |
358 | var cell = new IPython.MarkdownCell(this); |
|
358 | var cell = new IPython.MarkdownCell(this); | |
359 | cell.config_mathjax(); |
|
359 | cell.config_mathjax(); | |
360 | this.insert_cell_before(cell, i); |
|
360 | this.insert_cell_before(cell, i); | |
361 | this.select(this.find_cell_index(cell)); |
|
361 | this.select(this.find_cell_index(cell)); | |
362 | return cell; |
|
362 | return cell; | |
363 | } |
|
363 | } | |
364 |
|
364 | |||
365 |
|
365 | |||
366 | Notebook.prototype.insert_markdown_cell_after = function (index) { |
|
366 | Notebook.prototype.insert_markdown_cell_after = function (index) { | |
367 | // TODO: Bounds check for i |
|
367 | // TODO: Bounds check for i | |
368 | var i = this.index_or_selected(index); |
|
368 | var i = this.index_or_selected(index); | |
369 | var cell = new IPython.MarkdownCell(this); |
|
369 | var cell = new IPython.MarkdownCell(this); | |
370 | cell.config_mathjax(); |
|
370 | cell.config_mathjax(); | |
371 | this.insert_cell_after(cell, i); |
|
371 | this.insert_cell_after(cell, i); | |
372 | this.select(this.find_cell_index(cell)); |
|
372 | this.select(this.find_cell_index(cell)); | |
373 | return cell; |
|
373 | return cell; | |
374 | } |
|
374 | } | |
375 |
|
375 | |||
376 |
|
376 | |||
377 | Notebook.prototype.to_code = function (index) { |
|
377 | Notebook.prototype.to_code = function (index) { | |
378 | // TODO: Bounds check for i |
|
378 | // TODO: Bounds check for i | |
379 | var i = this.index_or_selected(index); |
|
379 | var i = this.index_or_selected(index); | |
380 | var source_element = this.cell_elements().eq(i); |
|
380 | var source_element = this.cell_elements().eq(i); | |
381 | var source_cell = source_element.data("cell"); |
|
381 | var source_cell = source_element.data("cell"); | |
382 | if (source_cell instanceof IPython.HTMLCell || |
|
382 | if (source_cell instanceof IPython.HTMLCell || | |
383 | source_cell instanceof IPython.MarkdownCell) { |
|
383 | source_cell instanceof IPython.MarkdownCell) { | |
384 | this.insert_code_cell_after(i); |
|
384 | this.insert_code_cell_after(i); | |
385 | var target_cell = this.cells()[i+1]; |
|
385 | var target_cell = this.cells()[i+1]; | |
386 | target_cell.set_code(source_cell.get_source()); |
|
386 | target_cell.set_code(source_cell.get_source()); | |
387 | source_element.remove(); |
|
387 | source_element.remove(); | |
388 | }; |
|
388 | }; | |
389 | }; |
|
389 | }; | |
390 |
|
390 | |||
391 |
|
391 | |||
392 | Notebook.prototype.to_markdown = function (index) { |
|
392 | Notebook.prototype.to_markdown = function (index) { | |
393 | // TODO: Bounds check for i |
|
393 | // TODO: Bounds check for i | |
394 | var i = this.index_or_selected(index); |
|
394 | var i = this.index_or_selected(index); | |
395 | var source_element = this.cell_elements().eq(i); |
|
395 | var source_element = this.cell_elements().eq(i); | |
396 | var source_cell = source_element.data("cell"); |
|
396 | var source_cell = source_element.data("cell"); | |
397 | var target_cell = null; |
|
397 | var target_cell = null; | |
398 | if (source_cell instanceof IPython.CodeCell) { |
|
398 | if (source_cell instanceof IPython.CodeCell) { | |
399 | this.insert_markdown_cell_after(i); |
|
399 | this.insert_markdown_cell_after(i); | |
400 | var target_cell = this.cells()[i+1]; |
|
400 | var target_cell = this.cells()[i+1]; | |
401 | var text = source_cell.get_code(); |
|
401 | var text = source_cell.get_code(); | |
402 | } else if (source_cell instanceof IPython.HTMLCell) { |
|
402 | } else if (source_cell instanceof IPython.HTMLCell) { | |
403 | this.insert_markdown_cell_after(i); |
|
403 | this.insert_markdown_cell_after(i); | |
404 | var target_cell = this.cells()[i+1]; |
|
404 | var target_cell = this.cells()[i+1]; | |
405 | var text = source_cell.get_source(); |
|
405 | var text = source_cell.get_source(); | |
406 | if (text === source_cell.placeholder) { |
|
406 | if (text === source_cell.placeholder) { | |
407 | text = target_cell.placeholder; |
|
407 | text = target_cell.placeholder; | |
408 | } |
|
408 | } | |
409 | } |
|
409 | } | |
410 | if (target_cell !== null) { |
|
410 | if (target_cell !== null) { | |
411 | if (text === "") {text = target_cell.placeholder;}; |
|
411 | if (text === "") {text = target_cell.placeholder;}; | |
412 | target_cell.set_source(text); |
|
412 | target_cell.set_source(text); | |
413 | source_element.remove(); |
|
413 | source_element.remove(); | |
414 | target_cell.edit(); |
|
414 | target_cell.edit(); | |
415 | } |
|
415 | } | |
416 | }; |
|
416 | }; | |
417 |
|
417 | |||
418 |
|
418 | |||
419 | Notebook.prototype.to_html = function (index) { |
|
419 | Notebook.prototype.to_html = function (index) { | |
420 | // TODO: Bounds check for i |
|
420 | // TODO: Bounds check for i | |
421 | var i = this.index_or_selected(index); |
|
421 | var i = this.index_or_selected(index); | |
422 | var source_element = this.cell_elements().eq(i); |
|
422 | var source_element = this.cell_elements().eq(i); | |
423 | var source_cell = source_element.data("cell"); |
|
423 | var source_cell = source_element.data("cell"); | |
424 | var target_cell = null; |
|
424 | var target_cell = null; | |
425 | if (source_cell instanceof IPython.CodeCell) { |
|
425 | if (source_cell instanceof IPython.CodeCell) { | |
426 | this.insert_html_cell_after(i); |
|
426 | this.insert_html_cell_after(i); | |
427 | var target_cell = this.cells()[i+1]; |
|
427 | var target_cell = this.cells()[i+1]; | |
428 | var text = source_cell.get_code(); |
|
428 | var text = source_cell.get_code(); | |
429 | } else if (source_cell instanceof IPython.MarkdownCell) { |
|
429 | } else if (source_cell instanceof IPython.MarkdownCell) { | |
430 | this.insert_html_cell_after(i); |
|
430 | this.insert_html_cell_after(i); | |
431 | var target_cell = this.cells()[i+1]; |
|
431 | var target_cell = this.cells()[i+1]; | |
432 | var text = source_cell.get_source(); |
|
432 | var text = source_cell.get_source(); | |
433 | if (text === source_cell.placeholder) { |
|
433 | if (text === source_cell.placeholder) { | |
434 | text = target_cell.placeholder; |
|
434 | text = target_cell.placeholder; | |
435 | } |
|
435 | } | |
436 | } |
|
436 | } | |
437 | if (target_cell !== null) { |
|
437 | if (target_cell !== null) { | |
438 | if (text === "") {text = target_cell.placeholder;}; |
|
438 | if (text === "") {text = target_cell.placeholder;}; | |
439 | target_cell.set_source(text); |
|
439 | target_cell.set_source(text); | |
440 | source_element.remove(); |
|
440 | source_element.remove(); | |
441 | target_cell.edit(); |
|
441 | target_cell.edit(); | |
442 | } |
|
442 | } | |
443 | }; |
|
443 | }; | |
444 |
|
444 | |||
445 |
|
445 | |||
446 | // Cell collapsing |
|
446 | // Cell collapsing and output clearing | |
447 |
|
447 | |||
448 | Notebook.prototype.collapse = function (index) { |
|
448 | Notebook.prototype.collapse = function (index) { | |
449 | var i = this.index_or_selected(index); |
|
449 | var i = this.index_or_selected(index); | |
450 | this.cells()[i].collapse(); |
|
450 | this.cells()[i].collapse(); | |
451 | }; |
|
451 | }; | |
452 |
|
452 | |||
453 |
|
453 | |||
454 | Notebook.prototype.expand = function (index) { |
|
454 | Notebook.prototype.expand = function (index) { | |
455 | var i = this.index_or_selected(index); |
|
455 | var i = this.index_or_selected(index); | |
456 | this.cells()[i].expand(); |
|
456 | this.cells()[i].expand(); | |
457 | }; |
|
457 | }; | |
458 |
|
458 | |||
459 |
|
459 | |||
460 | Notebook.prototype.set_autoindent = function (state) { |
|
460 | Notebook.prototype.set_autoindent = function (state) { | |
461 | var cells = this.cells(); |
|
461 | var cells = this.cells(); | |
462 | len = cells.length; |
|
462 | len = cells.length; | |
463 | for (var i=0; i<len; i++) { |
|
463 | for (var i=0; i<len; i++) { | |
464 | cells[i].set_autoindent(state) |
|
464 | cells[i].set_autoindent(state) | |
465 | }; |
|
465 | }; | |
466 | }; |
|
466 | }; | |
467 |
|
467 | |||
|
468 | ||||
|
469 | Notebook.prototype.clear_all_output = function () { | |||
|
470 | var ncells = this.ncells(); | |||
|
471 | var cells = this.cells(); | |||
|
472 | for (var i=0; i<ncells; i++) { | |||
|
473 | if (cells[i] instanceof IPython.CodeCell) { | |||
|
474 | cells[i].clear_output(); | |||
|
475 | } | |||
|
476 | }; | |||
|
477 | }; | |||
|
478 | ||||
|
479 | ||||
468 | // Kernel related things |
|
480 | // Kernel related things | |
469 |
|
481 | |||
470 | Notebook.prototype.start_kernel = function () { |
|
482 | Notebook.prototype.start_kernel = function () { | |
471 | this.kernel = new IPython.Kernel(); |
|
483 | this.kernel = new IPython.Kernel(); | |
472 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
484 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
473 | this.kernel.start_kernel(notebook_id, $.proxy(this.kernel_started, this)); |
|
485 | this.kernel.start_kernel(notebook_id, $.proxy(this.kernel_started, this)); | |
474 | }; |
|
486 | }; | |
475 |
|
487 | |||
476 |
|
488 | |||
477 | Notebook.prototype.handle_shell_reply = function (e) { |
|
489 | Notebook.prototype.handle_shell_reply = function (e) { | |
478 | reply = $.parseJSON(e.data); |
|
490 | reply = $.parseJSON(e.data); | |
479 | var header = reply.header; |
|
491 | var header = reply.header; | |
480 | var content = reply.content; |
|
492 | var content = reply.content; | |
481 | var msg_type = header.msg_type; |
|
493 | var msg_type = header.msg_type; | |
482 | // console.log(reply); |
|
494 | // console.log(reply); | |
483 | var cell = this.cell_for_msg(reply.parent_header.msg_id); |
|
495 | var cell = this.cell_for_msg(reply.parent_header.msg_id); | |
484 | if (msg_type === "execute_reply") { |
|
496 | if (msg_type === "execute_reply") { | |
485 | cell.set_input_prompt(content.execution_count); |
|
497 | cell.set_input_prompt(content.execution_count); | |
486 | } else if (msg_type === "complete_reply") { |
|
498 | } else if (msg_type === "complete_reply") { | |
487 | cell.finish_completing(content.matched_text, content.matches); |
|
499 | cell.finish_completing(content.matched_text, content.matches); | |
488 | }; |
|
500 | }; | |
489 | var payload = content.payload || []; |
|
501 | var payload = content.payload || []; | |
490 | this.handle_payload(cell, payload); |
|
502 | this.handle_payload(cell, payload); | |
491 | }; |
|
503 | }; | |
492 |
|
504 | |||
493 |
|
505 | |||
494 | Notebook.prototype.handle_payload = function (cell, payload) { |
|
506 | Notebook.prototype.handle_payload = function (cell, payload) { | |
495 | var l = payload.length; |
|
507 | var l = payload.length; | |
496 | for (var i=0; i<l; i++) { |
|
508 | for (var i=0; i<l; i++) { | |
497 | if (payload[i].source === 'IPython.zmq.page.page') { |
|
509 | if (payload[i].source === 'IPython.zmq.page.page') { | |
498 | IPython.pager.clear(); |
|
510 | IPython.pager.clear(); | |
499 | IPython.pager.expand(); |
|
511 | IPython.pager.expand(); | |
500 | IPython.pager.append_text(payload[i].text); |
|
512 | IPython.pager.append_text(payload[i].text); | |
501 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { |
|
513 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { | |
502 | var index = this.find_cell_index(cell); |
|
514 | var index = this.find_cell_index(cell); | |
503 | var new_cell = this.insert_code_cell_after(index); |
|
515 | var new_cell = this.insert_code_cell_after(index); | |
504 | new_cell.set_code(payload[i].text); |
|
516 | new_cell.set_code(payload[i].text); | |
505 | } |
|
517 | } | |
506 | }; |
|
518 | }; | |
507 | }; |
|
519 | }; | |
508 |
|
520 | |||
509 |
|
521 | |||
510 | Notebook.prototype.handle_iopub_reply = function (e) { |
|
522 | Notebook.prototype.handle_iopub_reply = function (e) { | |
511 | reply = $.parseJSON(e.data); |
|
523 | reply = $.parseJSON(e.data); | |
512 | var content = reply.content; |
|
524 | var content = reply.content; | |
513 | // console.log(reply); |
|
525 | // console.log(reply); | |
514 | var msg_type = reply.header.msg_type; |
|
526 | var msg_type = reply.header.msg_type; | |
515 | var cell = this.cell_for_msg(reply.parent_header.msg_id); |
|
527 | var cell = this.cell_for_msg(reply.parent_header.msg_id); | |
516 | var output_types = ['stream','display_data','pyout','pyerr']; |
|
528 | var output_types = ['stream','display_data','pyout','pyerr']; | |
517 | if (output_types.indexOf(msg_type) >= 0) { |
|
529 | if (output_types.indexOf(msg_type) >= 0) { | |
518 | this.handle_output(cell, msg_type, content); |
|
530 | this.handle_output(cell, msg_type, content); | |
519 | } else if (msg_type === "status") { |
|
531 | } else if (msg_type === "status") { | |
520 | if (content.execution_state === "busy") { |
|
532 | if (content.execution_state === "busy") { | |
521 | IPython.kernel_status_widget.status_busy(); |
|
533 | IPython.kernel_status_widget.status_busy(); | |
522 | } else if (content.execution_state === "idle") { |
|
534 | } else if (content.execution_state === "idle") { | |
523 | IPython.kernel_status_widget.status_idle(); |
|
535 | IPython.kernel_status_widget.status_idle(); | |
524 | }; |
|
536 | }; | |
525 | } |
|
537 | } | |
526 | }; |
|
538 | }; | |
527 |
|
539 | |||
528 |
|
540 | |||
529 | Notebook.prototype.handle_output = function (cell, msg_type, content) { |
|
541 | Notebook.prototype.handle_output = function (cell, msg_type, content) { | |
530 | var json = {}; |
|
542 | var json = {}; | |
531 | json.output_type = msg_type; |
|
543 | json.output_type = msg_type; | |
532 | if (msg_type === "stream") { |
|
544 | if (msg_type === "stream") { | |
533 | json.text = utils.fixConsole(content.data + '\n'); |
|
545 | json.text = utils.fixConsole(content.data + '\n'); | |
534 | } else if (msg_type === "display_data") { |
|
546 | } else if (msg_type === "display_data") { | |
535 | json = this.convert_mime_types(json, content.data); |
|
547 | json = this.convert_mime_types(json, content.data); | |
536 | } else if (msg_type === "pyout") { |
|
548 | } else if (msg_type === "pyout") { | |
537 | json.prompt_number = content.execution_count; |
|
549 | json.prompt_number = content.execution_count; | |
538 | json = this.convert_mime_types(json, content.data); |
|
550 | json = this.convert_mime_types(json, content.data); | |
539 | } else if (msg_type === "pyerr") { |
|
551 | } else if (msg_type === "pyerr") { | |
540 | json.ename = content.ename; |
|
552 | json.ename = content.ename; | |
541 | json.evalue = content.evalue; |
|
553 | json.evalue = content.evalue; | |
542 | var traceback = []; |
|
554 | var traceback = []; | |
543 | for (var i=0; i<content.traceback.length; i++) { |
|
555 | for (var i=0; i<content.traceback.length; i++) { | |
544 | traceback.push(utils.fixConsole(content.traceback[i])); |
|
556 | traceback.push(utils.fixConsole(content.traceback[i])); | |
545 | } |
|
557 | } | |
546 | json.traceback = traceback; |
|
558 | json.traceback = traceback; | |
547 | }; |
|
559 | }; | |
548 | cell.append_output(json); |
|
560 | cell.append_output(json); | |
549 | }; |
|
561 | }; | |
550 |
|
562 | |||
551 |
|
563 | |||
552 | Notebook.prototype.convert_mime_types = function (json, data) { |
|
564 | Notebook.prototype.convert_mime_types = function (json, data) { | |
553 | if (data['text/plain'] !== undefined) { |
|
565 | if (data['text/plain'] !== undefined) { | |
554 | json.text = utils.fixConsole(data['text/plain']); |
|
566 | json.text = utils.fixConsole(data['text/plain']); | |
555 | }; |
|
567 | }; | |
556 | if (data['text/html'] !== undefined) { |
|
568 | if (data['text/html'] !== undefined) { | |
557 | json.html = data['text/html']; |
|
569 | json.html = data['text/html']; | |
558 | }; |
|
570 | }; | |
559 | if (data['image/svg+xml'] !== undefined) { |
|
571 | if (data['image/svg+xml'] !== undefined) { | |
560 | json.svg = data['image/svg+xml']; |
|
572 | json.svg = data['image/svg+xml']; | |
561 | }; |
|
573 | }; | |
562 | if (data['image/png'] !== undefined) { |
|
574 | if (data['image/png'] !== undefined) { | |
563 | json.png = data['image/png']; |
|
575 | json.png = data['image/png']; | |
564 | }; |
|
576 | }; | |
565 | if (data['image/jpeg'] !== undefined) { |
|
577 | if (data['image/jpeg'] !== undefined) { | |
566 | json.jpeg = data['image/jpeg']; |
|
578 | json.jpeg = data['image/jpeg']; | |
567 | }; |
|
579 | }; | |
568 | if (data['text/latex'] !== undefined) { |
|
580 | if (data['text/latex'] !== undefined) { | |
569 | json.latex = data['text/latex']; |
|
581 | json.latex = data['text/latex']; | |
570 | }; |
|
582 | }; | |
571 | if (data['application/json'] !== undefined) { |
|
583 | if (data['application/json'] !== undefined) { | |
572 | json.json = data['application/json']; |
|
584 | json.json = data['application/json']; | |
573 | }; |
|
585 | }; | |
574 | if (data['application/javascript'] !== undefined) { |
|
586 | if (data['application/javascript'] !== undefined) { | |
575 | json.javascript = data['application/javascript']; |
|
587 | json.javascript = data['application/javascript']; | |
576 | } |
|
588 | } | |
577 | return json; |
|
589 | return json; | |
578 | }; |
|
590 | }; | |
579 |
|
591 | |||
580 | Notebook.prototype.kernel_started = function () { |
|
592 | Notebook.prototype.kernel_started = function () { | |
581 | console.log("Kernel started: ", this.kernel.kernel_id); |
|
593 | console.log("Kernel started: ", this.kernel.kernel_id); | |
582 | this.kernel.shell_channel.onmessage = $.proxy(this.handle_shell_reply,this); |
|
594 | this.kernel.shell_channel.onmessage = $.proxy(this.handle_shell_reply,this); | |
583 | this.kernel.iopub_channel.onmessage = $.proxy(this.handle_iopub_reply,this); |
|
595 | this.kernel.iopub_channel.onmessage = $.proxy(this.handle_iopub_reply,this); | |
584 | }; |
|
596 | }; | |
585 |
|
597 | |||
586 |
|
598 | |||
587 | Notebook.prototype.execute_selected_cell = function (options) { |
|
599 | Notebook.prototype.execute_selected_cell = function (options) { | |
588 | // add_new: should a new cell be added if we are at the end of the nb |
|
600 | // add_new: should a new cell be added if we are at the end of the nb | |
589 | // terminal: execute in terminal mode, which stays in the current cell |
|
601 | // terminal: execute in terminal mode, which stays in the current cell | |
590 | default_options = {terminal: false, add_new: true} |
|
602 | default_options = {terminal: false, add_new: true} | |
591 | $.extend(default_options, options) |
|
603 | $.extend(default_options, options) | |
592 | var that = this; |
|
604 | var that = this; | |
593 | var cell = that.selected_cell(); |
|
605 | var cell = that.selected_cell(); | |
594 | var cell_index = that.find_cell_index(cell); |
|
606 | var cell_index = that.find_cell_index(cell); | |
595 | if (cell instanceof IPython.CodeCell) { |
|
607 | if (cell instanceof IPython.CodeCell) { | |
596 | cell.clear_output(); |
|
608 | cell.clear_output(); | |
597 | var code = cell.get_code(); |
|
609 | var code = cell.get_code(); | |
598 | var msg_id = that.kernel.execute(cell.get_code()); |
|
610 | var msg_id = that.kernel.execute(cell.get_code()); | |
599 | that.msg_cell_map[msg_id] = cell.cell_id; |
|
611 | that.msg_cell_map[msg_id] = cell.cell_id; | |
600 | } else if (cell instanceof IPython.HTMLCell) { |
|
612 | } else if (cell instanceof IPython.HTMLCell) { | |
601 | cell.render(); |
|
613 | cell.render(); | |
602 | } |
|
614 | } | |
603 | if (default_options.terminal) { |
|
615 | if (default_options.terminal) { | |
604 | cell.clear_input(); |
|
616 | cell.clear_input(); | |
605 | } else { |
|
617 | } else { | |
606 | if ((cell_index === (that.ncells()-1)) && default_options.add_new) { |
|
618 | if ((cell_index === (that.ncells()-1)) && default_options.add_new) { | |
607 | that.insert_code_cell_after(); |
|
619 | that.insert_code_cell_after(); | |
608 | // If we are adding a new cell at the end, scroll down to show it. |
|
620 | // If we are adding a new cell at the end, scroll down to show it. | |
609 | that.scroll_to_bottom(); |
|
621 | that.scroll_to_bottom(); | |
610 | } else { |
|
622 | } else { | |
611 | that.select(cell_index+1); |
|
623 | that.select(cell_index+1); | |
612 | }; |
|
624 | }; | |
613 | }; |
|
625 | }; | |
614 | }; |
|
626 | }; | |
615 |
|
627 | |||
616 |
|
628 | |||
617 | Notebook.prototype.execute_all_cells = function () { |
|
629 | Notebook.prototype.execute_all_cells = function () { | |
618 | var ncells = this.ncells(); |
|
630 | var ncells = this.ncells(); | |
619 | for (var i=0; i<ncells; i++) { |
|
631 | for (var i=0; i<ncells; i++) { | |
620 | this.select(i); |
|
632 | this.select(i); | |
621 | this.execute_selected_cell({add_new:false}); |
|
633 | this.execute_selected_cell({add_new:false}); | |
622 | }; |
|
634 | }; | |
623 | this.scroll_to_bottom(); |
|
635 | this.scroll_to_bottom(); | |
624 | }; |
|
636 | }; | |
625 |
|
637 | |||
626 |
|
638 | |||
627 | Notebook.prototype.complete_cell = function (cell, line, cursor_pos) { |
|
639 | Notebook.prototype.complete_cell = function (cell, line, cursor_pos) { | |
628 | var msg_id = this.kernel.complete(line, cursor_pos); |
|
640 | var msg_id = this.kernel.complete(line, cursor_pos); | |
629 | this.msg_cell_map[msg_id] = cell.cell_id; |
|
641 | this.msg_cell_map[msg_id] = cell.cell_id; | |
630 | }; |
|
642 | }; | |
631 |
|
643 | |||
632 | // Persistance and loading |
|
644 | // Persistance and loading | |
633 |
|
645 | |||
634 |
|
646 | |||
635 | Notebook.prototype.fromJSON = function (data) { |
|
647 | Notebook.prototype.fromJSON = function (data) { | |
636 | var ncells = this.ncells(); |
|
648 | var ncells = this.ncells(); | |
637 | for (var i=0; i<ncells; i++) { |
|
649 | for (var i=0; i<ncells; i++) { | |
638 | // Always delete cell 0 as they get renumbered as they are deleted. |
|
650 | // Always delete cell 0 as they get renumbered as they are deleted. | |
639 | this.delete_cell(0); |
|
651 | this.delete_cell(0); | |
640 | }; |
|
652 | }; | |
641 | // Only handle 1 worksheet for now. |
|
653 | // Only handle 1 worksheet for now. | |
642 | var worksheet = data.worksheets[0]; |
|
654 | var worksheet = data.worksheets[0]; | |
643 | if (worksheet !== undefined) { |
|
655 | if (worksheet !== undefined) { | |
644 | var new_cells = worksheet.cells; |
|
656 | var new_cells = worksheet.cells; | |
645 | ncells = new_cells.length; |
|
657 | ncells = new_cells.length; | |
646 | var cell_data = null; |
|
658 | var cell_data = null; | |
647 | var new_cell = null; |
|
659 | var new_cell = null; | |
648 | for (var i=0; i<ncells; i++) { |
|
660 | for (var i=0; i<ncells; i++) { | |
649 | cell_data = new_cells[i]; |
|
661 | cell_data = new_cells[i]; | |
650 | if (cell_data.cell_type == 'code') { |
|
662 | if (cell_data.cell_type == 'code') { | |
651 | new_cell = this.insert_code_cell_after(); |
|
663 | new_cell = this.insert_code_cell_after(); | |
652 | new_cell.fromJSON(cell_data); |
|
664 | new_cell.fromJSON(cell_data); | |
653 | } else if (cell_data.cell_type === 'html') { |
|
665 | } else if (cell_data.cell_type === 'html') { | |
654 | new_cell = this.insert_html_cell_after(); |
|
666 | new_cell = this.insert_html_cell_after(); | |
655 | new_cell.fromJSON(cell_data); |
|
667 | new_cell.fromJSON(cell_data); | |
656 | } else if (cell_data.cell_type === 'markdown') { |
|
668 | } else if (cell_data.cell_type === 'markdown') { | |
657 | new_cell = this.insert_markdown_cell_after(); |
|
669 | new_cell = this.insert_markdown_cell_after(); | |
658 | new_cell.fromJSON(cell_data); |
|
670 | new_cell.fromJSON(cell_data); | |
659 | }; |
|
671 | }; | |
660 | }; |
|
672 | }; | |
661 | }; |
|
673 | }; | |
662 | }; |
|
674 | }; | |
663 |
|
675 | |||
664 |
|
676 | |||
665 | Notebook.prototype.toJSON = function () { |
|
677 | Notebook.prototype.toJSON = function () { | |
666 | var cells = this.cells(); |
|
678 | var cells = this.cells(); | |
667 | var ncells = cells.length; |
|
679 | var ncells = cells.length; | |
668 | cell_array = new Array(ncells); |
|
680 | cell_array = new Array(ncells); | |
669 | for (var i=0; i<ncells; i++) { |
|
681 | for (var i=0; i<ncells; i++) { | |
670 | cell_array[i] = cells[i].toJSON(); |
|
682 | cell_array[i] = cells[i].toJSON(); | |
671 | }; |
|
683 | }; | |
672 | data = { |
|
684 | data = { | |
673 | // Only handle 1 worksheet for now. |
|
685 | // Only handle 1 worksheet for now. | |
674 | worksheets : [{cells:cell_array}] |
|
686 | worksheets : [{cells:cell_array}] | |
675 | } |
|
687 | } | |
676 | return data |
|
688 | return data | |
677 | }; |
|
689 | }; | |
678 |
|
690 | |||
679 | Notebook.prototype.save_notebook = function () { |
|
691 | Notebook.prototype.save_notebook = function () { | |
680 | if (IPython.save_widget.test_notebook_name()) { |
|
692 | if (IPython.save_widget.test_notebook_name()) { | |
681 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
693 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
682 | var nbname = IPython.save_widget.get_notebook_name(); |
|
694 | var nbname = IPython.save_widget.get_notebook_name(); | |
683 | // We may want to move the name/id/nbformat logic inside toJSON? |
|
695 | // We may want to move the name/id/nbformat logic inside toJSON? | |
684 | var data = this.toJSON(); |
|
696 | var data = this.toJSON(); | |
685 | data.name = nbname; |
|
697 | data.name = nbname; | |
686 | data.nbformat = 2; |
|
698 | data.nbformat = 2; | |
687 | data.id = notebook_id |
|
699 | data.id = notebook_id | |
688 | // We do the call with settings so we can set cache to false. |
|
700 | // We do the call with settings so we can set cache to false. | |
689 | var settings = { |
|
701 | var settings = { | |
690 | processData : false, |
|
702 | processData : false, | |
691 | cache : false, |
|
703 | cache : false, | |
692 | type : "PUT", |
|
704 | type : "PUT", | |
693 | data : JSON.stringify(data), |
|
705 | data : JSON.stringify(data), | |
694 | headers : {'Content-Type': 'application/json'}, |
|
706 | headers : {'Content-Type': 'application/json'}, | |
695 | success : $.proxy(this.notebook_saved,this) |
|
707 | success : $.proxy(this.notebook_saved,this) | |
696 | }; |
|
708 | }; | |
697 | IPython.save_widget.status_saving(); |
|
709 | IPython.save_widget.status_saving(); | |
698 | $.ajax("/notebooks/" + notebook_id, settings); |
|
710 | $.ajax("/notebooks/" + notebook_id, settings); | |
699 | }; |
|
711 | }; | |
700 | }; |
|
712 | }; | |
701 |
|
713 | |||
702 |
|
714 | |||
703 | Notebook.prototype.notebook_saved = function (data, status, xhr) { |
|
715 | Notebook.prototype.notebook_saved = function (data, status, xhr) { | |
704 | setTimeout($.proxy(IPython.save_widget.status_save,IPython.save_widget),500); |
|
716 | setTimeout($.proxy(IPython.save_widget.status_save,IPython.save_widget),500); | |
705 | } |
|
717 | } | |
706 |
|
718 | |||
707 |
|
719 | |||
708 | Notebook.prototype.load_notebook = function (callback) { |
|
720 | Notebook.prototype.load_notebook = function (callback) { | |
709 | var that = this; |
|
721 | var that = this; | |
710 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
722 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
711 | // We do the call with settings so we can set cache to false. |
|
723 | // We do the call with settings so we can set cache to false. | |
712 | var settings = { |
|
724 | var settings = { | |
713 | processData : false, |
|
725 | processData : false, | |
714 | cache : false, |
|
726 | cache : false, | |
715 | type : "GET", |
|
727 | type : "GET", | |
716 | dataType : "json", |
|
728 | dataType : "json", | |
717 | success : function (data, status, xhr) { |
|
729 | success : function (data, status, xhr) { | |
718 | that.notebook_loaded(data, status, xhr); |
|
730 | that.notebook_loaded(data, status, xhr); | |
719 | if (callback !== undefined) { |
|
731 | if (callback !== undefined) { | |
720 | callback(); |
|
732 | callback(); | |
721 | }; |
|
733 | }; | |
722 | } |
|
734 | } | |
723 | }; |
|
735 | }; | |
724 | IPython.save_widget.status_loading(); |
|
736 | IPython.save_widget.status_loading(); | |
725 | $.ajax("/notebooks/" + notebook_id, settings); |
|
737 | $.ajax("/notebooks/" + notebook_id, settings); | |
726 | } |
|
738 | } | |
727 |
|
739 | |||
728 |
|
740 | |||
729 | Notebook.prototype.notebook_loaded = function (data, status, xhr) { |
|
741 | Notebook.prototype.notebook_loaded = function (data, status, xhr) { | |
730 | this.fromJSON(data); |
|
742 | this.fromJSON(data); | |
731 | if (this.ncells() === 0) { |
|
743 | if (this.ncells() === 0) { | |
732 | this.insert_code_cell_after(); |
|
744 | this.insert_code_cell_after(); | |
733 | }; |
|
745 | }; | |
734 | IPython.save_widget.status_save(); |
|
746 | IPython.save_widget.status_save(); | |
735 | IPython.save_widget.set_notebook_name(data.name); |
|
747 | IPython.save_widget.set_notebook_name(data.name); | |
736 | this.start_kernel(); |
|
748 | this.start_kernel(); | |
737 | // fromJSON always selects the last cell inserted. We need to wait |
|
749 | // fromJSON always selects the last cell inserted. We need to wait | |
738 | // until that is done before scrolling to the top. |
|
750 | // until that is done before scrolling to the top. | |
739 | setTimeout(function () { |
|
751 | setTimeout(function () { | |
740 | IPython.notebook.select(0); |
|
752 | IPython.notebook.select(0); | |
741 | IPython.notebook.scroll_to_top(); |
|
753 | IPython.notebook.scroll_to_top(); | |
742 | }, 50); |
|
754 | }, 50); | |
743 | }; |
|
755 | }; | |
744 |
|
756 | |||
745 | IPython.Notebook = Notebook; |
|
757 | IPython.Notebook = Notebook; | |
746 |
|
758 | |||
747 | return IPython; |
|
759 | return IPython; | |
748 |
|
760 | |||
749 | }(IPython)); |
|
761 | }(IPython)); | |
750 |
|
762 |
@@ -1,242 +1,245 | |||||
1 |
|
1 | |||
2 | //============================================================================ |
|
2 | //============================================================================ | |
3 | // Cell |
|
3 | // Cell | |
4 | //============================================================================ |
|
4 | //============================================================================ | |
5 |
|
5 | |||
6 | var IPython = (function (IPython) { |
|
6 | var IPython = (function (IPython) { | |
7 |
|
7 | |||
8 | var utils = IPython.utils; |
|
8 | var utils = IPython.utils; | |
9 |
|
9 | |||
10 | // Base PanelSection class |
|
10 | // Base PanelSection class | |
11 |
|
11 | |||
12 | var PanelSection = function (selector) { |
|
12 | var PanelSection = function (selector) { | |
13 | this.selector = selector; |
|
13 | this.selector = selector; | |
14 | if (this.selector !== undefined) { |
|
14 | if (this.selector !== undefined) { | |
15 | this.element = $(selector); |
|
15 | this.element = $(selector); | |
16 | this.header = this.element.find('h3.section_header'); |
|
16 | this.header = this.element.find('h3.section_header'); | |
17 | this.content = this.element.find('div.section_content'); |
|
17 | this.content = this.element.find('div.section_content'); | |
18 | this.style(); |
|
18 | this.style(); | |
19 | this.bind_events(); |
|
19 | this.bind_events(); | |
20 | } |
|
20 | } | |
21 | this.expanded = true; |
|
21 | this.expanded = true; | |
22 | }; |
|
22 | }; | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | PanelSection.prototype.style = function () { |
|
25 | PanelSection.prototype.style = function () { | |
26 | this.header.addClass('ui-widget ui-state-default'); |
|
26 | this.header.addClass('ui-widget ui-state-default'); | |
27 | this.content.addClass('ui-widget section_content'); |
|
27 | this.content.addClass('ui-widget section_content'); | |
28 | }; |
|
28 | }; | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | PanelSection.prototype.bind_events = function () { |
|
31 | PanelSection.prototype.bind_events = function () { | |
32 | var that = this; |
|
32 | var that = this; | |
33 | this.header.click(function () { |
|
33 | this.header.click(function () { | |
34 | that.toggle(); |
|
34 | that.toggle(); | |
35 | }); |
|
35 | }); | |
36 | this.header.hover(function () { |
|
36 | this.header.hover(function () { | |
37 | that.header.toggleClass('ui-state-hover'); |
|
37 | that.header.toggleClass('ui-state-hover'); | |
38 | }); |
|
38 | }); | |
39 | }; |
|
39 | }; | |
40 |
|
40 | |||
41 |
|
41 | |||
42 | PanelSection.prototype.expand = function () { |
|
42 | PanelSection.prototype.expand = function () { | |
43 | if (!this.expanded) { |
|
43 | if (!this.expanded) { | |
44 | this.content.slideDown('fast'); |
|
44 | this.content.slideDown('fast'); | |
45 | this.expanded = true; |
|
45 | this.expanded = true; | |
46 | }; |
|
46 | }; | |
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | PanelSection.prototype.collapse = function () { |
|
50 | PanelSection.prototype.collapse = function () { | |
51 | if (this.expanded) { |
|
51 | if (this.expanded) { | |
52 | this.content.slideUp('fast'); |
|
52 | this.content.slideUp('fast'); | |
53 | this.expanded = false; |
|
53 | this.expanded = false; | |
54 | }; |
|
54 | }; | |
55 | }; |
|
55 | }; | |
56 |
|
56 | |||
57 |
|
57 | |||
58 | PanelSection.prototype.toggle = function () { |
|
58 | PanelSection.prototype.toggle = function () { | |
59 | if (this.expanded === true) { |
|
59 | if (this.expanded === true) { | |
60 | this.collapse(); |
|
60 | this.collapse(); | |
61 | } else { |
|
61 | } else { | |
62 | this.expand(); |
|
62 | this.expand(); | |
63 | }; |
|
63 | }; | |
64 | }; |
|
64 | }; | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | PanelSection.prototype.create_children = function () {}; |
|
67 | PanelSection.prototype.create_children = function () {}; | |
68 |
|
68 | |||
69 |
|
69 | |||
70 | // NotebookSection |
|
70 | // NotebookSection | |
71 |
|
71 | |||
72 | var NotebookSection = function () { |
|
72 | var NotebookSection = function () { | |
73 | PanelSection.apply(this, arguments); |
|
73 | PanelSection.apply(this, arguments); | |
74 | }; |
|
74 | }; | |
75 |
|
75 | |||
76 |
|
76 | |||
77 | NotebookSection.prototype = new PanelSection(); |
|
77 | NotebookSection.prototype = new PanelSection(); | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | NotebookSection.prototype.style = function () { |
|
80 | NotebookSection.prototype.style = function () { | |
81 | PanelSection.prototype.style.apply(this); |
|
81 | PanelSection.prototype.style.apply(this); | |
82 | this.content.addClass('ui-helper-clearfix'); |
|
82 | this.content.addClass('ui-helper-clearfix'); | |
83 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); |
|
83 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |
84 | this.content.find('#new_open').buttonset(); |
|
84 | this.content.find('#new_open').buttonset(); | |
85 | this.content.find('#download_notebook').button(); |
|
85 | this.content.find('#download_notebook').button(); | |
86 | this.content.find('#upload_notebook').button(); |
|
86 | this.content.find('#upload_notebook').button(); | |
87 | this.content.find('#download_format').addClass('ui-widget ui-widget-content'); |
|
87 | this.content.find('#download_format').addClass('ui-widget ui-widget-content'); | |
88 | this.content.find('#download_format option').addClass('ui-widget ui-widget-content'); |
|
88 | this.content.find('#download_format option').addClass('ui-widget ui-widget-content'); | |
89 | }; |
|
89 | }; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | NotebookSection.prototype.bind_events = function () { |
|
92 | NotebookSection.prototype.bind_events = function () { | |
93 | PanelSection.prototype.bind_events.apply(this); |
|
93 | PanelSection.prototype.bind_events.apply(this); | |
94 | var that = this; |
|
94 | var that = this; | |
95 | this.content.find('#new_notebook').click(function () { |
|
95 | this.content.find('#new_notebook').click(function () { | |
96 | window.open('/new'); |
|
96 | window.open('/new'); | |
97 | }); |
|
97 | }); | |
98 | this.content.find('#open_notebook').click(function () { |
|
98 | this.content.find('#open_notebook').click(function () { | |
99 | window.open('/'); |
|
99 | window.open('/'); | |
100 | }); |
|
100 | }); | |
101 | this.content.find('#download_notebook').click(function () { |
|
101 | this.content.find('#download_notebook').click(function () { | |
102 | var format = that.content.find('#download_format').val(); |
|
102 | var format = that.content.find('#download_format').val(); | |
103 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
103 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
104 | var url = '/notebooks/' + notebook_id + '?format=' + format; |
|
104 | var url = '/notebooks/' + notebook_id + '?format=' + format; | |
105 | window.open(url,'_newtab'); |
|
105 | window.open(url,'_newtab'); | |
106 | }); |
|
106 | }); | |
107 | }; |
|
107 | }; | |
108 |
|
108 | |||
109 | // CellSection |
|
109 | // CellSection | |
110 |
|
110 | |||
111 | var CellSection = function () { |
|
111 | var CellSection = function () { | |
112 | PanelSection.apply(this, arguments); |
|
112 | PanelSection.apply(this, arguments); | |
113 | }; |
|
113 | }; | |
114 |
|
114 | |||
115 |
|
115 | |||
116 | CellSection.prototype = new PanelSection(); |
|
116 | CellSection.prototype = new PanelSection(); | |
117 |
|
117 | |||
118 |
|
118 | |||
119 | CellSection.prototype.style = function () { |
|
119 | CellSection.prototype.style = function () { | |
120 | PanelSection.prototype.style.apply(this); |
|
120 | PanelSection.prototype.style.apply(this); | |
121 | this.content.addClass('ui-helper-clearfix'); |
|
121 | this.content.addClass('ui-helper-clearfix'); | |
122 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); |
|
122 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |
123 | this.content.find('#delete_cell').button(); |
|
123 | this.content.find('#delete_cell').button(); | |
124 | this.content.find('#insert').buttonset(); |
|
124 | this.content.find('#insert').buttonset(); | |
125 | this.content.find('#move').buttonset(); |
|
125 | this.content.find('#move').buttonset(); | |
126 | this.content.find('#cell_type').buttonset(); |
|
126 | this.content.find('#cell_type').buttonset(); | |
127 | this.content.find('#toggle_output').buttonset(); |
|
127 | this.content.find('#toggle_output').buttonset(); | |
128 | this.content.find('#run_cells').buttonset(); |
|
128 | this.content.find('#run_cells').buttonset(); | |
129 | }; |
|
129 | }; | |
130 |
|
130 | |||
131 |
|
131 | |||
132 | CellSection.prototype.bind_events = function () { |
|
132 | CellSection.prototype.bind_events = function () { | |
133 | PanelSection.prototype.bind_events.apply(this); |
|
133 | PanelSection.prototype.bind_events.apply(this); | |
134 | this.content.find('#collapse_cell').click(function () { |
|
134 | this.content.find('#collapse_cell').click(function () { | |
135 | IPython.notebook.collapse(); |
|
135 | IPython.notebook.collapse(); | |
136 | }); |
|
136 | }); | |
137 | this.content.find('#expand_cell').click(function () { |
|
137 | this.content.find('#expand_cell').click(function () { | |
138 | IPython.notebook.expand(); |
|
138 | IPython.notebook.expand(); | |
139 | }); |
|
139 | }); | |
|
140 | this.content.find('#clear_all_output').click(function () { | |||
|
141 | IPython.notebook.clear_all_output(); | |||
|
142 | }); | |||
140 | this.content.find('#delete_cell').click(function () { |
|
143 | this.content.find('#delete_cell').click(function () { | |
141 | IPython.notebook.delete_cell(); |
|
144 | IPython.notebook.delete_cell(); | |
142 | }); |
|
145 | }); | |
143 | this.content.find('#insert_cell_above').click(function () { |
|
146 | this.content.find('#insert_cell_above').click(function () { | |
144 | IPython.notebook.insert_code_cell_before(); |
|
147 | IPython.notebook.insert_code_cell_before(); | |
145 | }); |
|
148 | }); | |
146 | this.content.find('#insert_cell_below').click(function () { |
|
149 | this.content.find('#insert_cell_below').click(function () { | |
147 | IPython.notebook.insert_code_cell_after(); |
|
150 | IPython.notebook.insert_code_cell_after(); | |
148 | }); |
|
151 | }); | |
149 | this.content.find('#move_cell_up').click(function () { |
|
152 | this.content.find('#move_cell_up').click(function () { | |
150 | IPython.notebook.move_cell_up(); |
|
153 | IPython.notebook.move_cell_up(); | |
151 | }); |
|
154 | }); | |
152 | this.content.find('#move_cell_down').click(function () { |
|
155 | this.content.find('#move_cell_down').click(function () { | |
153 | IPython.notebook.move_cell_down(); |
|
156 | IPython.notebook.move_cell_down(); | |
154 | }); |
|
157 | }); | |
155 | this.content.find('#to_code').click(function () { |
|
158 | this.content.find('#to_code').click(function () { | |
156 | IPython.notebook.to_code(); |
|
159 | IPython.notebook.to_code(); | |
157 | }); |
|
160 | }); | |
158 | this.content.find('#to_html').click(function () { |
|
161 | this.content.find('#to_html').click(function () { | |
159 | IPython.notebook.to_html(); |
|
162 | IPython.notebook.to_html(); | |
160 | }); |
|
163 | }); | |
161 | this.content.find('#to_markdown').click(function () { |
|
164 | this.content.find('#to_markdown').click(function () { | |
162 | IPython.notebook.to_markdown(); |
|
165 | IPython.notebook.to_markdown(); | |
163 | }); |
|
166 | }); | |
164 | this.content.find('#run_selected_cell').click(function () { |
|
167 | this.content.find('#run_selected_cell').click(function () { | |
165 | IPython.notebook.execute_selected_cell(); |
|
168 | IPython.notebook.execute_selected_cell(); | |
166 | }); |
|
169 | }); | |
167 | this.content.find('#run_all_cells').click(function () { |
|
170 | this.content.find('#run_all_cells').click(function () { | |
168 | IPython.notebook.execute_all_cells(); |
|
171 | IPython.notebook.execute_all_cells(); | |
169 | }); |
|
172 | }); | |
170 | this.content.find('#autoindent').change(function () { |
|
173 | this.content.find('#autoindent').change(function () { | |
171 | var state = $('#autoindent').prop('checked'); |
|
174 | var state = $('#autoindent').prop('checked'); | |
172 | IPython.notebook.set_autoindent(state); |
|
175 | IPython.notebook.set_autoindent(state); | |
173 | }); |
|
176 | }); | |
174 | }; |
|
177 | }; | |
175 |
|
178 | |||
176 |
|
179 | |||
177 | // KernelSection |
|
180 | // KernelSection | |
178 |
|
181 | |||
179 | var KernelSection = function () { |
|
182 | var KernelSection = function () { | |
180 | PanelSection.apply(this, arguments); |
|
183 | PanelSection.apply(this, arguments); | |
181 | }; |
|
184 | }; | |
182 |
|
185 | |||
183 |
|
186 | |||
184 | KernelSection.prototype = new PanelSection(); |
|
187 | KernelSection.prototype = new PanelSection(); | |
185 |
|
188 | |||
186 |
|
189 | |||
187 | KernelSection.prototype.style = function () { |
|
190 | KernelSection.prototype.style = function () { | |
188 | PanelSection.prototype.style.apply(this); |
|
191 | PanelSection.prototype.style.apply(this); | |
189 | this.content.addClass('ui-helper-clearfix'); |
|
192 | this.content.addClass('ui-helper-clearfix'); | |
190 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); |
|
193 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |
191 | this.content.find('#int_restart').buttonset(); |
|
194 | this.content.find('#int_restart').buttonset(); | |
192 | }; |
|
195 | }; | |
193 |
|
196 | |||
194 |
|
197 | |||
195 | KernelSection.prototype.bind_events = function () { |
|
198 | KernelSection.prototype.bind_events = function () { | |
196 | PanelSection.prototype.bind_events.apply(this); |
|
199 | PanelSection.prototype.bind_events.apply(this); | |
197 | this.content.find('#restart_kernel').click(function () { |
|
200 | this.content.find('#restart_kernel').click(function () { | |
198 | IPython.notebook.kernel.restart(); |
|
201 | IPython.notebook.kernel.restart(); | |
199 | }); |
|
202 | }); | |
200 | this.content.find('#int_kernel').click(function () { |
|
203 | this.content.find('#int_kernel').click(function () { | |
201 | IPython.notebook.kernel.interrupt(); |
|
204 | IPython.notebook.kernel.interrupt(); | |
202 | }); |
|
205 | }); | |
203 | }; |
|
206 | }; | |
204 |
|
207 | |||
205 |
|
208 | |||
206 | // HelpSection |
|
209 | // HelpSection | |
207 |
|
210 | |||
208 | var HelpSection = function () { |
|
211 | var HelpSection = function () { | |
209 | PanelSection.apply(this, arguments); |
|
212 | PanelSection.apply(this, arguments); | |
210 | }; |
|
213 | }; | |
211 |
|
214 | |||
212 |
|
215 | |||
213 | HelpSection.prototype = new PanelSection(); |
|
216 | HelpSection.prototype = new PanelSection(); | |
214 |
|
217 | |||
215 |
|
218 | |||
216 | HelpSection.prototype.style = function () { |
|
219 | HelpSection.prototype.style = function () { | |
217 | PanelSection.prototype.style.apply(this); |
|
220 | PanelSection.prototype.style.apply(this); | |
218 | PanelSection.prototype.style.apply(this); |
|
221 | PanelSection.prototype.style.apply(this); | |
219 | this.content.addClass('ui-helper-clearfix'); |
|
222 | this.content.addClass('ui-helper-clearfix'); | |
220 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); |
|
223 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |
221 | this.content.find('#help_buttons0').buttonset(); |
|
224 | this.content.find('#help_buttons0').buttonset(); | |
222 | this.content.find('#help_buttons1').buttonset(); |
|
225 | this.content.find('#help_buttons1').buttonset(); | |
223 | }; |
|
226 | }; | |
224 |
|
227 | |||
225 |
|
228 | |||
226 | HelpSection.prototype.bind_events = function () { |
|
229 | HelpSection.prototype.bind_events = function () { | |
227 | PanelSection.prototype.bind_events.apply(this); |
|
230 | PanelSection.prototype.bind_events.apply(this); | |
228 | }; |
|
231 | }; | |
229 |
|
232 | |||
230 |
|
233 | |||
231 | // Set module variables |
|
234 | // Set module variables | |
232 |
|
235 | |||
233 | IPython.PanelSection = PanelSection; |
|
236 | IPython.PanelSection = PanelSection; | |
234 | IPython.NotebookSection = NotebookSection; |
|
237 | IPython.NotebookSection = NotebookSection; | |
235 | IPython.CellSection = CellSection; |
|
238 | IPython.CellSection = CellSection; | |
236 | IPython.KernelSection = KernelSection; |
|
239 | IPython.KernelSection = KernelSection; | |
237 | IPython.HelpSection = HelpSection; |
|
240 | IPython.HelpSection = HelpSection; | |
238 |
|
241 | |||
239 | return IPython; |
|
242 | return IPython; | |
240 |
|
243 | |||
241 | }(IPython)); |
|
244 | }(IPython)); | |
242 |
|
245 |
@@ -1,223 +1,224 | |||||
1 | <!DOCTYPE HTML> |
|
1 | <!DOCTYPE HTML> | |
2 | <html> |
|
2 | <html> | |
3 |
|
3 | |||
4 | <head> |
|
4 | <head> | |
5 | <meta charset="utf-8"> |
|
5 | <meta charset="utf-8"> | |
6 |
|
6 | |||
7 | <title>IPython Notebook</title> |
|
7 | <title>IPython Notebook</title> | |
8 |
|
8 | |||
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> |
|
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> | |
10 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> --> |
|
10 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> --> | |
11 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.14.custom.css" type="text/css" />--> |
|
11 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.14.custom.css" type="text/css" />--> | |
12 |
|
12 | |||
13 | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> |
|
13 | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> | |
14 | <!-- <script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script> --> |
|
14 | <!-- <script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script> --> | |
15 | <script type="text/javascript"> |
|
15 | <script type="text/javascript"> | |
16 | if (typeof MathJax == 'undefined') { |
|
16 | if (typeof MathJax == 'undefined') { | |
17 | console.log("Trying to load local copy of MathJax"); |
|
17 | console.log("Trying to load local copy of MathJax"); | |
18 | document.write(unescape("%3Cscript type='text/javascript' src='static/mathjax/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E")); |
|
18 | document.write(unescape("%3Cscript type='text/javascript' src='static/mathjax/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E")); | |
19 | } |
|
19 | } | |
20 | </script> |
|
20 | </script> | |
21 |
|
21 | |||
22 | <link rel="stylesheet" href="static/codemirror-2.12/lib/codemirror.css"> |
|
22 | <link rel="stylesheet" href="static/codemirror-2.12/lib/codemirror.css"> | |
23 | <link rel="stylesheet" href="static/codemirror-2.12/mode/rst/rst.css"> |
|
23 | <link rel="stylesheet" href="static/codemirror-2.12/mode/rst/rst.css"> | |
24 | <link rel="stylesheet" href="static/codemirror-2.12/theme/ipython.css"> |
|
24 | <link rel="stylesheet" href="static/codemirror-2.12/theme/ipython.css"> | |
25 | <link rel="stylesheet" href="static/codemirror-2.12/theme/default.css"> |
|
25 | <link rel="stylesheet" href="static/codemirror-2.12/theme/default.css"> | |
26 |
|
26 | |||
27 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> |
|
27 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> | |
28 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> |
|
28 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> | |
29 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> |
|
29 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> | |
30 | <link rel="stylesheet" href="static/css/notebook.css" type="text/css" /> |
|
30 | <link rel="stylesheet" href="static/css/notebook.css" type="text/css" /> | |
31 | <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" /> |
|
31 | <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" /> | |
32 |
|
32 | |||
33 |
|
33 | |||
34 | </head> |
|
34 | </head> | |
35 |
|
35 | |||
36 | <body> |
|
36 | <body> | |
37 |
|
37 | |||
38 | <div id="header"> |
|
38 | <div id="header"> | |
39 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
39 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> | |
40 | <span id="save_widget"> |
|
40 | <span id="save_widget"> | |
41 | <input type="text" id="notebook_name" size="20"></textarea> |
|
41 | <input type="text" id="notebook_name" size="20"></textarea> | |
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> |
|
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> | |
43 | <button id="save_notebook">Save</button> |
|
43 | <button id="save_notebook">Save</button> | |
44 | </span> |
|
44 | </span> | |
45 | <span id="kernel_status">Idle</span> |
|
45 | <span id="kernel_status">Idle</span> | |
46 | </div> |
|
46 | </div> | |
47 |
|
47 | |||
48 | <div id="main_app"> |
|
48 | <div id="main_app"> | |
49 |
|
49 | |||
50 | <div id="left_panel"> |
|
50 | <div id="left_panel"> | |
51 |
|
51 | |||
52 | <div id="notebook_section"> |
|
52 | <div id="notebook_section"> | |
53 | <h3 class="section_header">Notebook</h3> |
|
53 | <h3 class="section_header">Notebook</h3> | |
54 | <div class="section_content"> |
|
54 | <div class="section_content"> | |
55 | <div class="section_row"> |
|
55 | <div class="section_row"> | |
56 | <span id="new_open" class="section_row_buttons"> |
|
56 | <span id="new_open" class="section_row_buttons"> | |
57 | <button id="new_notebook">New</button> |
|
57 | <button id="new_notebook">New</button> | |
58 | <button id="open_notebook">Open</button> |
|
58 | <button id="open_notebook">Open</button> | |
59 | </span> |
|
59 | </span> | |
60 | <span class="section_row_header">Actions</span> |
|
60 | <span class="section_row_header">Actions</span> | |
61 | </div> |
|
61 | </div> | |
62 | <div class="section_row"> |
|
62 | <div class="section_row"> | |
63 | <span> |
|
63 | <span> | |
64 | <select id="download_format"> |
|
64 | <select id="download_format"> | |
65 | <option value="xml">xml</option> |
|
65 | <option value="xml">xml</option> | |
66 | <option value="json">json</option> |
|
66 | <option value="json">json</option> | |
67 | <option value="py">py</option> |
|
67 | <option value="py">py</option> | |
68 | </select> |
|
68 | </select> | |
69 | </span> |
|
69 | </span> | |
70 | <span class="section_row_buttons"> |
|
70 | <span class="section_row_buttons"> | |
71 | <button id="download_notebook">Export As</button> |
|
71 | <button id="download_notebook">Export As</button> | |
72 | </span> |
|
72 | </span> | |
73 | </div> |
|
73 | </div> | |
74 | </div> |
|
74 | </div> | |
75 | </div> |
|
75 | </div> | |
76 |
|
76 | |||
77 | <div id="cell_section"> |
|
77 | <div id="cell_section"> | |
78 | <h3 class="section_header">Cell</h3> |
|
78 | <h3 class="section_header">Cell</h3> | |
79 | <div class="section_content"> |
|
79 | <div class="section_content"> | |
80 | <div class="section_row"> |
|
80 | <div class="section_row"> | |
81 | <span class="section_row_buttons"> |
|
81 | <span class="section_row_buttons"> | |
82 | <button id="delete_cell">Delete</button> |
|
82 | <button id="delete_cell">Delete</button> | |
83 | </span> |
|
83 | </span> | |
84 | <span class="section_row_header">Actions</span> |
|
84 | <span class="section_row_header">Actions</span> | |
85 | </div> |
|
85 | </div> | |
86 | <div class="section_row"> |
|
86 | <div class="section_row"> | |
87 | <span id="cell_type" class="section_row_buttons"> |
|
87 | <span id="cell_type" class="section_row_buttons"> | |
88 | <button id="to_code">Code</button> |
|
88 | <button id="to_code">Code</button> | |
89 | <button id="to_html">HTML</button> |
|
89 | <button id="to_html">HTML</button> | |
90 | <button id="to_markdown">Markdown</button> |
|
90 | <button id="to_markdown">Markdown</button> | |
91 | </span> |
|
91 | </span> | |
92 |
|
|
92 | <span class="button_label">Format</span> | |
|
93 | </div> | |||
|
94 | <div class="section_row"> | |||
|
95 | <span id="toggle_output" class="section_row_buttons"> | |||
|
96 | <button id="collapse_cell">Collapse</button> | |||
|
97 | <button id="expand_cell">Expand</button> | |||
|
98 | <button id="clear_all_output">Clear All</button> | |||
|
99 | </span> | |||
|
100 | <span class="button_label">Output</span> | |||
93 | </div> |
|
101 | </div> | |
94 | <div class="section_row"> |
|
102 | <div class="section_row"> | |
95 | <span id="insert" class="section_row_buttons"> |
|
103 | <span id="insert" class="section_row_buttons"> | |
96 | <button id="insert_cell_above">Above</button> |
|
104 | <button id="insert_cell_above">Above</button> | |
97 | <button id="insert_cell_below">Below</button> |
|
105 | <button id="insert_cell_below">Below</button> | |
98 | </span> |
|
106 | </span> | |
99 | <span class="button_label">Insert</span> |
|
107 | <span class="button_label">Insert</span> | |
100 | </div> |
|
108 | </div> | |
101 | <div class="section_row"> |
|
109 | <div class="section_row"> | |
102 | <span id="move" class="section_row_buttons"> |
|
110 | <span id="move" class="section_row_buttons"> | |
103 | <button id="move_cell_up">Up</button> |
|
111 | <button id="move_cell_up">Up</button> | |
104 | <button id="move_cell_down">Down</button> |
|
112 | <button id="move_cell_down">Down</button> | |
105 | </span> |
|
113 | </span> | |
106 | <span class="button_label">Move</span> |
|
114 | <span class="button_label">Move</span> | |
107 | </div> |
|
115 | </div> | |
108 | <div class="section_row"> |
|
116 | <div class="section_row"> | |
109 | <span id="toggle_output" class="section_row_buttons"> |
|
|||
110 | <button id="collapse_cell">Collapse</button> |
|
|||
111 | <button id="expand_cell">Expand</button> |
|
|||
112 | </span> |
|
|||
113 | <span class="button_label">Output</span> |
|
|||
114 | </div> |
|
|||
115 | <div class="section_row"> |
|
|||
116 | <span id="run_cells" class="section_row_buttons"> |
|
117 | <span id="run_cells" class="section_row_buttons"> | |
117 | <button id="run_selected_cell">Selected</button> |
|
118 | <button id="run_selected_cell">Selected</button> | |
118 | <button id="run_all_cells">All</button> |
|
119 | <button id="run_all_cells">All</button> | |
119 | </span> |
|
120 | </span> | |
120 | <span class="button_label">Run</span> |
|
121 | <span class="button_label">Run</span> | |
121 | </div> |
|
122 | </div> | |
122 | <div class="section_row"> |
|
123 | <div class="section_row"> | |
123 | <span id="autoindent_span"> |
|
124 | <span id="autoindent_span"> | |
124 | <input type="checkbox" id="autoindent" checked="true"></input> |
|
125 | <input type="checkbox" id="autoindent" checked="true"></input> | |
125 | </span> |
|
126 | </span> | |
126 | <span class="checkbox_label">Autoindent:</span> |
|
127 | <span class="checkbox_label">Autoindent:</span> | |
127 | </div> |
|
128 | </div> | |
128 | </div> |
|
129 | </div> | |
129 | </div> |
|
130 | </div> | |
130 |
|
131 | |||
131 | <div id="kernel_section"> |
|
132 | <div id="kernel_section"> | |
132 | <h3 class="section_header">Kernel</h3> |
|
133 | <h3 class="section_header">Kernel</h3> | |
133 | <div class="section_content"> |
|
134 | <div class="section_content"> | |
134 | <div class="section_row"> |
|
135 | <div class="section_row"> | |
135 | <span id="int_restart" class="section_row_buttons"> |
|
136 | <span id="int_restart" class="section_row_buttons"> | |
136 | <button id="int_kernel">Interrupt</button> |
|
137 | <button id="int_kernel">Interrupt</button> | |
137 | <button id="restart_kernel">Restart</button> |
|
138 | <button id="restart_kernel">Restart</button> | |
138 | </span> |
|
139 | </span> | |
139 | <span class="section_row_header">Actions</span> |
|
140 | <span class="section_row_header">Actions</span> | |
140 | </div> |
|
141 | </div> | |
141 | <div class="section_row"> |
|
142 | <div class="section_row"> | |
142 | <span id="kernel_persist"> |
|
143 | <span id="kernel_persist"> | |
143 | <input type="checkbox" id="kill_kernel"></input> |
|
144 | <input type="checkbox" id="kill_kernel"></input> | |
144 | </span> |
|
145 | </span> | |
145 | <span class="checkbox_label">Kill kernel upon exit:</span> |
|
146 | <span class="checkbox_label">Kill kernel upon exit:</span> | |
146 | </div> |
|
147 | </div> | |
147 | </div> |
|
148 | </div> | |
148 | </div> |
|
149 | </div> | |
149 |
|
150 | |||
150 | <div id="help_section"> |
|
151 | <div id="help_section"> | |
151 | <h3 class="section_header">Help</h3> |
|
152 | <h3 class="section_header">Help</h3> | |
152 | <div class="section_content"> |
|
153 | <div class="section_content"> | |
153 | <div class="section_row"> |
|
154 | <div class="section_row"> | |
154 | <span id="help_buttons0" class="section_row_buttons"> |
|
155 | <span id="help_buttons0" class="section_row_buttons"> | |
155 | <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button> |
|
156 | <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button> | |
156 | <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button> |
|
157 | <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button> | |
157 | <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button> |
|
158 | <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button> | |
158 | </span> |
|
159 | </span> | |
159 | <span class="section_row_header">Links</span> |
|
160 | <span class="section_row_header">Links</span> | |
160 | </div> |
|
161 | </div> | |
161 | <div class="section_row"> |
|
162 | <div class="section_row"> | |
162 | <span id="help_buttons1" class="section_row_buttons"> |
|
163 | <span id="help_buttons1" class="section_row_buttons"> | |
163 | <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button> |
|
164 | <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button> | |
164 | <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button> |
|
165 | <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button> | |
165 | <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button> |
|
166 | <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button> | |
166 | </span> |
|
167 | </span> | |
167 | </div> |
|
168 | </div> | |
168 | <div class="section_row"> |
|
169 | <div class="section_row"> | |
169 | <span class="help_string">run selected cell</span> |
|
170 | <span class="help_string">run selected cell</span> | |
170 | <span class="help_string_label">Shift-Enter |</span> |
|
171 | <span class="help_string_label">Shift-Enter |</span> | |
171 | </div> |
|
172 | </div> | |
172 | <div class="section_row"> |
|
173 | <div class="section_row"> | |
173 | <span class="help_string">run in terminal mode</span> |
|
174 | <span class="help_string">run in terminal mode</span> | |
174 | <span class="help_string_label">Ctrl-Enter |</span> |
|
175 | <span class="help_string_label">Ctrl-Enter |</span> | |
175 | </div> |
|
176 | </div> | |
176 | </div> |
|
177 | </div> | |
177 | </div> |
|
178 | </div> | |
178 |
|
179 | |||
179 | </div> |
|
180 | </div> | |
180 | <div id="left_panel_splitter"></div> |
|
181 | <div id="left_panel_splitter"></div> | |
181 | <div id="notebook_panel"> |
|
182 | <div id="notebook_panel"> | |
182 | <div id="notebook"></div> |
|
183 | <div id="notebook"></div> | |
183 | <div id="pager_splitter"></div> |
|
184 | <div id="pager_splitter"></div> | |
184 | <div id="pager"></div> |
|
185 | <div id="pager"></div> | |
185 | </div> |
|
186 | </div> | |
186 |
|
187 | |||
187 | </div> |
|
188 | </div> | |
188 |
|
189 | |||
189 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> |
|
190 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> | |
190 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> |
|
191 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> | |
191 | <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script> |
|
192 | <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script> | |
192 |
|
193 | |||
193 | <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script> |
|
194 | <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script> | |
194 | <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script> |
|
195 | <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script> | |
195 | <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> |
|
196 | <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> | |
196 | <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script> |
|
197 | <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script> | |
197 | <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script> |
|
198 | <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script> | |
198 | <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script> |
|
199 | <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script> | |
199 | <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script> |
|
200 | <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script> | |
200 |
|
201 | |||
201 | <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script> |
|
202 | <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script> | |
202 |
|
203 | |||
203 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
204 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> | |
204 | <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script> |
|
205 | <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script> | |
205 | <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script> |
|
206 | <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script> | |
206 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
207 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> | |
207 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
208 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> | |
208 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
209 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> | |
209 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> |
|
210 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> | |
210 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
211 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> | |
211 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
212 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
212 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
213 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
213 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> |
|
214 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> | |
214 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> |
|
215 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> | |
215 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
216 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
216 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
|
217 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> | |
217 |
|
218 | |||
218 |
|
219 | |||
219 | </body> |
|
220 | </body> | |
220 |
|
221 | |||
221 | </html> |
|
222 | </html> | |
222 |
|
223 | |||
223 |
|
224 |
General Comments 0
You need to be logged in to leave comments.
Login now