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