Show More
@@ -62,6 +62,7 b' define([' | |||||
62 | // re-select it upon selection. |
|
62 | // re-select it upon selection. | |
63 | var i = that.notebook.get_selected_index(); |
|
63 | var i = that.notebook.get_selected_index(); | |
64 | that.notebook.select(i); |
|
64 | that.notebook.select(i); | |
|
65 | event.preventDefault(); | |||
65 | } |
|
66 | } | |
66 | ); |
|
67 | ); | |
67 | }; |
|
68 | }; | |
@@ -102,6 +103,10 b' define([' | |||||
102 | this.element.find('#open_notebook').click(function () { |
|
103 | this.element.find('#open_notebook').click(function () { | |
103 | var parent = utils.url_path_split(that.notebook.notebook_path)[0]; |
|
104 | var parent = utils.url_path_split(that.notebook.notebook_path)[0]; | |
104 | window.open(utils.url_join_encode(that.base_url, 'tree', parent)); |
|
105 | window.open(utils.url_join_encode(that.base_url, 'tree', parent)); | |
|
106 | // all if(event) are here to let test pass | |||
|
107 | // as evnet might not be devined when clicking with | |||
|
108 | // casper.js | |||
|
109 | if(event)event.preventDefault(); | |||
105 | }); |
|
110 | }); | |
106 | this.element.find('#copy_notebook').click(function () { |
|
111 | this.element.find('#copy_notebook').click(function () { | |
107 | that.notebook.copy_notebook(); |
|
112 | that.notebook.copy_notebook(); | |
@@ -116,38 +121,50 b' define([' | |||||
116 |
|
121 | |||
117 | var url = utils.url_join_encode(base_url, 'files', notebook_path); |
|
122 | var url = utils.url_join_encode(base_url, 'files', notebook_path); | |
118 | window.open(url + '?download=1'); |
|
123 | window.open(url + '?download=1'); | |
|
124 | if(event)event.preventDefault(); | |||
119 | }); |
|
125 | }); | |
120 |
|
126 | |||
121 | this.element.find('#print_preview').click(function () { |
|
127 | this.element.find('#print_preview').click(function () { | |
122 | that._nbconvert('html', false); |
|
128 | that._nbconvert('html', false); | |
|
129 | if(event)event.preventDefault(); | |||
123 | }); |
|
130 | }); | |
124 |
|
131 | |||
125 | this.element.find('#download_html').click(function () { |
|
132 | this.element.find('#download_html').click(function () { | |
126 | that._nbconvert('html', true); |
|
133 | that._nbconvert('html', true); | |
|
134 | if(event)event.preventDefault(); | |||
127 | }); |
|
135 | }); | |
128 |
|
136 | |||
129 | this.element.find('#download_rst').click(function () { |
|
137 | this.element.find('#download_rst').click(function () { | |
130 | that._nbconvert('rst', true); |
|
138 | that._nbconvert('rst', true); | |
|
139 | if(event)event.preventDefault(); | |||
131 | }); |
|
140 | }); | |
132 |
|
141 | |||
133 | this.element.find('#download_pdf').click(function () { |
|
142 | this.element.find('#download_pdf').click(function () { | |
134 | that._nbconvert('pdf', true); |
|
143 | that._nbconvert('pdf', true); | |
|
144 | if(event)event.preventDefault(); | |||
135 | }); |
|
145 | }); | |
136 |
|
146 | |||
137 | this.element.find('#download_script').click(function () { |
|
147 | this.element.find('#download_script').click(function () { | |
138 | that._nbconvert('script', true); |
|
148 | that._nbconvert('script', true); | |
|
149 | if(event)event.preventDefault(); | |||
139 | }); |
|
150 | }); | |
140 |
|
151 | |||
141 | this.element.find('#rename_notebook').click(function () { |
|
152 | this.element.find('#rename_notebook').click(function () { | |
142 | that.save_widget.rename_notebook({notebook: that.notebook}); |
|
153 | that.save_widget.rename_notebook({notebook: that.notebook}); | |
|
154 | if(event)event.preventDefault(); | |||
143 | }); |
|
155 | }); | |
|
156 | ||||
144 | this.element.find('#save_checkpoint').click(function () { |
|
157 | this.element.find('#save_checkpoint').click(function () { | |
145 | that.notebook.save_checkpoint(); |
|
158 | that.notebook.save_checkpoint(); | |
|
159 | if(event)event.preventDefault(); | |||
146 | }); |
|
160 | }); | |
|
161 | ||||
147 | this.element.find('#restore_checkpoint').click(function () { |
|
162 | this.element.find('#restore_checkpoint').click(function () { | |
148 | }); |
|
163 | }); | |
|
164 | ||||
149 | this.element.find('#trust_notebook').click(function () { |
|
165 | this.element.find('#trust_notebook').click(function () { | |
150 | that.notebook.trust_notebook(); |
|
166 | that.notebook.trust_notebook(); | |
|
167 | if(event)event.preventDefault(); | |||
151 | }); |
|
168 | }); | |
152 | this.events.on('trust_changed.Notebook', function (event, trusted) { |
|
169 | this.events.on('trust_changed.Notebook', function (event, trusted) { | |
153 | if (trusted) { |
|
170 | if (trusted) { | |
@@ -159,7 +176,9 b' define([' | |||||
159 | .removeClass("disabled") |
|
176 | .removeClass("disabled") | |
160 | .find("a").text("Trust Notebook"); |
|
177 | .find("a").text("Trust Notebook"); | |
161 | } |
|
178 | } | |
|
179 | if(event)event.preventDefault(); | |||
162 | }); |
|
180 | }); | |
|
181 | ||||
163 | this.element.find('#kill_and_exit').click(function () { |
|
182 | this.element.find('#kill_and_exit').click(function () { | |
164 | var close_window = function () { |
|
183 | var close_window = function () { | |
165 | /** |
|
184 | /** | |
@@ -170,149 +189,189 b' define([' | |||||
170 | }; |
|
189 | }; | |
171 | // finish with close on success or failure |
|
190 | // finish with close on success or failure | |
172 | that.notebook.session.delete(close_window, close_window); |
|
191 | that.notebook.session.delete(close_window, close_window); | |
|
192 | if(event)event.preventDefault(); | |||
173 | }); |
|
193 | }); | |
|
194 | ||||
174 | // Edit |
|
195 | // Edit | |
175 | this.element.find('#cut_cell').click(function () { |
|
196 | this.element.find('#cut_cell').click(function () { | |
176 | that.notebook.cut_cell(); |
|
197 | that.notebook.cut_cell(); | |
|
198 | if(event)event.preventDefault(); | |||
177 | }); |
|
199 | }); | |
178 | this.element.find('#copy_cell').click(function () { |
|
200 | this.element.find('#copy_cell').click(function () { | |
179 | that.notebook.copy_cell(); |
|
201 | that.notebook.copy_cell(); | |
|
202 | if(event)event.preventDefault(); | |||
180 | }); |
|
203 | }); | |
181 | this.element.find('#delete_cell').click(function () { |
|
204 | this.element.find('#delete_cell').click(function () { | |
182 | that.notebook.delete_cell(); |
|
205 | that.notebook.delete_cell(); | |
|
206 | if(event)event.preventDefault(); | |||
183 | }); |
|
207 | }); | |
184 | this.element.find('#undelete_cell').click(function () { |
|
208 | this.element.find('#undelete_cell').click(function () { | |
185 | that.notebook.undelete_cell(); |
|
209 | that.notebook.undelete_cell(); | |
|
210 | if(event)event.preventDefault(); | |||
186 | }); |
|
211 | }); | |
187 | this.element.find('#split_cell').click(function () { |
|
212 | this.element.find('#split_cell').click(function () { | |
188 | that.notebook.split_cell(); |
|
213 | that.notebook.split_cell(); | |
|
214 | if(event)event.preventDefault(); | |||
189 | }); |
|
215 | }); | |
190 | this.element.find('#merge_cell_above').click(function () { |
|
216 | this.element.find('#merge_cell_above').click(function () { | |
191 | that.notebook.merge_cell_above(); |
|
217 | that.notebook.merge_cell_above(); | |
|
218 | if(event)event.preventDefault(); | |||
192 | }); |
|
219 | }); | |
193 | this.element.find('#merge_cell_below').click(function () { |
|
220 | this.element.find('#merge_cell_below').click(function () { | |
194 | that.notebook.merge_cell_below(); |
|
221 | that.notebook.merge_cell_below(); | |
|
222 | if(event)event.preventDefault(); | |||
195 | }); |
|
223 | }); | |
196 | this.element.find('#move_cell_up').click(function () { |
|
224 | this.element.find('#move_cell_up').click(function () { | |
197 | that.notebook.move_cell_up(); |
|
225 | that.notebook.move_cell_up(); | |
|
226 | if(event)event.preventDefault(); | |||
198 | }); |
|
227 | }); | |
199 | this.element.find('#move_cell_down').click(function () { |
|
228 | this.element.find('#move_cell_down').click(function () { | |
200 | that.notebook.move_cell_down(); |
|
229 | that.notebook.move_cell_down(); | |
|
230 | if(event)event.preventDefault(); | |||
201 | }); |
|
231 | }); | |
202 | this.element.find('#edit_nb_metadata').click(function () { |
|
232 | this.element.find('#edit_nb_metadata').click(function () { | |
203 | that.notebook.edit_metadata({ |
|
233 | that.notebook.edit_metadata({ | |
204 | notebook: that.notebook, |
|
234 | notebook: that.notebook, | |
205 | keyboard_manager: that.notebook.keyboard_manager}); |
|
235 | keyboard_manager: that.notebook.keyboard_manager}); | |
|
236 | if(event)event.preventDefault(); | |||
206 | }); |
|
237 | }); | |
207 |
|
238 | |||
208 | // View |
|
239 | // View | |
209 | this.element.find('#toggle_header').click(function () { |
|
240 | this.element.find('#toggle_header').click(function () { | |
210 | $('div#header-container').toggle(); |
|
241 | $('div#header-container').toggle(); | |
211 | that._size_header(); |
|
242 | that._size_header(); | |
|
243 | if(event)event.preventDefault(); | |||
212 | }); |
|
244 | }); | |
213 | this.element.find('#toggle_toolbar').click(function () { |
|
245 | this.element.find('#toggle_toolbar').click(function () { | |
214 | $('div#maintoolbar').toggle(); |
|
246 | $('div#maintoolbar').toggle(); | |
215 | that._size_header(); |
|
247 | that._size_header(); | |
|
248 | if(event)event.preventDefault(); | |||
216 | }); |
|
249 | }); | |
217 | // Insert |
|
250 | // Insert | |
218 | this.element.find('#insert_cell_above').click(function () { |
|
251 | this.element.find('#insert_cell_above').click(function () { | |
219 | that.notebook.insert_cell_above('code'); |
|
252 | that.notebook.insert_cell_above('code'); | |
220 | that.notebook.select_prev(); |
|
253 | that.notebook.select_prev(); | |
|
254 | if(event)event.preventDefault(); | |||
221 | }); |
|
255 | }); | |
222 | this.element.find('#insert_cell_below').click(function () { |
|
256 | this.element.find('#insert_cell_below').click(function () { | |
223 | that.notebook.insert_cell_below('code'); |
|
257 | that.notebook.insert_cell_below('code'); | |
224 | that.notebook.select_next(); |
|
258 | that.notebook.select_next(); | |
|
259 | if(event)event.preventDefault(); | |||
225 | }); |
|
260 | }); | |
226 | // Cell |
|
261 | // Cell | |
227 | this.element.find('#run_cell').click(function () { |
|
262 | this.element.find('#run_cell').click(function () { | |
228 | that.notebook.execute_cell(); |
|
263 | that.notebook.execute_cell(); | |
|
264 | if(event)event.preventDefault(); | |||
229 | }); |
|
265 | }); | |
230 | this.element.find('#run_cell_select_below').click(function () { |
|
266 | this.element.find('#run_cell_select_below').click(function () { | |
231 | that.notebook.execute_cell_and_select_below(); |
|
267 | that.notebook.execute_cell_and_select_below(); | |
|
268 | if(event)event.preventDefault(); | |||
232 | }); |
|
269 | }); | |
233 | this.element.find('#run_cell_insert_below').click(function () { |
|
270 | this.element.find('#run_cell_insert_below').click(function () { | |
234 | that.notebook.execute_cell_and_insert_below(); |
|
271 | that.notebook.execute_cell_and_insert_below(); | |
|
272 | if(event)event.preventDefault(); | |||
235 | }); |
|
273 | }); | |
236 | this.element.find('#run_all_cells').click(function () { |
|
274 | this.element.find('#run_all_cells').click(function () { | |
237 | that.notebook.execute_all_cells(); |
|
275 | that.notebook.execute_all_cells(); | |
|
276 | if(event)event.preventDefault(); | |||
238 | }); |
|
277 | }); | |
239 | this.element.find('#run_all_cells_above').click(function () { |
|
278 | this.element.find('#run_all_cells_above').click(function () { | |
240 | that.notebook.execute_cells_above(); |
|
279 | that.notebook.execute_cells_above(); | |
|
280 | if(event)event.preventDefault(); | |||
241 | }); |
|
281 | }); | |
242 | this.element.find('#run_all_cells_below').click(function () { |
|
282 | this.element.find('#run_all_cells_below').click(function () { | |
243 | that.notebook.execute_cells_below(); |
|
283 | that.notebook.execute_cells_below(); | |
|
284 | if(event)event.preventDefault(); | |||
244 | }); |
|
285 | }); | |
245 | this.element.find('#to_code').click(function () { |
|
286 | this.element.find('#to_code').click(function () { | |
246 | that.notebook.to_code(); |
|
287 | that.notebook.to_code(); | |
|
288 | if(event)event.preventDefault(); | |||
247 | }); |
|
289 | }); | |
248 | this.element.find('#to_markdown').click(function () { |
|
290 | this.element.find('#to_markdown').click(function () { | |
249 | that.notebook.to_markdown(); |
|
291 | that.notebook.to_markdown(); | |
|
292 | if(event)event.preventDefault(); | |||
250 | }); |
|
293 | }); | |
251 | this.element.find('#to_raw').click(function () { |
|
294 | this.element.find('#to_raw').click(function () { | |
252 | that.notebook.to_raw(); |
|
295 | that.notebook.to_raw(); | |
|
296 | if(event)event.preventDefault(); | |||
253 | }); |
|
297 | }); | |
254 |
|
298 | |||
255 | this.element.find('#toggle_current_output').click(function () { |
|
299 | this.element.find('#toggle_current_output').click(function () { | |
256 | that.notebook.toggle_output(); |
|
300 | that.notebook.toggle_output(); | |
|
301 | if(event)event.preventDefault(); | |||
257 | }); |
|
302 | }); | |
258 | this.element.find('#toggle_current_output_scroll').click(function () { |
|
303 | this.element.find('#toggle_current_output_scroll').click(function () { | |
259 | that.notebook.toggle_output_scroll(); |
|
304 | that.notebook.toggle_output_scroll(); | |
|
305 | if(event)event.preventDefault(); | |||
260 | }); |
|
306 | }); | |
261 | this.element.find('#clear_current_output').click(function () { |
|
307 | this.element.find('#clear_current_output').click(function () { | |
262 | that.notebook.clear_output(); |
|
308 | that.notebook.clear_output(); | |
|
309 | if(event)event.preventDefault(); | |||
263 | }); |
|
310 | }); | |
264 |
|
311 | |||
265 | this.element.find('#toggle_all_output').click(function () { |
|
312 | this.element.find('#toggle_all_output').click(function () { | |
266 | that.notebook.toggle_all_output(); |
|
313 | that.notebook.toggle_all_output(); | |
|
314 | if(event)event.preventDefault(); | |||
267 | }); |
|
315 | }); | |
268 | this.element.find('#toggle_all_output_scroll').click(function () { |
|
316 | this.element.find('#toggle_all_output_scroll').click(function () { | |
269 | that.notebook.toggle_all_output_scroll(); |
|
317 | that.notebook.toggle_all_output_scroll(); | |
|
318 | if(event)event.preventDefault(); | |||
270 | }); |
|
319 | }); | |
271 | this.element.find('#clear_all_output').click(function () { |
|
320 | this.element.find('#clear_all_output').click(function () { | |
272 | that.notebook.clear_all_output(); |
|
321 | that.notebook.clear_all_output(); | |
|
322 | if(event)event.preventDefault(); | |||
273 | }); |
|
323 | }); | |
274 |
|
324 | |||
275 | // Kernel |
|
325 | // Kernel | |
276 | this.element.find('#int_kernel').click(function () { |
|
326 | this.element.find('#int_kernel').click(function () { | |
277 | that.notebook.kernel.interrupt(); |
|
327 | that.notebook.kernel.interrupt(); | |
|
328 | if(event)event.preventDefault(); | |||
278 | }); |
|
329 | }); | |
279 | this.element.find('#restart_kernel').click(function () { |
|
330 | this.element.find('#restart_kernel').click(function () { | |
280 | that.notebook.restart_kernel(); |
|
331 | that.notebook.restart_kernel(); | |
|
332 | if(event)event.preventDefault(); | |||
281 | }); |
|
333 | }); | |
282 | this.element.find('#reconnect_kernel').click(function () { |
|
334 | this.element.find('#reconnect_kernel').click(function () { | |
283 | that.notebook.kernel.reconnect(); |
|
335 | that.notebook.kernel.reconnect(); | |
|
336 | if(event)event.preventDefault(); | |||
284 | }); |
|
337 | }); | |
285 | // Help |
|
338 | // Help | |
286 | if (this.tour) { |
|
339 | if (this.tour) { | |
287 | this.element.find('#notebook_tour').click(function () { |
|
340 | this.element.find('#notebook_tour').click(function () { | |
288 | that.tour.start(); |
|
341 | that.tour.start(); | |
|
342 | if(event)event.preventDefault(); | |||
289 | }); |
|
343 | }); | |
290 | } else { |
|
344 | } else { | |
291 | this.element.find('#notebook_tour').addClass("disabled"); |
|
345 | this.element.find('#notebook_tour').addClass("disabled"); | |
292 | } |
|
346 | } | |
293 | this.element.find('#keyboard_shortcuts').click(function () { |
|
347 | this.element.find('#keyboard_shortcuts').click(function () { | |
294 | that.quick_help.show_keyboard_shortcuts(); |
|
348 | that.quick_help.show_keyboard_shortcuts(); | |
|
349 | if(event)event.preventDefault(); | |||
295 | }); |
|
350 | }); | |
296 |
|
351 | |||
297 | this.update_restore_checkpoint(null); |
|
352 | this.update_restore_checkpoint(null); | |
298 |
|
353 | |||
299 | this.events.on('checkpoints_listed.Notebook', function (event, data) { |
|
354 | this.events.on('checkpoints_listed.Notebook', function (event, data) { | |
300 | that.update_restore_checkpoint(that.notebook.checkpoints); |
|
355 | that.update_restore_checkpoint(that.notebook.checkpoints); | |
|
356 | if(event)event.preventDefault(); | |||
301 | }); |
|
357 | }); | |
302 |
|
358 | |||
303 | this.events.on('checkpoint_created.Notebook', function (event, data) { |
|
359 | this.events.on('checkpoint_created.Notebook', function (event, data) { | |
304 | that.update_restore_checkpoint(that.notebook.checkpoints); |
|
360 | that.update_restore_checkpoint(that.notebook.checkpoints); | |
|
361 | if(event)event.preventDefault(); | |||
305 | }); |
|
362 | }); | |
306 |
|
363 | |||
307 | this.events.on('notebook_loaded.Notebook', function() { |
|
364 | this.events.on('notebook_loaded.Notebook', function() { | |
308 | var langinfo = that.notebook.metadata.language_info || {}; |
|
365 | var langinfo = that.notebook.metadata.language_info || {}; | |
309 | that.update_nbconvert_script(langinfo); |
|
366 | that.update_nbconvert_script(langinfo); | |
|
367 | if(event)event.preventDefault(); | |||
310 | }); |
|
368 | }); | |
311 |
|
369 | |||
312 | this.events.on('kernel_ready.Kernel', function(event, data) { |
|
370 | this.events.on('kernel_ready.Kernel', function(event, data) { | |
313 | var langinfo = data.kernel.info_reply.language_info || {}; |
|
371 | var langinfo = data.kernel.info_reply.language_info || {}; | |
314 | that.update_nbconvert_script(langinfo); |
|
372 | that.update_nbconvert_script(langinfo); | |
315 | that.add_kernel_help_links(data.kernel.info_reply.help_links || []); |
|
373 | that.add_kernel_help_links(data.kernel.info_reply.help_links || []); | |
|
374 | if(event)event.preventDefault(); | |||
316 | }); |
|
375 | }); | |
317 | }; |
|
376 | }; | |
318 |
|
377 | |||
@@ -341,6 +400,7 b' define([' | |||||
341 | .text(moment(d).format("LLLL")) |
|
400 | .text(moment(d).format("LLLL")) | |
342 | .click(function () { |
|
401 | .click(function () { | |
343 | that.notebook.restore_checkpoint_dialog(checkpoint); |
|
402 | that.notebook.restore_checkpoint_dialog(checkpoint); | |
|
403 | if(event)event.preventDefault(); | |||
344 | }) |
|
404 | }) | |
345 | ) |
|
405 | ) | |
346 | ); |
|
406 | ); |
General Comments 0
You need to be logged in to leave comments.
Login now