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