Show More
@@ -1,399 +1,383 | |||||
1 | /** |
|
1 | /** | |
2 | * Primary styles |
|
2 | * Primary styles | |
3 | * |
|
3 | * | |
4 | * Author: IPython Development Team |
|
4 | * Author: IPython Development Team | |
5 | */ |
|
5 | */ | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | body { |
|
8 | body { | |
9 | background-color: white; |
|
9 | background-color: white; | |
10 | /* This makes sure that the body covers the entire window and needs to |
|
10 | /* This makes sure that the body covers the entire window and needs to | |
11 | be in a different element than the display: box in wrapper below */ |
|
11 | be in a different element than the display: box in wrapper below */ | |
12 | position: absolute; |
|
12 | position: absolute; | |
13 | left: 0px; |
|
13 | left: 0px; | |
14 | right: 0px; |
|
14 | right: 0px; | |
15 | top: 0px; |
|
15 | top: 0px; | |
16 | bottom: 0px; |
|
16 | bottom: 0px; | |
17 | overflow: hidden; |
|
17 | overflow: hidden; | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | span#save_widget { |
|
20 | span#save_widget { | |
21 | padding: 5px; |
|
21 | padding: 5px; | |
22 | margin: 0px 0px 0px 300px; |
|
22 | margin: 0px 0px 0px 300px; | |
23 | display:inline-block; |
|
23 | display:inline-block; | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | span#notebook_name { |
|
26 | span#notebook_name { | |
27 | height: 1em; |
|
27 | height: 1em; | |
28 | line-height: 1em; |
|
28 | line-height: 1em; | |
29 | padding: 3px; |
|
29 | padding: 3px; | |
30 | border: none; |
|
30 | border: none; | |
31 | font-size: 146.5%; |
|
31 | font-size: 146.5%; | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | #menubar { |
|
34 | #menubar { | |
35 | /* Initially hidden to prevent FLOUC */ |
|
35 | /* Initially hidden to prevent FLOUC */ | |
36 | display: none; |
|
36 | display: none; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | .ui-menubar-item .ui-button .ui-button-text { |
|
39 | .ui-menubar-item .ui-button .ui-button-text { | |
40 | padding: 0.4em 1.0em; |
|
40 | padding: 0.4em 1.0em; | |
41 | font-size: 100%; |
|
41 | font-size: 100%; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | .ui-menu { |
|
44 | .ui-menu { | |
45 | -moz-box-shadow: 0px 6px 10px -1px #adadad; |
|
45 | -moz-box-shadow: 0px 6px 10px -1px #adadad; | |
46 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; |
|
46 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; | |
47 | box-shadow: 0px 6px 10px -1px #adadad; |
|
47 | box-shadow: 0px 6px 10px -1px #adadad; | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | .ui-menu .ui-menu-item a { |
|
50 | .ui-menu .ui-menu-item a { | |
51 | padding: 2px 1.6em; |
|
51 | padding: 2px 1.6em; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | .ui-menu hr { |
|
54 | .ui-menu hr { | |
55 | margin: 0.3em 0; |
|
55 | margin: 0.3em 0; | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | #fulledit_widget { |
|
|||
59 | /* Initially hidden to prevent FLOUC */ |
|
|||
60 | display: none; |
|
|||
61 | width: 920px; |
|
|||
62 | margin: 0px auto; |
|
|||
63 | } |
|
|||
64 |
|
||||
65 | #fulledit_editor { |
|
|||
66 | height: 577px; |
|
|||
67 | width: 920px; |
|
|||
68 | } |
|
|||
69 |
|
||||
70 | #fulledit_header { |
|
|||
71 | width: 920px; |
|
|||
72 | } |
|
|||
73 |
|
||||
74 | span#quick_help_area { |
|
58 | span#quick_help_area { | |
75 | position: static; |
|
59 | position: static; | |
76 | padding: 5px 0px; |
|
60 | padding: 5px 0px; | |
77 | margin: 0px 0px 0px 0px; |
|
61 | margin: 0px 0px 0px 0px; | |
78 | } |
|
62 | } | |
79 |
|
63 | |||
80 | span#kernel_status { |
|
64 | span#kernel_status { | |
81 | position: absolute; |
|
65 | position: absolute; | |
82 | padding: 8px 5px 5px 5px; |
|
66 | padding: 8px 5px 5px 5px; | |
83 | right: 10px; |
|
67 | right: 10px; | |
84 | font-weight: bold; |
|
68 | font-weight: bold; | |
85 | } |
|
69 | } | |
86 |
|
70 | |||
87 |
|
71 | |||
88 | .status_idle { |
|
72 | .status_idle { | |
89 | color: gray; |
|
73 | color: gray; | |
90 | visibility: hidden; |
|
74 | visibility: hidden; | |
91 | } |
|
75 | } | |
92 |
|
76 | |||
93 | .status_busy { |
|
77 | .status_busy { | |
94 | color: red; |
|
78 | color: red; | |
95 | } |
|
79 | } | |
96 |
|
80 | |||
97 | .status_restarting { |
|
81 | .status_restarting { | |
98 | color: black; |
|
82 | color: black; | |
99 | } |
|
83 | } | |
100 |
|
84 | |||
101 | #kernel_persist { |
|
85 | #kernel_persist { | |
102 | float: right; |
|
86 | float: right; | |
103 | } |
|
87 | } | |
104 |
|
88 | |||
105 | .help_string { |
|
89 | .help_string { | |
106 | float: right; |
|
90 | float: right; | |
107 | width: 170px; |
|
91 | width: 170px; | |
108 | padding: 0px 5px; |
|
92 | padding: 0px 5px; | |
109 | text-align: left; |
|
93 | text-align: left; | |
110 | font-size: 85%; |
|
94 | font-size: 85%; | |
111 | } |
|
95 | } | |
112 |
|
96 | |||
113 | .help_string_label { |
|
97 | .help_string_label { | |
114 | float: right; |
|
98 | float: right; | |
115 | font-size: 85%; |
|
99 | font-size: 85%; | |
116 | } |
|
100 | } | |
117 |
|
101 | |||
118 | div#notebook_panel { |
|
102 | div#notebook_panel { | |
119 | margin: 0px 0px 0px 0px; |
|
103 | margin: 0px 0px 0px 0px; | |
120 | padding: 0px; |
|
104 | padding: 0px; | |
121 | } |
|
105 | } | |
122 |
|
106 | |||
123 | div#notebook { |
|
107 | div#notebook { | |
124 | overflow-y: scroll; |
|
108 | overflow-y: scroll; | |
125 | overflow-x: auto; |
|
109 | overflow-x: auto; | |
126 | width: 100%; |
|
110 | width: 100%; | |
127 | /* This spaces the cell away from the edge of the notebook area */ |
|
111 | /* This spaces the cell away from the edge of the notebook area */ | |
128 | padding: 5px 5px 15px 5px; |
|
112 | padding: 5px 5px 15px 5px; | |
129 | margin: 0px |
|
113 | margin: 0px | |
130 | background-color: white; |
|
114 | background-color: white; | |
131 | } |
|
115 | } | |
132 |
|
116 | |||
133 | div#pager_splitter { |
|
117 | div#pager_splitter { | |
134 | height: 8px; |
|
118 | height: 8px; | |
135 | } |
|
119 | } | |
136 |
|
120 | |||
137 | div#pager { |
|
121 | div#pager { | |
138 | padding: 15px; |
|
122 | padding: 15px; | |
139 | overflow: auto; |
|
123 | overflow: auto; | |
140 | display: none; |
|
124 | display: none; | |
141 | } |
|
125 | } | |
142 |
|
126 | |||
143 | div.cell { |
|
127 | div.cell { | |
144 | width: 100%; |
|
128 | width: 100%; | |
145 | padding: 5px 5px 5px 0px; |
|
129 | padding: 5px 5px 5px 0px; | |
146 | /* This acts as a spacer between cells, that is outside the border */ |
|
130 | /* This acts as a spacer between cells, that is outside the border */ | |
147 | margin: 2px 0px 2px 0px; |
|
131 | margin: 2px 0px 2px 0px; | |
148 | } |
|
132 | } | |
149 |
|
133 | |||
150 | div.code_cell { |
|
134 | div.code_cell { | |
151 | background-color: white; |
|
135 | background-color: white; | |
152 | } |
|
136 | } | |
153 | /* any special styling for code cells that are currently running goes here */ |
|
137 | /* any special styling for code cells that are currently running goes here */ | |
154 | div.code_cell.running { |
|
138 | div.code_cell.running { | |
155 | } |
|
139 | } | |
156 |
|
140 | |||
157 | div.prompt { |
|
141 | div.prompt { | |
158 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ |
|
142 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ | |
159 | width: 11ex; |
|
143 | width: 11ex; | |
160 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ |
|
144 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ | |
161 | padding: 0.4em; |
|
145 | padding: 0.4em; | |
162 | margin: 0px; |
|
146 | margin: 0px; | |
163 | font-family: monospace; |
|
147 | font-family: monospace; | |
164 | text-align:right; |
|
148 | text-align:right; | |
165 | } |
|
149 | } | |
166 |
|
150 | |||
167 | div.input { |
|
151 | div.input { | |
168 | page-break-inside: avoid; |
|
152 | page-break-inside: avoid; | |
169 | } |
|
153 | } | |
170 |
|
154 | |||
171 | /* input_area and input_prompt must match in top border and margin for alignment */ |
|
155 | /* input_area and input_prompt must match in top border and margin for alignment */ | |
172 | div.input_area { |
|
156 | div.input_area { | |
173 | color: black; |
|
157 | color: black; | |
174 | border: 1px solid #ddd; |
|
158 | border: 1px solid #ddd; | |
175 | border-radius: 3px; |
|
159 | border-radius: 3px; | |
176 | background: #f7f7f7; |
|
160 | background: #f7f7f7; | |
177 | } |
|
161 | } | |
178 |
|
162 | |||
179 | div.input_prompt { |
|
163 | div.input_prompt { | |
180 | color: navy; |
|
164 | color: navy; | |
181 | border-top: 1px solid transparent; |
|
165 | border-top: 1px solid transparent; | |
182 | } |
|
166 | } | |
183 |
|
167 | |||
184 | div.output { |
|
168 | div.output { | |
185 | /* This is a spacer between the input and output of each cell */ |
|
169 | /* This is a spacer between the input and output of each cell */ | |
186 | margin-top: 5px; |
|
170 | margin-top: 5px; | |
187 | } |
|
171 | } | |
188 |
|
172 | |||
189 | div.output_prompt { |
|
173 | div.output_prompt { | |
190 | color: darkred; |
|
174 | color: darkred; | |
191 | } |
|
175 | } | |
192 |
|
176 | |||
193 | /* This class is the outer container of all output sections. */ |
|
177 | /* This class is the outer container of all output sections. */ | |
194 | div.output_area { |
|
178 | div.output_area { | |
195 | padding: 0px; |
|
179 | padding: 0px; | |
196 | page-break-inside: avoid; |
|
180 | page-break-inside: avoid; | |
197 | } |
|
181 | } | |
198 |
|
182 | |||
199 | /* This class is for the output subarea inside the output_area and after |
|
183 | /* This class is for the output subarea inside the output_area and after | |
200 | the prompt div. */ |
|
184 | the prompt div. */ | |
201 | div.output_subarea { |
|
185 | div.output_subarea { | |
202 | padding: 0.4em 6.1em 0.4em 0.4em; |
|
186 | padding: 0.4em 6.1em 0.4em 0.4em; | |
203 | } |
|
187 | } | |
204 |
|
188 | |||
205 | /* The rest of the output_* classes are for special styling of the different |
|
189 | /* The rest of the output_* classes are for special styling of the different | |
206 | output types */ |
|
190 | output types */ | |
207 |
|
191 | |||
208 | /* all text output has this class: */ |
|
192 | /* all text output has this class: */ | |
209 | div.output_text { |
|
193 | div.output_text { | |
210 | text-align: left; |
|
194 | text-align: left; | |
211 | color: black; |
|
195 | color: black; | |
212 | font-family: monospace; |
|
196 | font-family: monospace; | |
213 | } |
|
197 | } | |
214 |
|
198 | |||
215 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ |
|
199 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ | |
216 | div.output_stream { |
|
200 | div.output_stream { | |
217 | padding-top: 0.0em; |
|
201 | padding-top: 0.0em; | |
218 | padding-bottom: 0.0em; |
|
202 | padding-bottom: 0.0em; | |
219 | } |
|
203 | } | |
220 | div.output_stdout { |
|
204 | div.output_stdout { | |
221 | } |
|
205 | } | |
222 | div.output_stderr { |
|
206 | div.output_stderr { | |
223 | background: #fdd; /* very light red background for stderr */ |
|
207 | background: #fdd; /* very light red background for stderr */ | |
224 | } |
|
208 | } | |
225 |
|
209 | |||
226 | div.output_latex { |
|
210 | div.output_latex { | |
227 | text-align: left; |
|
211 | text-align: left; | |
228 | color: black; |
|
212 | color: black; | |
229 | } |
|
213 | } | |
230 |
|
214 | |||
231 | div.output_html { |
|
215 | div.output_html { | |
232 | } |
|
216 | } | |
233 |
|
217 | |||
234 | div.output_png { |
|
218 | div.output_png { | |
235 | } |
|
219 | } | |
236 |
|
220 | |||
237 | div.output_jpeg { |
|
221 | div.output_jpeg { | |
238 | } |
|
222 | } | |
239 |
|
223 | |||
240 | div.text_cell { |
|
224 | div.text_cell { | |
241 | background-color: white; |
|
225 | background-color: white; | |
242 | padding: 5px 5px 5px 5px; |
|
226 | padding: 5px 5px 5px 5px; | |
243 | } |
|
227 | } | |
244 |
|
228 | |||
245 | div.text_cell_input { |
|
229 | div.text_cell_input { | |
246 | color: black; |
|
230 | color: black; | |
247 | border: 1px solid #ddd; |
|
231 | border: 1px solid #ddd; | |
248 | border-radius: 3px; |
|
232 | border-radius: 3px; | |
249 | background: #f7f7f7; |
|
233 | background: #f7f7f7; | |
250 | } |
|
234 | } | |
251 |
|
235 | |||
252 | div.text_cell_render { |
|
236 | div.text_cell_render { | |
253 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
237 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
254 | outline: none; |
|
238 | outline: none; | |
255 | resize: none; |
|
239 | resize: none; | |
256 | width: inherit; |
|
240 | width: inherit; | |
257 | border-style: none; |
|
241 | border-style: none; | |
258 | padding: 5px; |
|
242 | padding: 5px; | |
259 | color: black; |
|
243 | color: black; | |
260 | } |
|
244 | } | |
261 |
|
245 | |||
262 | .CodeMirror { |
|
246 | .CodeMirror { | |
263 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
247 | line-height: 1.231; /* Changed from 1em to our global default */ | |
264 | } |
|
248 | } | |
265 |
|
249 | |||
266 | .CodeMirror-scroll { |
|
250 | .CodeMirror-scroll { | |
267 | height: auto; /* Changed to auto to autogrow */ |
|
251 | height: auto; /* Changed to auto to autogrow */ | |
268 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ |
|
252 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ | |
269 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ |
|
253 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ | |
270 | overflow-y: hidden; |
|
254 | overflow-y: hidden; | |
271 | overflow-x: auto; /* Changed from auto to remove scrollbar */ |
|
255 | overflow-x: auto; /* Changed from auto to remove scrollbar */ | |
272 | } |
|
256 | } | |
273 |
|
257 | |||
274 | /* CSS font colors for translated ANSI colors. */ |
|
258 | /* CSS font colors for translated ANSI colors. */ | |
275 |
|
259 | |||
276 |
|
260 | |||
277 | .ansiblack {color: black;} |
|
261 | .ansiblack {color: black;} | |
278 | .ansired {color: darkred;} |
|
262 | .ansired {color: darkred;} | |
279 | .ansigreen {color: darkgreen;} |
|
263 | .ansigreen {color: darkgreen;} | |
280 | .ansiyellow {color: brown;} |
|
264 | .ansiyellow {color: brown;} | |
281 | .ansiblue {color: darkblue;} |
|
265 | .ansiblue {color: darkblue;} | |
282 | .ansipurple {color: darkviolet;} |
|
266 | .ansipurple {color: darkviolet;} | |
283 | .ansicyan {color: steelblue;} |
|
267 | .ansicyan {color: steelblue;} | |
284 | .ansigrey {color: grey;} |
|
268 | .ansigrey {color: grey;} | |
285 | .ansibold {font-weight: bold;} |
|
269 | .ansibold {font-weight: bold;} | |
286 |
|
270 | |||
287 | .completions , .tooltip { |
|
271 | .completions , .tooltip { | |
288 | position: absolute; |
|
272 | position: absolute; | |
289 | z-index: 10; |
|
273 | z-index: 10; | |
290 | overflow: auto; |
|
274 | overflow: auto; | |
291 | border: 1px solid black; |
|
275 | border: 1px solid black; | |
292 | } |
|
276 | } | |
293 |
|
277 | |||
294 | .completions select { |
|
278 | .completions select { | |
295 | background: white; |
|
279 | background: white; | |
296 | outline: none; |
|
280 | outline: none; | |
297 | border: none; |
|
281 | border: none; | |
298 | padding: 0px; |
|
282 | padding: 0px; | |
299 | margin: 0px; |
|
283 | margin: 0px; | |
300 | font-family: monospace; |
|
284 | font-family: monospace; | |
301 | } |
|
285 | } | |
302 |
|
286 | |||
303 | @-moz-keyframes fadeIn { |
|
287 | @-moz-keyframes fadeIn { | |
304 | from {opacity:0;} |
|
288 | from {opacity:0;} | |
305 | to {opacity:1;} |
|
289 | to {opacity:1;} | |
306 | } |
|
290 | } | |
307 |
|
291 | |||
308 | @-webkit-keyframes fadeIn { |
|
292 | @-webkit-keyframes fadeIn { | |
309 | from {opacity:0;} |
|
293 | from {opacity:0;} | |
310 | to {opacity:1;} |
|
294 | to {opacity:1;} | |
311 | } |
|
295 | } | |
312 |
|
296 | |||
313 | @keyframes fadeIn { |
|
297 | @keyframes fadeIn { | |
314 | from {opacity:0;} |
|
298 | from {opacity:0;} | |
315 | to {opacity:1;} |
|
299 | to {opacity:1;} | |
316 | } |
|
300 | } | |
317 |
|
301 | |||
318 | /*"close" "expand" and "Open in pager button" of |
|
302 | /*"close" "expand" and "Open in pager button" of | |
319 | /* the tooltip*/ |
|
303 | /* the tooltip*/ | |
320 | .tooltip a { |
|
304 | .tooltip a { | |
321 | float:right; |
|
305 | float:right; | |
322 | } |
|
306 | } | |
323 |
|
307 | |||
324 | /*properties of tooltip after "expand"*/ |
|
308 | /*properties of tooltip after "expand"*/ | |
325 | .bigtooltip { |
|
309 | .bigtooltip { | |
326 | height:30%; |
|
310 | height:30%; | |
327 | } |
|
311 | } | |
328 |
|
312 | |||
329 | /*properties of tooltip before "expand"*/ |
|
313 | /*properties of tooltip before "expand"*/ | |
330 | .smalltooltip { |
|
314 | .smalltooltip { | |
331 | text-overflow: ellipsis; |
|
315 | text-overflow: ellipsis; | |
332 | overflow: hidden; |
|
316 | overflow: hidden; | |
333 | height:15%; |
|
317 | height:15%; | |
334 | } |
|
318 | } | |
335 |
|
319 | |||
336 | .tooltip { |
|
320 | .tooltip { | |
337 | /*transition when "expand"ing tooltip */ |
|
321 | /*transition when "expand"ing tooltip */ | |
338 | -webkit-transition-property: height; |
|
322 | -webkit-transition-property: height; | |
339 | -webkit-transition-duration: 1s; |
|
323 | -webkit-transition-duration: 1s; | |
340 | -moz-transition-property: height; |
|
324 | -moz-transition-property: height; | |
341 | -moz-transition-duration: 1s; |
|
325 | -moz-transition-duration: 1s; | |
342 | transition-property: height; |
|
326 | transition-property: height; | |
343 | transition-duration: 1s; |
|
327 | transition-duration: 1s; | |
344 | max-width:700px; |
|
328 | max-width:700px; | |
345 | border-radius: 0px 10px 10px 10px; |
|
329 | border-radius: 0px 10px 10px 10px; | |
346 | box-shadow: 3px 3px 5px #999; |
|
330 | box-shadow: 3px 3px 5px #999; | |
347 | /*fade-in animation when inserted*/ |
|
331 | /*fade-in animation when inserted*/ | |
348 | -webkit-animation: fadeIn 200ms; |
|
332 | -webkit-animation: fadeIn 200ms; | |
349 | -moz-animation: fadeIn 200ms; |
|
333 | -moz-animation: fadeIn 200ms; | |
350 | animation: fadeIn 200ms; |
|
334 | animation: fadeIn 200ms; | |
351 | vertical-align: middle; |
|
335 | vertical-align: middle; | |
352 | background: #FDFDD8; |
|
336 | background: #FDFDD8; | |
353 | outline: none; |
|
337 | outline: none; | |
354 | padding: 3px; |
|
338 | padding: 3px; | |
355 | margin: 0px; |
|
339 | margin: 0px; | |
356 | font-family: monospace; |
|
340 | font-family: monospace; | |
357 | min-height:50px; |
|
341 | min-height:50px; | |
358 | } |
|
342 | } | |
359 |
|
343 | |||
360 | /*fixed part of the completion*/ |
|
344 | /*fixed part of the completion*/ | |
361 | .completions p b { |
|
345 | .completions p b { | |
362 | font-weight:bold; |
|
346 | font-weight:bold; | |
363 | } |
|
347 | } | |
364 |
|
348 | |||
365 | .completions p { |
|
349 | .completions p { | |
366 | background: #DDF; |
|
350 | background: #DDF; | |
367 | /*outline: none; |
|
351 | /*outline: none; | |
368 | padding: 0px;*/ |
|
352 | padding: 0px;*/ | |
369 | border-bottom: black solid 1px; |
|
353 | border-bottom: black solid 1px; | |
370 | padding: 1px; |
|
354 | padding: 1px; | |
371 | font-family: monospace; |
|
355 | font-family: monospace; | |
372 | } |
|
356 | } | |
373 |
|
357 | |||
374 | pre.dialog { |
|
358 | pre.dialog { | |
375 | background-color: #f7f7f7; |
|
359 | background-color: #f7f7f7; | |
376 | border: 1px solid #ddd; |
|
360 | border: 1px solid #ddd; | |
377 | border-radius: 3px; |
|
361 | border-radius: 3px; | |
378 | padding: 0.4em; |
|
362 | padding: 0.4em; | |
379 | padding-left: 2em; |
|
363 | padding-left: 2em; | |
380 | } |
|
364 | } | |
381 |
|
365 | |||
382 | p.dialog { |
|
366 | p.dialog { | |
383 | padding : 0.2em; |
|
367 | padding : 0.2em; | |
384 | } |
|
368 | } | |
385 |
|
369 | |||
386 | .shortcut_key { |
|
370 | .shortcut_key { | |
387 | display: inline-block; |
|
371 | display: inline-block; | |
388 | width: 15ex; |
|
372 | width: 15ex; | |
389 | text-align: right; |
|
373 | text-align: right; | |
390 | font-family: monospace; |
|
374 | font-family: monospace; | |
391 | } |
|
375 | } | |
392 |
|
376 | |||
393 | .shortcut_descr { |
|
377 | .shortcut_descr { | |
394 | } |
|
378 | } | |
395 |
|
379 | |||
396 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems |
|
380 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems | |
397 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. |
|
381 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. | |
398 | */ |
|
382 | */ | |
399 | pre, code, kbd, samp { white-space: pre-wrap; } |
|
383 | pre, code, kbd, samp { white-space: pre-wrap; } |
@@ -1,151 +1,148 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // MenuBar |
|
9 | // MenuBar | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | |||
14 | var MenuBar = function (selector) { |
|
14 | var MenuBar = function (selector) { | |
15 | this.selector = selector; |
|
15 | this.selector = selector; | |
16 | if (this.selector !== undefined) { |
|
16 | if (this.selector !== undefined) { | |
17 | this.element = $(selector); |
|
17 | this.element = $(selector); | |
18 | this.style(); |
|
18 | this.style(); | |
19 | this.bind_events(); |
|
19 | this.bind_events(); | |
20 | } |
|
20 | } | |
21 | }; |
|
21 | }; | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | MenuBar.prototype.style = function () { |
|
24 | MenuBar.prototype.style = function () { | |
25 | $('ul#menus').menubar({ |
|
25 | $('ul#menus').menubar({ | |
26 | select : function (event, ui) { |
|
26 | select : function (event, ui) { | |
27 | // The selected cell loses focus when the menu is entered, so we |
|
27 | // The selected cell loses focus when the menu is entered, so we | |
28 | // re-select it upon selection. |
|
28 | // re-select it upon selection. | |
29 | var i = IPython.notebook.get_selected_index(); |
|
29 | var i = IPython.notebook.get_selected_index(); | |
30 | IPython.notebook.select(i); |
|
30 | IPython.notebook.select(i); | |
31 | } |
|
31 | } | |
32 | }); |
|
32 | }); | |
33 | }; |
|
33 | }; | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | MenuBar.prototype.bind_events = function () { |
|
36 | MenuBar.prototype.bind_events = function () { | |
37 | // File |
|
37 | // File | |
38 | this.element.find('#new_notebook').click(function () { |
|
38 | this.element.find('#new_notebook').click(function () { | |
39 | window.open($('body').data('baseProjectUrl')+'new'); |
|
39 | window.open($('body').data('baseProjectUrl')+'new'); | |
40 | }); |
|
40 | }); | |
41 | this.element.find('#open_notebook').click(function () { |
|
41 | this.element.find('#open_notebook').click(function () { | |
42 | window.open($('body').data('baseProjectUrl')); |
|
42 | window.open($('body').data('baseProjectUrl')); | |
43 | }); |
|
43 | }); | |
44 | this.element.find('#rename_notebook').click(function () { |
|
44 | this.element.find('#rename_notebook').click(function () { | |
45 | IPython.save_widget.rename_notebook(); |
|
45 | IPython.save_widget.rename_notebook(); | |
46 | }); |
|
46 | }); | |
47 | this.element.find('#copy_notebook').click(function () { |
|
47 | this.element.find('#copy_notebook').click(function () { | |
48 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
48 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
49 | var url = $('body').data('baseProjectUrl') + notebook_id + '/copy'; |
|
49 | var url = $('body').data('baseProjectUrl') + notebook_id + '/copy'; | |
50 | window.open(url,'_newtab'); |
|
50 | window.open(url,'_newtab'); | |
51 | }); |
|
51 | }); | |
52 | this.element.find('#save_notebook').click(function () { |
|
52 | this.element.find('#save_notebook').click(function () { | |
53 | IPython.save_widget.save_notebook(); |
|
53 | IPython.save_widget.save_notebook(); | |
54 | }); |
|
54 | }); | |
55 | this.element.find('#download_ipynb').click(function () { |
|
55 | this.element.find('#download_ipynb').click(function () { | |
56 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
56 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
57 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + |
|
57 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + | |
58 | notebook_id + '?format=json'; |
|
58 | notebook_id + '?format=json'; | |
59 | window.open(url,'_newtab'); |
|
59 | window.open(url,'_newtab'); | |
60 | }); |
|
60 | }); | |
61 | this.element.find('#download_py').click(function () { |
|
61 | this.element.find('#download_py').click(function () { | |
62 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
62 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
63 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + |
|
63 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + | |
64 | notebook_id + '?format=py'; |
|
64 | notebook_id + '?format=py'; | |
65 | window.open(url,'_newtab'); |
|
65 | window.open(url,'_newtab'); | |
66 | }); |
|
66 | }); | |
67 | this.element.find('button#print_notebook').click(function () { |
|
67 | this.element.find('button#print_notebook').click(function () { | |
68 | IPython.print_widget.print_notebook(); |
|
68 | IPython.print_widget.print_notebook(); | |
69 | }); |
|
69 | }); | |
70 | // Edit |
|
70 | // Edit | |
71 | this.element.find('#cut_cell').click(function () { |
|
71 | this.element.find('#cut_cell').click(function () { | |
72 | IPython.notebook.cut_cell(); |
|
72 | IPython.notebook.cut_cell(); | |
73 | }); |
|
73 | }); | |
74 | this.element.find('#copy_cell').click(function () { |
|
74 | this.element.find('#copy_cell').click(function () { | |
75 | IPython.notebook.copy_cell(); |
|
75 | IPython.notebook.copy_cell(); | |
76 | }); |
|
76 | }); | |
77 | this.element.find('#delete_cell').click(function () { |
|
77 | this.element.find('#delete_cell').click(function () { | |
78 | IPython.notebook.delete_cell(); |
|
78 | IPython.notebook.delete_cell(); | |
79 | }); |
|
79 | }); | |
80 | this.element.find('#split_cell').click(function () { |
|
80 | this.element.find('#split_cell').click(function () { | |
81 | IPython.notebook.split_cell(); |
|
81 | IPython.notebook.split_cell(); | |
82 | }); |
|
82 | }); | |
83 | this.element.find('#merge_cell_above').click(function () { |
|
83 | this.element.find('#merge_cell_above').click(function () { | |
84 | IPython.notebook.merge_cell_above(); |
|
84 | IPython.notebook.merge_cell_above(); | |
85 | }); |
|
85 | }); | |
86 | this.element.find('#merge_cell_below').click(function () { |
|
86 | this.element.find('#merge_cell_below').click(function () { | |
87 | IPython.notebook.merge_cell_below(); |
|
87 | IPython.notebook.merge_cell_below(); | |
88 | }); |
|
88 | }); | |
89 | this.element.find('#move_cell_up').click(function () { |
|
89 | this.element.find('#move_cell_up').click(function () { | |
90 | IPython.notebook.move_cell_up(); |
|
90 | IPython.notebook.move_cell_up(); | |
91 | }); |
|
91 | }); | |
92 | this.element.find('#move_cell_down').click(function () { |
|
92 | this.element.find('#move_cell_down').click(function () { | |
93 | IPython.notebook.move_cell_down(); |
|
93 | IPython.notebook.move_cell_down(); | |
94 | }); |
|
94 | }); | |
95 | this.element.find('#select_previous').click(function () { |
|
95 | this.element.find('#select_previous').click(function () { | |
96 | IPython.notebook.select_prev(); |
|
96 | IPython.notebook.select_prev(); | |
97 | }); |
|
97 | }); | |
98 | this.element.find('#select_next').click(function () { |
|
98 | this.element.find('#select_next').click(function () { | |
99 | IPython.notebook.select_next(); |
|
99 | IPython.notebook.select_next(); | |
100 | }); |
|
100 | }); | |
101 | // Insert |
|
101 | // Insert | |
102 | this.element.find('#insert_cell_above').click(function () { |
|
102 | this.element.find('#insert_cell_above').click(function () { | |
103 | IPython.notebook.insert_cell_above('code'); |
|
103 | IPython.notebook.insert_cell_above('code'); | |
104 | }); |
|
104 | }); | |
105 | this.element.find('#insert_cell_below').click(function () { |
|
105 | this.element.find('#insert_cell_below').click(function () { | |
106 | IPython.notebook.insert_cell_below('code'); |
|
106 | IPython.notebook.insert_cell_below('code'); | |
107 | }); |
|
107 | }); | |
108 | // Cell |
|
108 | // Cell | |
109 | this.element.find('#full_edit_cell').click(function () { |
|
|||
110 | IPython.fulledit_widget.open(); |
|
|||
111 | }); |
|
|||
112 | this.element.find('#run_cell').click(function () { |
|
109 | this.element.find('#run_cell').click(function () { | |
113 | IPython.notebook.execute_selected_cell(); |
|
110 | IPython.notebook.execute_selected_cell(); | |
114 | }); |
|
111 | }); | |
115 | this.element.find('#run_cell_in_place').click(function () { |
|
112 | this.element.find('#run_cell_in_place').click(function () { | |
116 | IPython.notebook.execute_selected_cell({terminal:true}); |
|
113 | IPython.notebook.execute_selected_cell({terminal:true}); | |
117 | }); |
|
114 | }); | |
118 | this.element.find('#run_all_cells').click(function () { |
|
115 | this.element.find('#run_all_cells').click(function () { | |
119 | IPython.notebook.execute_all_cells(); |
|
116 | IPython.notebook.execute_all_cells(); | |
120 | }); |
|
117 | }); | |
121 | this.element.find('#to_code').click(function () { |
|
118 | this.element.find('#to_code').click(function () { | |
122 | IPython.notebook.to_code(); |
|
119 | IPython.notebook.to_code(); | |
123 | }); |
|
120 | }); | |
124 | this.element.find('#to_markdown').click(function () { |
|
121 | this.element.find('#to_markdown').click(function () { | |
125 | IPython.notebook.to_markdown(); |
|
122 | IPython.notebook.to_markdown(); | |
126 | }); |
|
123 | }); | |
127 | this.element.find('#toggle_output').click(function () { |
|
124 | this.element.find('#toggle_output').click(function () { | |
128 | IPython.notebook.toggle_output(); |
|
125 | IPython.notebook.toggle_output(); | |
129 | }); |
|
126 | }); | |
130 | this.element.find('#clear_all_output').click(function () { |
|
127 | this.element.find('#clear_all_output').click(function () { | |
131 | IPython.notebook.clear_all_output(); |
|
128 | IPython.notebook.clear_all_output(); | |
132 | }); |
|
129 | }); | |
133 | // Kernel |
|
130 | // Kernel | |
134 | this.element.find('#int_kernel').click(function () { |
|
131 | this.element.find('#int_kernel').click(function () { | |
135 | IPython.notebook.kernel.interrupt(); |
|
132 | IPython.notebook.kernel.interrupt(); | |
136 | }); |
|
133 | }); | |
137 | this.element.find('#restart_kernel').click(function () { |
|
134 | this.element.find('#restart_kernel').click(function () { | |
138 | IPython.notebook.restart_kernel(); |
|
135 | IPython.notebook.restart_kernel(); | |
139 | }); |
|
136 | }); | |
140 | // Help |
|
137 | // Help | |
141 | this.element.find('#keyboard_shortcuts').click(function () { |
|
138 | this.element.find('#keyboard_shortcuts').click(function () { | |
142 | IPython.quick_help.show_keyboard_shortcuts(); |
|
139 | IPython.quick_help.show_keyboard_shortcuts(); | |
143 | }); |
|
140 | }); | |
144 | }; |
|
141 | }; | |
145 |
|
142 | |||
146 |
|
143 | |||
147 | IPython.MenuBar = MenuBar; |
|
144 | IPython.MenuBar = MenuBar; | |
148 |
|
145 | |||
149 | return IPython; |
|
146 | return IPython; | |
150 |
|
147 | |||
151 | }(IPython)); |
|
148 | }(IPython)); |
@@ -1,1172 +1,1167 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // Notebook |
|
9 | // Notebook | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | |||
14 | var utils = IPython.utils; |
|
14 | var utils = IPython.utils; | |
15 |
|
15 | |||
16 | var Notebook = function (selector) { |
|
16 | var Notebook = function (selector) { | |
17 | this.read_only = IPython.read_only; |
|
17 | this.read_only = IPython.read_only; | |
18 | this.element = $(selector); |
|
18 | this.element = $(selector); | |
19 | this.element.scroll(); |
|
19 | this.element.scroll(); | |
20 | this.element.data("notebook", this); |
|
20 | this.element.data("notebook", this); | |
21 | this.next_prompt_number = 1; |
|
21 | this.next_prompt_number = 1; | |
22 | this.kernel = null; |
|
22 | this.kernel = null; | |
23 | this.clipboard = null; |
|
23 | this.clipboard = null; | |
24 | this.paste_enabled = false; |
|
24 | this.paste_enabled = false; | |
25 | this.dirty = false; |
|
25 | this.dirty = false; | |
26 | this.msg_cell_map = {}; |
|
26 | this.msg_cell_map = {}; | |
27 | this.metadata = {}; |
|
27 | this.metadata = {}; | |
28 | this.control_key_active = false; |
|
28 | this.control_key_active = false; | |
29 | this.style(); |
|
29 | this.style(); | |
30 | this.create_elements(); |
|
30 | this.create_elements(); | |
31 | this.bind_events(); |
|
31 | this.bind_events(); | |
32 | this.set_tooltipontab(true); |
|
32 | this.set_tooltipontab(true); | |
33 | this.set_smartcompleter(true); |
|
33 | this.set_smartcompleter(true); | |
34 | this.set_timebeforetooltip(1200); |
|
34 | this.set_timebeforetooltip(1200); | |
35 | }; |
|
35 | }; | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | Notebook.prototype.style = function () { |
|
38 | Notebook.prototype.style = function () { | |
39 | $('div#notebook').addClass('border-box-sizing'); |
|
39 | $('div#notebook').addClass('border-box-sizing'); | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | Notebook.prototype.create_elements = function () { |
|
43 | Notebook.prototype.create_elements = function () { | |
44 | // We add this end_space div to the end of the notebook div to: |
|
44 | // We add this end_space div to the end of the notebook div to: | |
45 | // i) provide a margin between the last cell and the end of the notebook |
|
45 | // i) provide a margin between the last cell and the end of the notebook | |
46 | // ii) to prevent the div from scrolling up when the last cell is being |
|
46 | // ii) to prevent the div from scrolling up when the last cell is being | |
47 | // edited, but is too low on the page, which browsers will do automatically. |
|
47 | // edited, but is too low on the page, which browsers will do automatically. | |
48 | var that = this; |
|
48 | var that = this; | |
49 | var end_space = $('<div/>').addClass('end_space').height("30%"); |
|
49 | var end_space = $('<div/>').addClass('end_space').height("30%"); | |
50 | end_space.dblclick(function (e) { |
|
50 | end_space.dblclick(function (e) { | |
51 | if (that.read_only) return; |
|
51 | if (that.read_only) return; | |
52 | var ncells = that.ncells(); |
|
52 | var ncells = that.ncells(); | |
53 | that.insert_cell_below('code',ncells-1); |
|
53 | that.insert_cell_below('code',ncells-1); | |
54 | }); |
|
54 | }); | |
55 | this.element.append(end_space); |
|
55 | this.element.append(end_space); | |
56 | $('div#notebook').addClass('border-box-sizing'); |
|
56 | $('div#notebook').addClass('border-box-sizing'); | |
57 | }; |
|
57 | }; | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | Notebook.prototype.bind_events = function () { |
|
60 | Notebook.prototype.bind_events = function () { | |
61 | var that = this; |
|
61 | var that = this; | |
62 | $(document).keydown(function (event) { |
|
62 | $(document).keydown(function (event) { | |
63 | // console.log(event); |
|
63 | // console.log(event); | |
64 | if (that.read_only) return true; |
|
64 | if (that.read_only) return true; | |
65 | if (event.which === 27) { |
|
65 | if (event.which === 27) { | |
66 | // Intercept escape at highest level to avoid closing |
|
66 | // Intercept escape at highest level to avoid closing | |
67 | // websocket connection with firefox |
|
67 | // websocket connection with firefox | |
68 | event.preventDefault(); |
|
68 | event.preventDefault(); | |
69 | } |
|
69 | } | |
70 | if (event.which === 38 && !event.shiftKey) { |
|
70 | if (event.which === 38 && !event.shiftKey) { | |
71 | var cell = that.get_selected_cell(); |
|
71 | var cell = that.get_selected_cell(); | |
72 | if (cell.at_top()) { |
|
72 | if (cell.at_top()) { | |
73 | event.preventDefault(); |
|
73 | event.preventDefault(); | |
74 | that.select_prev(); |
|
74 | that.select_prev(); | |
75 | }; |
|
75 | }; | |
76 | } else if (event.which === 40 && !event.shiftKey) { |
|
76 | } else if (event.which === 40 && !event.shiftKey) { | |
77 | var cell = that.get_selected_cell(); |
|
77 | var cell = that.get_selected_cell(); | |
78 | if (cell.at_bottom()) { |
|
78 | if (cell.at_bottom()) { | |
79 | event.preventDefault(); |
|
79 | event.preventDefault(); | |
80 | that.select_next(); |
|
80 | that.select_next(); | |
81 | }; |
|
81 | }; | |
82 | } else if (event.which === 13 && event.shiftKey) { |
|
82 | } else if (event.which === 13 && event.shiftKey) { | |
83 | that.execute_selected_cell(); |
|
83 | that.execute_selected_cell(); | |
84 | return false; |
|
84 | return false; | |
85 | } else if (event.which === 13 && event.ctrlKey) { |
|
85 | } else if (event.which === 13 && event.ctrlKey) { | |
86 | that.execute_selected_cell({terminal:true}); |
|
86 | that.execute_selected_cell({terminal:true}); | |
87 | return false; |
|
87 | return false; | |
88 | } else if (event.which === 77 && event.ctrlKey) { |
|
88 | } else if (event.which === 77 && event.ctrlKey) { | |
89 | that.control_key_active = true; |
|
89 | that.control_key_active = true; | |
90 | return false; |
|
90 | return false; | |
91 | } else if (event.which === 88 && that.control_key_active) { |
|
91 | } else if (event.which === 88 && that.control_key_active) { | |
92 | // Cut selected cell = x |
|
92 | // Cut selected cell = x | |
93 | that.cut_cell(); |
|
93 | that.cut_cell(); | |
94 | that.control_key_active = false; |
|
94 | that.control_key_active = false; | |
95 | return false; |
|
95 | return false; | |
96 | } else if (event.which === 67 && that.control_key_active) { |
|
96 | } else if (event.which === 67 && that.control_key_active) { | |
97 | // Copy selected cell = c |
|
97 | // Copy selected cell = c | |
98 | that.copy_cell(); |
|
98 | that.copy_cell(); | |
99 | that.control_key_active = false; |
|
99 | that.control_key_active = false; | |
100 | return false; |
|
100 | return false; | |
101 | } else if (event.which === 86 && that.control_key_active) { |
|
101 | } else if (event.which === 86 && that.control_key_active) { | |
102 | // Paste selected cell = v |
|
102 | // Paste selected cell = v | |
103 | that.paste_cell(); |
|
103 | that.paste_cell(); | |
104 | that.control_key_active = false; |
|
104 | that.control_key_active = false; | |
105 | return false; |
|
105 | return false; | |
106 | } else if (event.which === 68 && that.control_key_active) { |
|
106 | } else if (event.which === 68 && that.control_key_active) { | |
107 | // Delete selected cell = d |
|
107 | // Delete selected cell = d | |
108 | that.delete_cell(); |
|
108 | that.delete_cell(); | |
109 | that.control_key_active = false; |
|
109 | that.control_key_active = false; | |
110 | return false; |
|
110 | return false; | |
111 | } else if (event.which === 65 && that.control_key_active) { |
|
111 | } else if (event.which === 65 && that.control_key_active) { | |
112 | // Insert code cell above selected = a |
|
112 | // Insert code cell above selected = a | |
113 | that.insert_cell_above('code'); |
|
113 | that.insert_cell_above('code'); | |
114 | that.control_key_active = false; |
|
114 | that.control_key_active = false; | |
115 | return false; |
|
115 | return false; | |
116 | } else if (event.which === 66 && that.control_key_active) { |
|
116 | } else if (event.which === 66 && that.control_key_active) { | |
117 | // Insert code cell below selected = b |
|
117 | // Insert code cell below selected = b | |
118 | that.insert_cell_below('code'); |
|
118 | that.insert_cell_below('code'); | |
119 | that.control_key_active = false; |
|
119 | that.control_key_active = false; | |
120 | return false; |
|
120 | return false; | |
121 | } else if (event.which === 89 && that.control_key_active) { |
|
121 | } else if (event.which === 89 && that.control_key_active) { | |
122 | // To code = y |
|
122 | // To code = y | |
123 | that.to_code(); |
|
123 | that.to_code(); | |
124 | that.control_key_active = false; |
|
124 | that.control_key_active = false; | |
125 | return false; |
|
125 | return false; | |
126 | } else if (event.which === 77 && that.control_key_active) { |
|
126 | } else if (event.which === 77 && that.control_key_active) { | |
127 | // To markdown = m |
|
127 | // To markdown = m | |
128 | that.to_markdown(); |
|
128 | that.to_markdown(); | |
129 | that.control_key_active = false; |
|
129 | that.control_key_active = false; | |
130 | return false; |
|
130 | return false; | |
131 | } else if (event.which === 84 && that.control_key_active) { |
|
131 | } else if (event.which === 84 && that.control_key_active) { | |
132 | // Toggle output = t |
|
132 | // Toggle output = t | |
133 | that.toggle_output(); |
|
133 | that.toggle_output(); | |
134 | that.control_key_active = false; |
|
134 | that.control_key_active = false; | |
135 | return false; |
|
135 | return false; | |
136 | } else if (event.which === 83 && that.control_key_active) { |
|
136 | } else if (event.which === 83 && that.control_key_active) { | |
137 | // Save notebook = s |
|
137 | // Save notebook = s | |
138 | IPython.save_widget.save_notebook(); |
|
138 | IPython.save_widget.save_notebook(); | |
139 | that.control_key_active = false; |
|
139 | that.control_key_active = false; | |
140 | return false; |
|
140 | return false; | |
141 | } else if (event.which === 74 && that.control_key_active) { |
|
141 | } else if (event.which === 74 && that.control_key_active) { | |
142 | // Move cell down = j |
|
142 | // Move cell down = j | |
143 | that.move_cell_down(); |
|
143 | that.move_cell_down(); | |
144 | that.control_key_active = false; |
|
144 | that.control_key_active = false; | |
145 | return false; |
|
145 | return false; | |
146 | } else if (event.which === 75 && that.control_key_active) { |
|
146 | } else if (event.which === 75 && that.control_key_active) { | |
147 | // Move cell up = k |
|
147 | // Move cell up = k | |
148 | that.move_cell_up(); |
|
148 | that.move_cell_up(); | |
149 | that.control_key_active = false; |
|
149 | that.control_key_active = false; | |
150 | return false; |
|
150 | return false; | |
151 | } else if (event.which === 80 && that.control_key_active) { |
|
151 | } else if (event.which === 80 && that.control_key_active) { | |
152 | // Select previous = p |
|
152 | // Select previous = p | |
153 | that.select_prev(); |
|
153 | that.select_prev(); | |
154 | that.control_key_active = false; |
|
154 | that.control_key_active = false; | |
155 | return false; |
|
155 | return false; | |
156 | } else if (event.which === 78 && that.control_key_active) { |
|
156 | } else if (event.which === 78 && that.control_key_active) { | |
157 | // Select next = n |
|
157 | // Select next = n | |
158 | that.select_next(); |
|
158 | that.select_next(); | |
159 | that.control_key_active = false; |
|
159 | that.control_key_active = false; | |
160 | return false; |
|
160 | return false; | |
161 | } else if (event.which === 76 && that.control_key_active) { |
|
161 | } else if (event.which === 76 && that.control_key_active) { | |
162 | // Toggle line numbers = l |
|
162 | // Toggle line numbers = l | |
163 | that.cell_toggle_line_numbers(); |
|
163 | that.cell_toggle_line_numbers(); | |
164 | that.control_key_active = false; |
|
164 | that.control_key_active = false; | |
165 | return false; |
|
165 | return false; | |
166 | } else if (event.which === 73 && that.control_key_active) { |
|
166 | } else if (event.which === 73 && that.control_key_active) { | |
167 | // Interrupt kernel = i |
|
167 | // Interrupt kernel = i | |
168 | IPython.notebook.kernel.interrupt(); |
|
168 | IPython.notebook.kernel.interrupt(); | |
169 | that.control_key_active = false; |
|
169 | that.control_key_active = false; | |
170 | return false; |
|
170 | return false; | |
171 | } else if (event.which === 190 && that.control_key_active) { |
|
171 | } else if (event.which === 190 && that.control_key_active) { | |
172 | // Restart kernel = . # matches qt console |
|
172 | // Restart kernel = . # matches qt console | |
173 | IPython.notebook.restart_kernel(); |
|
173 | IPython.notebook.restart_kernel(); | |
174 | that.control_key_active = false; |
|
174 | that.control_key_active = false; | |
175 | return false; |
|
175 | return false; | |
176 | } else if (event.which === 72 && that.control_key_active) { |
|
176 | } else if (event.which === 72 && that.control_key_active) { | |
177 | // Show keyboard shortcuts = h |
|
177 | // Show keyboard shortcuts = h | |
178 | IPython.quick_help.show_keyboard_shortcuts(); |
|
178 | IPython.quick_help.show_keyboard_shortcuts(); | |
179 | that.control_key_active = false; |
|
179 | that.control_key_active = false; | |
180 | return false; |
|
180 | return false; | |
181 | } else if (event.which === 69 && that.control_key_active) { |
|
|||
182 | // Edit in Ace = e |
|
|||
183 | IPython.fulledit_widget.toggle(); |
|
|||
184 | that.control_key_active = false; |
|
|||
185 | return false; |
|
|||
186 | } else if (that.control_key_active) { |
|
181 | } else if (that.control_key_active) { | |
187 | that.control_key_active = false; |
|
182 | that.control_key_active = false; | |
188 | return true; |
|
183 | return true; | |
189 | }; |
|
184 | }; | |
190 | return true; |
|
185 | return true; | |
191 | }); |
|
186 | }); | |
192 |
|
187 | |||
193 | this.element.bind('collapse_pager', function () { |
|
188 | this.element.bind('collapse_pager', function () { | |
194 | var app_height = $('div#main_app').height(); // content height |
|
189 | var app_height = $('div#main_app').height(); // content height | |
195 | var splitter_height = $('div#pager_splitter').outerHeight(true); |
|
190 | var splitter_height = $('div#pager_splitter').outerHeight(true); | |
196 | var new_height = app_height - splitter_height; |
|
191 | var new_height = app_height - splitter_height; | |
197 | that.element.animate({height : new_height + 'px'}, 'fast'); |
|
192 | that.element.animate({height : new_height + 'px'}, 'fast'); | |
198 | }); |
|
193 | }); | |
199 |
|
194 | |||
200 | this.element.bind('expand_pager', function () { |
|
195 | this.element.bind('expand_pager', function () { | |
201 | var app_height = $('div#main_app').height(); // content height |
|
196 | var app_height = $('div#main_app').height(); // content height | |
202 | var splitter_height = $('div#pager_splitter').outerHeight(true); |
|
197 | var splitter_height = $('div#pager_splitter').outerHeight(true); | |
203 | var pager_height = $('div#pager').outerHeight(true); |
|
198 | var pager_height = $('div#pager').outerHeight(true); | |
204 | var new_height = app_height - pager_height - splitter_height; |
|
199 | var new_height = app_height - pager_height - splitter_height; | |
205 | that.element.animate({height : new_height + 'px'}, 'fast'); |
|
200 | that.element.animate({height : new_height + 'px'}, 'fast'); | |
206 | }); |
|
201 | }); | |
207 |
|
202 | |||
208 | $(window).bind('beforeunload', function () { |
|
203 | $(window).bind('beforeunload', function () { | |
209 | // TODO: Make killing the kernel configurable. |
|
204 | // TODO: Make killing the kernel configurable. | |
210 | var kill_kernel = false; |
|
205 | var kill_kernel = false; | |
211 | if (kill_kernel) { |
|
206 | if (kill_kernel) { | |
212 | that.kernel.kill(); |
|
207 | that.kernel.kill(); | |
213 | } |
|
208 | } | |
214 | if (that.dirty && ! that.read_only) { |
|
209 | if (that.dirty && ! that.read_only) { | |
215 | return "You have unsaved changes that will be lost if you leave this page."; |
|
210 | return "You have unsaved changes that will be lost if you leave this page."; | |
216 | }; |
|
211 | }; | |
217 | // Null is the *only* return value that will make the browser not |
|
212 | // Null is the *only* return value that will make the browser not | |
218 | // pop up the "don't leave" dialog. |
|
213 | // pop up the "don't leave" dialog. | |
219 | return null; |
|
214 | return null; | |
220 | }); |
|
215 | }); | |
221 | }; |
|
216 | }; | |
222 |
|
217 | |||
223 |
|
218 | |||
224 | Notebook.prototype.scroll_to_bottom = function () { |
|
219 | Notebook.prototype.scroll_to_bottom = function () { | |
225 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); |
|
220 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); | |
226 | }; |
|
221 | }; | |
227 |
|
222 | |||
228 |
|
223 | |||
229 | Notebook.prototype.scroll_to_top = function () { |
|
224 | Notebook.prototype.scroll_to_top = function () { | |
230 | this.element.animate({scrollTop:0}, 0); |
|
225 | this.element.animate({scrollTop:0}, 0); | |
231 | }; |
|
226 | }; | |
232 |
|
227 | |||
233 |
|
228 | |||
234 | // Cell indexing, retrieval, etc. |
|
229 | // Cell indexing, retrieval, etc. | |
235 |
|
230 | |||
236 | Notebook.prototype.get_cell_elements = function () { |
|
231 | Notebook.prototype.get_cell_elements = function () { | |
237 | return this.element.children("div.cell"); |
|
232 | return this.element.children("div.cell"); | |
238 | }; |
|
233 | }; | |
239 |
|
234 | |||
240 |
|
235 | |||
241 | Notebook.prototype.get_cell_element = function (index) { |
|
236 | Notebook.prototype.get_cell_element = function (index) { | |
242 | var result = null; |
|
237 | var result = null; | |
243 | var e = this.get_cell_elements().eq(index); |
|
238 | var e = this.get_cell_elements().eq(index); | |
244 | if (e.length !== 0) { |
|
239 | if (e.length !== 0) { | |
245 | result = e; |
|
240 | result = e; | |
246 | } |
|
241 | } | |
247 | return result; |
|
242 | return result; | |
248 | }; |
|
243 | }; | |
249 |
|
244 | |||
250 |
|
245 | |||
251 | Notebook.prototype.ncells = function (cell) { |
|
246 | Notebook.prototype.ncells = function (cell) { | |
252 | return this.get_cell_elements().length; |
|
247 | return this.get_cell_elements().length; | |
253 | }; |
|
248 | }; | |
254 |
|
249 | |||
255 |
|
250 | |||
256 | // TODO: we are often calling cells as cells()[i], which we should optimize |
|
251 | // TODO: we are often calling cells as cells()[i], which we should optimize | |
257 | // to cells(i) or a new method. |
|
252 | // to cells(i) or a new method. | |
258 | Notebook.prototype.get_cells = function () { |
|
253 | Notebook.prototype.get_cells = function () { | |
259 | return this.get_cell_elements().toArray().map(function (e) { |
|
254 | return this.get_cell_elements().toArray().map(function (e) { | |
260 | return $(e).data("cell"); |
|
255 | return $(e).data("cell"); | |
261 | }); |
|
256 | }); | |
262 | }; |
|
257 | }; | |
263 |
|
258 | |||
264 |
|
259 | |||
265 | Notebook.prototype.get_cell = function (index) { |
|
260 | Notebook.prototype.get_cell = function (index) { | |
266 | var result = null; |
|
261 | var result = null; | |
267 | var ce = this.get_cell_element(index); |
|
262 | var ce = this.get_cell_element(index); | |
268 | if (ce !== null) { |
|
263 | if (ce !== null) { | |
269 | result = ce.data('cell'); |
|
264 | result = ce.data('cell'); | |
270 | } |
|
265 | } | |
271 | return result; |
|
266 | return result; | |
272 | } |
|
267 | } | |
273 |
|
268 | |||
274 |
|
269 | |||
275 | Notebook.prototype.get_next_cell = function (cell) { |
|
270 | Notebook.prototype.get_next_cell = function (cell) { | |
276 | var result = null; |
|
271 | var result = null; | |
277 | var index = this.find_cell_index(cell); |
|
272 | var index = this.find_cell_index(cell); | |
278 | if (index !== null && index < this.ncells()) { |
|
273 | if (index !== null && index < this.ncells()) { | |
279 | result = this.get_cell(index+1); |
|
274 | result = this.get_cell(index+1); | |
280 | } |
|
275 | } | |
281 | return result; |
|
276 | return result; | |
282 | } |
|
277 | } | |
283 |
|
278 | |||
284 |
|
279 | |||
285 | Notebook.prototype.get_prev_cell = function (cell) { |
|
280 | Notebook.prototype.get_prev_cell = function (cell) { | |
286 | var result = null; |
|
281 | var result = null; | |
287 | var index = this.find_cell_index(cell); |
|
282 | var index = this.find_cell_index(cell); | |
288 | if (index !== null && index > 1) { |
|
283 | if (index !== null && index > 1) { | |
289 | result = this.get_cell(index-1); |
|
284 | result = this.get_cell(index-1); | |
290 | } |
|
285 | } | |
291 | return result; |
|
286 | return result; | |
292 | } |
|
287 | } | |
293 |
|
288 | |||
294 | Notebook.prototype.find_cell_index = function (cell) { |
|
289 | Notebook.prototype.find_cell_index = function (cell) { | |
295 | var result = null; |
|
290 | var result = null; | |
296 | this.get_cell_elements().filter(function (index) { |
|
291 | this.get_cell_elements().filter(function (index) { | |
297 | if ($(this).data("cell") === cell) { |
|
292 | if ($(this).data("cell") === cell) { | |
298 | result = index; |
|
293 | result = index; | |
299 | }; |
|
294 | }; | |
300 | }); |
|
295 | }); | |
301 | return result; |
|
296 | return result; | |
302 | }; |
|
297 | }; | |
303 |
|
298 | |||
304 |
|
299 | |||
305 | Notebook.prototype.index_or_selected = function (index) { |
|
300 | Notebook.prototype.index_or_selected = function (index) { | |
306 | var i; |
|
301 | var i; | |
307 | if (index === undefined || index === null) { |
|
302 | if (index === undefined || index === null) { | |
308 | i = this.get_selected_index(); |
|
303 | i = this.get_selected_index(); | |
309 | if (i === null) { |
|
304 | if (i === null) { | |
310 | i = 0; |
|
305 | i = 0; | |
311 | } |
|
306 | } | |
312 | } else { |
|
307 | } else { | |
313 | i = index; |
|
308 | i = index; | |
314 | } |
|
309 | } | |
315 | return i; |
|
310 | return i; | |
316 | }; |
|
311 | }; | |
317 |
|
312 | |||
318 |
|
313 | |||
319 | Notebook.prototype.get_selected_cell = function () { |
|
314 | Notebook.prototype.get_selected_cell = function () { | |
320 | var index = this.get_selected_index(); |
|
315 | var index = this.get_selected_index(); | |
321 | return this.get_cell(index); |
|
316 | return this.get_cell(index); | |
322 | }; |
|
317 | }; | |
323 |
|
318 | |||
324 |
|
319 | |||
325 | Notebook.prototype.is_valid_cell_index = function (index) { |
|
320 | Notebook.prototype.is_valid_cell_index = function (index) { | |
326 | if (index !== null && index >= 0 && index < this.ncells()) { |
|
321 | if (index !== null && index >= 0 && index < this.ncells()) { | |
327 | return true; |
|
322 | return true; | |
328 | } else { |
|
323 | } else { | |
329 | return false; |
|
324 | return false; | |
330 | }; |
|
325 | }; | |
331 | } |
|
326 | } | |
332 |
|
327 | |||
333 | Notebook.prototype.get_selected_index = function () { |
|
328 | Notebook.prototype.get_selected_index = function () { | |
334 | var result = null; |
|
329 | var result = null; | |
335 | this.get_cell_elements().filter(function (index) { |
|
330 | this.get_cell_elements().filter(function (index) { | |
336 | if ($(this).data("cell").selected === true) { |
|
331 | if ($(this).data("cell").selected === true) { | |
337 | result = index; |
|
332 | result = index; | |
338 | }; |
|
333 | }; | |
339 | }); |
|
334 | }); | |
340 | return result; |
|
335 | return result; | |
341 | }; |
|
336 | }; | |
342 |
|
337 | |||
343 |
|
338 | |||
344 | Notebook.prototype.cell_for_msg = function (msg_id) { |
|
339 | Notebook.prototype.cell_for_msg = function (msg_id) { | |
345 | var cell_id = this.msg_cell_map[msg_id]; |
|
340 | var cell_id = this.msg_cell_map[msg_id]; | |
346 | var result = null; |
|
341 | var result = null; | |
347 | this.get_cell_elements().filter(function (index) { |
|
342 | this.get_cell_elements().filter(function (index) { | |
348 | cell = $(this).data("cell"); |
|
343 | cell = $(this).data("cell"); | |
349 | if (cell.cell_id === cell_id) { |
|
344 | if (cell.cell_id === cell_id) { | |
350 | result = cell; |
|
345 | result = cell; | |
351 | }; |
|
346 | }; | |
352 | }); |
|
347 | }); | |
353 | return result; |
|
348 | return result; | |
354 | }; |
|
349 | }; | |
355 |
|
350 | |||
356 |
|
351 | |||
357 | // Cell selection. |
|
352 | // Cell selection. | |
358 |
|
353 | |||
359 | Notebook.prototype.select = function (index) { |
|
354 | Notebook.prototype.select = function (index) { | |
360 | if (index !== undefined && index >= 0 && index < this.ncells()) { |
|
355 | if (index !== undefined && index >= 0 && index < this.ncells()) { | |
361 | sindex = this.get_selected_index() |
|
356 | sindex = this.get_selected_index() | |
362 | if (sindex !== null && index !== sindex) { |
|
357 | if (sindex !== null && index !== sindex) { | |
363 | this.get_cell(sindex).unselect(); |
|
358 | this.get_cell(sindex).unselect(); | |
364 | }; |
|
359 | }; | |
365 | this.get_cell(index).select(); |
|
360 | this.get_cell(index).select(); | |
366 | }; |
|
361 | }; | |
367 | return this; |
|
362 | return this; | |
368 | }; |
|
363 | }; | |
369 |
|
364 | |||
370 |
|
365 | |||
371 | Notebook.prototype.select_next = function () { |
|
366 | Notebook.prototype.select_next = function () { | |
372 | var index = this.get_selected_index(); |
|
367 | var index = this.get_selected_index(); | |
373 | if (index !== null && index >= 0 && (index+1) < this.ncells()) { |
|
368 | if (index !== null && index >= 0 && (index+1) < this.ncells()) { | |
374 | this.select(index+1); |
|
369 | this.select(index+1); | |
375 | }; |
|
370 | }; | |
376 | return this; |
|
371 | return this; | |
377 | }; |
|
372 | }; | |
378 |
|
373 | |||
379 |
|
374 | |||
380 | Notebook.prototype.select_prev = function () { |
|
375 | Notebook.prototype.select_prev = function () { | |
381 | var index = this.get_selected_index(); |
|
376 | var index = this.get_selected_index(); | |
382 | if (index !== null && index >= 0 && (index-1) < this.ncells()) { |
|
377 | if (index !== null && index >= 0 && (index-1) < this.ncells()) { | |
383 | this.select(index-1); |
|
378 | this.select(index-1); | |
384 | }; |
|
379 | }; | |
385 | return this; |
|
380 | return this; | |
386 | }; |
|
381 | }; | |
387 |
|
382 | |||
388 |
|
383 | |||
389 | // Cell movement |
|
384 | // Cell movement | |
390 |
|
385 | |||
391 | Notebook.prototype.move_cell_up = function (index) { |
|
386 | Notebook.prototype.move_cell_up = function (index) { | |
392 | var i = this.index_or_selected(); |
|
387 | var i = this.index_or_selected(); | |
393 | if (i !== null && i < this.ncells() && i > 0) { |
|
388 | if (i !== null && i < this.ncells() && i > 0) { | |
394 | var pivot = this.get_cell_element(i-1); |
|
389 | var pivot = this.get_cell_element(i-1); | |
395 | var tomove = this.get_cell_element(i); |
|
390 | var tomove = this.get_cell_element(i); | |
396 | if (pivot !== null && tomove !== null) { |
|
391 | if (pivot !== null && tomove !== null) { | |
397 | tomove.detach(); |
|
392 | tomove.detach(); | |
398 | pivot.before(tomove); |
|
393 | pivot.before(tomove); | |
399 | this.select(i-1); |
|
394 | this.select(i-1); | |
400 | }; |
|
395 | }; | |
401 | }; |
|
396 | }; | |
402 | this.dirty = true; |
|
397 | this.dirty = true; | |
403 | return this; |
|
398 | return this; | |
404 | }; |
|
399 | }; | |
405 |
|
400 | |||
406 |
|
401 | |||
407 | Notebook.prototype.move_cell_down = function (index) { |
|
402 | Notebook.prototype.move_cell_down = function (index) { | |
408 | var i = this.index_or_selected(); |
|
403 | var i = this.index_or_selected(); | |
409 | if (i !== null && i < (this.ncells()-1) && i >= 0) { |
|
404 | if (i !== null && i < (this.ncells()-1) && i >= 0) { | |
410 | var pivot = this.get_cell_element(i+1); |
|
405 | var pivot = this.get_cell_element(i+1); | |
411 | var tomove = this.get_cell_element(i); |
|
406 | var tomove = this.get_cell_element(i); | |
412 | if (pivot !== null && tomove !== null) { |
|
407 | if (pivot !== null && tomove !== null) { | |
413 | tomove.detach(); |
|
408 | tomove.detach(); | |
414 | pivot.after(tomove); |
|
409 | pivot.after(tomove); | |
415 | this.select(i+1); |
|
410 | this.select(i+1); | |
416 | }; |
|
411 | }; | |
417 | }; |
|
412 | }; | |
418 | this.dirty = true; |
|
413 | this.dirty = true; | |
419 | return this; |
|
414 | return this; | |
420 | }; |
|
415 | }; | |
421 |
|
416 | |||
422 |
|
417 | |||
423 | Notebook.prototype.sort_cells = function () { |
|
418 | Notebook.prototype.sort_cells = function () { | |
424 | // This is not working right now. Calling this will actually crash |
|
419 | // This is not working right now. Calling this will actually crash | |
425 | // the browser. I think there is an infinite loop in here... |
|
420 | // the browser. I think there is an infinite loop in here... | |
426 | var ncells = this.ncells(); |
|
421 | var ncells = this.ncells(); | |
427 | var sindex = this.get_selected_index(); |
|
422 | var sindex = this.get_selected_index(); | |
428 | var swapped; |
|
423 | var swapped; | |
429 | do { |
|
424 | do { | |
430 | swapped = false; |
|
425 | swapped = false; | |
431 | for (var i=1; i<ncells; i++) { |
|
426 | for (var i=1; i<ncells; i++) { | |
432 | current = this.get_cell(i); |
|
427 | current = this.get_cell(i); | |
433 | previous = this.get_cell(i-1); |
|
428 | previous = this.get_cell(i-1); | |
434 | if (previous.input_prompt_number > current.input_prompt_number) { |
|
429 | if (previous.input_prompt_number > current.input_prompt_number) { | |
435 | this.move_cell_up(i); |
|
430 | this.move_cell_up(i); | |
436 | swapped = true; |
|
431 | swapped = true; | |
437 | }; |
|
432 | }; | |
438 | }; |
|
433 | }; | |
439 | } while (swapped); |
|
434 | } while (swapped); | |
440 | this.select(sindex); |
|
435 | this.select(sindex); | |
441 | return this; |
|
436 | return this; | |
442 | }; |
|
437 | }; | |
443 |
|
438 | |||
444 | // Insertion, deletion. |
|
439 | // Insertion, deletion. | |
445 |
|
440 | |||
446 | Notebook.prototype.delete_cell = function (index) { |
|
441 | Notebook.prototype.delete_cell = function (index) { | |
447 | var i = this.index_or_selected(index); |
|
442 | var i = this.index_or_selected(index); | |
448 | if (this.is_valid_cell_index(i)) { |
|
443 | if (this.is_valid_cell_index(i)) { | |
449 | var ce = this.get_cell_element(i); |
|
444 | var ce = this.get_cell_element(i); | |
450 | ce.remove(); |
|
445 | ce.remove(); | |
451 | if (i === (this.ncells())) { |
|
446 | if (i === (this.ncells())) { | |
452 | this.select(i-1); |
|
447 | this.select(i-1); | |
453 | } else { |
|
448 | } else { | |
454 | this.select(i); |
|
449 | this.select(i); | |
455 | }; |
|
450 | }; | |
456 | this.dirty = true; |
|
451 | this.dirty = true; | |
457 | }; |
|
452 | }; | |
458 | return this; |
|
453 | return this; | |
459 | }; |
|
454 | }; | |
460 |
|
455 | |||
461 |
|
456 | |||
462 | Notebook.prototype.insert_cell_below = function (type, index) { |
|
457 | Notebook.prototype.insert_cell_below = function (type, index) { | |
463 | // type = ('code','html','markdown') |
|
458 | // type = ('code','html','markdown') | |
464 | // index = cell index or undefined to insert below selected |
|
459 | // index = cell index or undefined to insert below selected | |
465 | index = this.index_or_selected(index); |
|
460 | index = this.index_or_selected(index); | |
466 | if (this.ncells() === 0 || this.is_valid_cell_index(index)) { |
|
461 | if (this.ncells() === 0 || this.is_valid_cell_index(index)) { | |
467 | var cell = null; |
|
462 | var cell = null; | |
468 | if (type === 'code') { |
|
463 | if (type === 'code') { | |
469 | var cell = new IPython.CodeCell(this); |
|
464 | var cell = new IPython.CodeCell(this); | |
470 | cell.set_input_prompt(); |
|
465 | cell.set_input_prompt(); | |
471 | } else if (type === 'markdown') { |
|
466 | } else if (type === 'markdown') { | |
472 | var cell = new IPython.MarkdownCell(this); |
|
467 | var cell = new IPython.MarkdownCell(this); | |
473 | } else if (type === 'html') { |
|
468 | } else if (type === 'html') { | |
474 | var cell = new IPython.HTMLCell(this); |
|
469 | var cell = new IPython.HTMLCell(this); | |
475 | }; |
|
470 | }; | |
476 | if (cell !== null) { |
|
471 | if (cell !== null) { | |
477 | if (this.ncells() === 0) { |
|
472 | if (this.ncells() === 0) { | |
478 | this.element.find('div.end_space').before(cell.element); |
|
473 | this.element.find('div.end_space').before(cell.element); | |
479 | } else if (this.is_valid_cell_index(index)) { |
|
474 | } else if (this.is_valid_cell_index(index)) { | |
480 | this.get_cell_element(index).after(cell.element); |
|
475 | this.get_cell_element(index).after(cell.element); | |
481 | }; |
|
476 | }; | |
482 | cell.render(); |
|
477 | cell.render(); | |
483 | this.select(this.find_cell_index(cell)); |
|
478 | this.select(this.find_cell_index(cell)); | |
484 | this.dirty = true; |
|
479 | this.dirty = true; | |
485 | return cell; |
|
480 | return cell; | |
486 | }; |
|
481 | }; | |
487 | }; |
|
482 | }; | |
488 | }; |
|
483 | }; | |
489 |
|
484 | |||
490 |
|
485 | |||
491 | Notebook.prototype.insert_cell_above = function (type, index) { |
|
486 | Notebook.prototype.insert_cell_above = function (type, index) { | |
492 | // type = ('code','html','markdown') |
|
487 | // type = ('code','html','markdown') | |
493 | // index = cell index or undefined to insert above selected |
|
488 | // index = cell index or undefined to insert above selected | |
494 | index = this.index_or_selected(index); |
|
489 | index = this.index_or_selected(index); | |
495 | if (this.ncells() === 0 || this.is_valid_cell_index(index)) { |
|
490 | if (this.ncells() === 0 || this.is_valid_cell_index(index)) { | |
496 | var cell = null; |
|
491 | var cell = null; | |
497 | if (type === 'code') { |
|
492 | if (type === 'code') { | |
498 | var cell = new IPython.CodeCell(this); |
|
493 | var cell = new IPython.CodeCell(this); | |
499 | cell.set_input_prompt(); |
|
494 | cell.set_input_prompt(); | |
500 | } else if (type === 'markdown') { |
|
495 | } else if (type === 'markdown') { | |
501 | var cell = new IPython.MarkdownCell(this); |
|
496 | var cell = new IPython.MarkdownCell(this); | |
502 | } else if (type === 'html') { |
|
497 | } else if (type === 'html') { | |
503 | var cell = new IPython.HTMLCell(this); |
|
498 | var cell = new IPython.HTMLCell(this); | |
504 | }; |
|
499 | }; | |
505 | if (cell !== null) { |
|
500 | if (cell !== null) { | |
506 | if (this.ncells() === 0) { |
|
501 | if (this.ncells() === 0) { | |
507 | this.element.find('div.end_space').before(cell.element); |
|
502 | this.element.find('div.end_space').before(cell.element); | |
508 | } else if (this.is_valid_cell_index(index)) { |
|
503 | } else if (this.is_valid_cell_index(index)) { | |
509 | this.get_cell_element(index).before(cell.element); |
|
504 | this.get_cell_element(index).before(cell.element); | |
510 | }; |
|
505 | }; | |
511 | cell.render(); |
|
506 | cell.render(); | |
512 | this.select(this.find_cell_index(cell)); |
|
507 | this.select(this.find_cell_index(cell)); | |
513 | this.dirty = true; |
|
508 | this.dirty = true; | |
514 | return cell; |
|
509 | return cell; | |
515 | }; |
|
510 | }; | |
516 | }; |
|
511 | }; | |
517 | }; |
|
512 | }; | |
518 |
|
513 | |||
519 |
|
514 | |||
520 | Notebook.prototype.to_code = function (index) { |
|
515 | Notebook.prototype.to_code = function (index) { | |
521 | var i = this.index_or_selected(index); |
|
516 | var i = this.index_or_selected(index); | |
522 | if (this.is_valid_cell_index(i)) { |
|
517 | if (this.is_valid_cell_index(i)) { | |
523 | var source_element = this.get_cell_element(i); |
|
518 | var source_element = this.get_cell_element(i); | |
524 | var source_cell = source_element.data("cell"); |
|
519 | var source_cell = source_element.data("cell"); | |
525 | if (!(source_cell instanceof IPython.CodeCell)) { |
|
520 | if (!(source_cell instanceof IPython.CodeCell)) { | |
526 | target_cell = this.insert_cell_below('code',i); |
|
521 | target_cell = this.insert_cell_below('code',i); | |
527 | var text = source_cell.get_text(); |
|
522 | var text = source_cell.get_text(); | |
528 | if (text === source_cell.placeholder) { |
|
523 | if (text === source_cell.placeholder) { | |
529 | text = ''; |
|
524 | text = ''; | |
530 | } |
|
525 | } | |
531 | target_cell.set_text(text); |
|
526 | target_cell.set_text(text); | |
532 | source_element.remove(); |
|
527 | source_element.remove(); | |
533 | }; |
|
528 | }; | |
534 | this.dirty = true; |
|
529 | this.dirty = true; | |
535 | }; |
|
530 | }; | |
536 | }; |
|
531 | }; | |
537 |
|
532 | |||
538 |
|
533 | |||
539 | Notebook.prototype.to_markdown = function (index) { |
|
534 | Notebook.prototype.to_markdown = function (index) { | |
540 | var i = this.index_or_selected(index); |
|
535 | var i = this.index_or_selected(index); | |
541 | if (this.is_valid_cell_index(i)) { |
|
536 | if (this.is_valid_cell_index(i)) { | |
542 | var source_element = this.get_cell_element(i); |
|
537 | var source_element = this.get_cell_element(i); | |
543 | var source_cell = source_element.data("cell"); |
|
538 | var source_cell = source_element.data("cell"); | |
544 | var target_cell = null; |
|
539 | var target_cell = null; | |
545 | if (!(source_cell instanceof IPython.MarkdownCell)) { |
|
540 | if (!(source_cell instanceof IPython.MarkdownCell)) { | |
546 | target_cell = this.insert_cell_below('markdown',i); |
|
541 | target_cell = this.insert_cell_below('markdown',i); | |
547 | var text = source_cell.get_text(); |
|
542 | var text = source_cell.get_text(); | |
548 | if (text === source_cell.placeholder) { |
|
543 | if (text === source_cell.placeholder) { | |
549 | text = ''; |
|
544 | text = ''; | |
550 | }; |
|
545 | }; | |
551 | if (target_cell !== null) { |
|
546 | if (target_cell !== null) { | |
552 | // The edit must come before the set_text. |
|
547 | // The edit must come before the set_text. | |
553 | target_cell.edit(); |
|
548 | target_cell.edit(); | |
554 | target_cell.set_text(text); |
|
549 | target_cell.set_text(text); | |
555 | source_element.remove(); |
|
550 | source_element.remove(); | |
556 | } |
|
551 | } | |
557 | this.dirty = true; |
|
552 | this.dirty = true; | |
558 | }; |
|
553 | }; | |
559 | }; |
|
554 | }; | |
560 | }; |
|
555 | }; | |
561 |
|
556 | |||
562 |
|
557 | |||
563 | Notebook.prototype.to_html = function (index) { |
|
558 | Notebook.prototype.to_html = function (index) { | |
564 | var i = this.index_or_selected(index); |
|
559 | var i = this.index_or_selected(index); | |
565 | if (this.is_valid_cell_index(i)) { |
|
560 | if (this.is_valid_cell_index(i)) { | |
566 | var source_element = this.get_cell_element(i); |
|
561 | var source_element = this.get_cell_element(i); | |
567 | var source_cell = source_element.data("cell"); |
|
562 | var source_cell = source_element.data("cell"); | |
568 | var target_cell = null; |
|
563 | var target_cell = null; | |
569 | if (!(source_cell instanceof IPython.HTMLCell)) { |
|
564 | if (!(source_cell instanceof IPython.HTMLCell)) { | |
570 | target_cell = this.insert_cell_below('html',i); |
|
565 | target_cell = this.insert_cell_below('html',i); | |
571 | var text = source_cell.get_text(); |
|
566 | var text = source_cell.get_text(); | |
572 | if (text === source_cell.placeholder) { |
|
567 | if (text === source_cell.placeholder) { | |
573 | text = ''; |
|
568 | text = ''; | |
574 | }; |
|
569 | }; | |
575 | if (target_cell !== null) { |
|
570 | if (target_cell !== null) { | |
576 | // The edit must come before the set_text. |
|
571 | // The edit must come before the set_text. | |
577 | target_cell.edit(); |
|
572 | target_cell.edit(); | |
578 | target_cell.set_text(text); |
|
573 | target_cell.set_text(text); | |
579 | source_element.remove(); |
|
574 | source_element.remove(); | |
580 | } |
|
575 | } | |
581 | this.dirty = true; |
|
576 | this.dirty = true; | |
582 | }; |
|
577 | }; | |
583 | }; |
|
578 | }; | |
584 | }; |
|
579 | }; | |
585 |
|
580 | |||
586 |
|
581 | |||
587 | // Cut/Copy/Paste |
|
582 | // Cut/Copy/Paste | |
588 |
|
583 | |||
589 | Notebook.prototype.enable_paste = function () { |
|
584 | Notebook.prototype.enable_paste = function () { | |
590 | var that = this; |
|
585 | var that = this; | |
591 | if (!this.paste_enabled) { |
|
586 | if (!this.paste_enabled) { | |
592 | $('#paste_cell').removeClass('ui-state-disabled') |
|
587 | $('#paste_cell').removeClass('ui-state-disabled') | |
593 | .on('click', function () {that.paste_cell();}); |
|
588 | .on('click', function () {that.paste_cell();}); | |
594 | $('#paste_cell_above').removeClass('ui-state-disabled') |
|
589 | $('#paste_cell_above').removeClass('ui-state-disabled') | |
595 | .on('click', function () {that.paste_cell_above();}); |
|
590 | .on('click', function () {that.paste_cell_above();}); | |
596 | $('#paste_cell_below').removeClass('ui-state-disabled') |
|
591 | $('#paste_cell_below').removeClass('ui-state-disabled') | |
597 | .on('click', function () {that.paste_cell_below();}); |
|
592 | .on('click', function () {that.paste_cell_below();}); | |
598 | this.paste_enabled = true; |
|
593 | this.paste_enabled = true; | |
599 | }; |
|
594 | }; | |
600 | }; |
|
595 | }; | |
601 |
|
596 | |||
602 |
|
597 | |||
603 | Notebook.prototype.disable_paste = function () { |
|
598 | Notebook.prototype.disable_paste = function () { | |
604 | if (this.paste_enabled) { |
|
599 | if (this.paste_enabled) { | |
605 | $('#paste_cell').addClass('ui-state-disabled').off('click'); |
|
600 | $('#paste_cell').addClass('ui-state-disabled').off('click'); | |
606 | $('#paste_cell_above').addClass('ui-state-disabled').off('click'); |
|
601 | $('#paste_cell_above').addClass('ui-state-disabled').off('click'); | |
607 | $('#paste_cell_below').addClass('ui-state-disabled').off('click'); |
|
602 | $('#paste_cell_below').addClass('ui-state-disabled').off('click'); | |
608 | this.paste_enabled = false; |
|
603 | this.paste_enabled = false; | |
609 | }; |
|
604 | }; | |
610 | }; |
|
605 | }; | |
611 |
|
606 | |||
612 |
|
607 | |||
613 | Notebook.prototype.cut_cell = function () { |
|
608 | Notebook.prototype.cut_cell = function () { | |
614 | this.copy_cell(); |
|
609 | this.copy_cell(); | |
615 | this.delete_cell(); |
|
610 | this.delete_cell(); | |
616 | } |
|
611 | } | |
617 |
|
612 | |||
618 | Notebook.prototype.copy_cell = function () { |
|
613 | Notebook.prototype.copy_cell = function () { | |
619 | var cell = this.get_selected_cell(); |
|
614 | var cell = this.get_selected_cell(); | |
620 | this.clipboard = cell.toJSON(); |
|
615 | this.clipboard = cell.toJSON(); | |
621 | this.enable_paste(); |
|
616 | this.enable_paste(); | |
622 | }; |
|
617 | }; | |
623 |
|
618 | |||
624 |
|
619 | |||
625 | Notebook.prototype.paste_cell = function () { |
|
620 | Notebook.prototype.paste_cell = function () { | |
626 | if (this.clipboard !== null && this.paste_enabled) { |
|
621 | if (this.clipboard !== null && this.paste_enabled) { | |
627 | var cell_data = this.clipboard; |
|
622 | var cell_data = this.clipboard; | |
628 | var new_cell = this.insert_cell_above(cell_data.cell_type); |
|
623 | var new_cell = this.insert_cell_above(cell_data.cell_type); | |
629 | new_cell.fromJSON(cell_data); |
|
624 | new_cell.fromJSON(cell_data); | |
630 | old_cell = this.get_next_cell(new_cell); |
|
625 | old_cell = this.get_next_cell(new_cell); | |
631 | this.delete_cell(this.find_cell_index(old_cell)); |
|
626 | this.delete_cell(this.find_cell_index(old_cell)); | |
632 | this.select(this.find_cell_index(new_cell)); |
|
627 | this.select(this.find_cell_index(new_cell)); | |
633 | }; |
|
628 | }; | |
634 | }; |
|
629 | }; | |
635 |
|
630 | |||
636 |
|
631 | |||
637 | Notebook.prototype.paste_cell_above = function () { |
|
632 | Notebook.prototype.paste_cell_above = function () { | |
638 | if (this.clipboard !== null && this.paste_enabled) { |
|
633 | if (this.clipboard !== null && this.paste_enabled) { | |
639 | var cell_data = this.clipboard; |
|
634 | var cell_data = this.clipboard; | |
640 | var new_cell = this.insert_cell_above(cell_data.cell_type); |
|
635 | var new_cell = this.insert_cell_above(cell_data.cell_type); | |
641 | new_cell.fromJSON(cell_data); |
|
636 | new_cell.fromJSON(cell_data); | |
642 | }; |
|
637 | }; | |
643 | }; |
|
638 | }; | |
644 |
|
639 | |||
645 |
|
640 | |||
646 | Notebook.prototype.paste_cell_below = function () { |
|
641 | Notebook.prototype.paste_cell_below = function () { | |
647 | if (this.clipboard !== null && this.paste_enabled) { |
|
642 | if (this.clipboard !== null && this.paste_enabled) { | |
648 | var cell_data = this.clipboard; |
|
643 | var cell_data = this.clipboard; | |
649 | var new_cell = this.insert_cell_below(cell_data.cell_type); |
|
644 | var new_cell = this.insert_cell_below(cell_data.cell_type); | |
650 | new_cell.fromJSON(cell_data); |
|
645 | new_cell.fromJSON(cell_data); | |
651 | }; |
|
646 | }; | |
652 | }; |
|
647 | }; | |
653 |
|
648 | |||
654 |
|
649 | |||
655 | // Split/merge |
|
650 | // Split/merge | |
656 |
|
651 | |||
657 | Notebook.prototype.split_cell = function () { |
|
652 | Notebook.prototype.split_cell = function () { | |
658 | // Todo: implement spliting for other cell types. |
|
653 | // Todo: implement spliting for other cell types. | |
659 | var cell = this.get_selected_cell(); |
|
654 | var cell = this.get_selected_cell(); | |
660 | if (cell.is_splittable()) { |
|
655 | if (cell.is_splittable()) { | |
661 | texta = cell.get_pre_cursor(); |
|
656 | texta = cell.get_pre_cursor(); | |
662 | textb = cell.get_post_cursor(); |
|
657 | textb = cell.get_post_cursor(); | |
663 | if (cell instanceof IPython.CodeCell) { |
|
658 | if (cell instanceof IPython.CodeCell) { | |
664 | cell.set_text(texta); |
|
659 | cell.set_text(texta); | |
665 | var new_cell = this.insert_cell_below('code'); |
|
660 | var new_cell = this.insert_cell_below('code'); | |
666 | new_cell.set_text(textb); |
|
661 | new_cell.set_text(textb); | |
667 | } else if (cell instanceof IPython.MarkdownCell) { |
|
662 | } else if (cell instanceof IPython.MarkdownCell) { | |
668 | cell.set_text(texta); |
|
663 | cell.set_text(texta); | |
669 | cell.render(); |
|
664 | cell.render(); | |
670 | var new_cell = this.insert_cell_below('markdown'); |
|
665 | var new_cell = this.insert_cell_below('markdown'); | |
671 | new_cell.edit(); // editor must be visible to call set_text |
|
666 | new_cell.edit(); // editor must be visible to call set_text | |
672 | new_cell.set_text(textb); |
|
667 | new_cell.set_text(textb); | |
673 | new_cell.render(); |
|
668 | new_cell.render(); | |
674 | } else if (cell instanceof IPython.HTMLCell) { |
|
669 | } else if (cell instanceof IPython.HTMLCell) { | |
675 | cell.set_text(texta); |
|
670 | cell.set_text(texta); | |
676 | cell.render(); |
|
671 | cell.render(); | |
677 | var new_cell = this.insert_cell_below('html'); |
|
672 | var new_cell = this.insert_cell_below('html'); | |
678 | new_cell.edit(); // editor must be visible to call set_text |
|
673 | new_cell.edit(); // editor must be visible to call set_text | |
679 | new_cell.set_text(textb); |
|
674 | new_cell.set_text(textb); | |
680 | new_cell.render(); |
|
675 | new_cell.render(); | |
681 | }; |
|
676 | }; | |
682 | }; |
|
677 | }; | |
683 | }; |
|
678 | }; | |
684 |
|
679 | |||
685 |
|
680 | |||
686 | Notebook.prototype.merge_cell_above = function () { |
|
681 | Notebook.prototype.merge_cell_above = function () { | |
687 | var index = this.get_selected_index(); |
|
682 | var index = this.get_selected_index(); | |
688 | var cell = this.get_cell(index); |
|
683 | var cell = this.get_cell(index); | |
689 | if (index > 0) { |
|
684 | if (index > 0) { | |
690 | upper_cell = this.get_cell(index-1); |
|
685 | upper_cell = this.get_cell(index-1); | |
691 | upper_text = upper_cell.get_text(); |
|
686 | upper_text = upper_cell.get_text(); | |
692 | text = cell.get_text(); |
|
687 | text = cell.get_text(); | |
693 | if (cell instanceof IPython.CodeCell) { |
|
688 | if (cell instanceof IPython.CodeCell) { | |
694 | cell.set_text(upper_text+'\n'+text); |
|
689 | cell.set_text(upper_text+'\n'+text); | |
695 | } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { |
|
690 | } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { | |
696 | cell.edit(); |
|
691 | cell.edit(); | |
697 | cell.set_text(upper_text+'\n'+text); |
|
692 | cell.set_text(upper_text+'\n'+text); | |
698 | cell.render(); |
|
693 | cell.render(); | |
699 | }; |
|
694 | }; | |
700 | this.delete_cell(index-1); |
|
695 | this.delete_cell(index-1); | |
701 | this.select(this.find_cell_index(cell)); |
|
696 | this.select(this.find_cell_index(cell)); | |
702 | }; |
|
697 | }; | |
703 | }; |
|
698 | }; | |
704 |
|
699 | |||
705 |
|
700 | |||
706 | Notebook.prototype.merge_cell_below = function () { |
|
701 | Notebook.prototype.merge_cell_below = function () { | |
707 | var index = this.get_selected_index(); |
|
702 | var index = this.get_selected_index(); | |
708 | var cell = this.get_cell(index); |
|
703 | var cell = this.get_cell(index); | |
709 | if (index < this.ncells()-1) { |
|
704 | if (index < this.ncells()-1) { | |
710 | lower_cell = this.get_cell(index+1); |
|
705 | lower_cell = this.get_cell(index+1); | |
711 | lower_text = lower_cell.get_text(); |
|
706 | lower_text = lower_cell.get_text(); | |
712 | text = cell.get_text(); |
|
707 | text = cell.get_text(); | |
713 | if (cell instanceof IPython.CodeCell) { |
|
708 | if (cell instanceof IPython.CodeCell) { | |
714 | cell.set_text(text+'\n'+lower_text); |
|
709 | cell.set_text(text+'\n'+lower_text); | |
715 | } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { |
|
710 | } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { | |
716 | cell.edit(); |
|
711 | cell.edit(); | |
717 | cell.set_text(text+'\n'+lower_text); |
|
712 | cell.set_text(text+'\n'+lower_text); | |
718 | cell.render(); |
|
713 | cell.render(); | |
719 | }; |
|
714 | }; | |
720 | this.delete_cell(index+1); |
|
715 | this.delete_cell(index+1); | |
721 | this.select(this.find_cell_index(cell)); |
|
716 | this.select(this.find_cell_index(cell)); | |
722 | }; |
|
717 | }; | |
723 | }; |
|
718 | }; | |
724 |
|
719 | |||
725 |
|
720 | |||
726 | // Cell collapsing and output clearing |
|
721 | // Cell collapsing and output clearing | |
727 |
|
722 | |||
728 | Notebook.prototype.collapse = function (index) { |
|
723 | Notebook.prototype.collapse = function (index) { | |
729 | var i = this.index_or_selected(index); |
|
724 | var i = this.index_or_selected(index); | |
730 | this.get_cell(i).collapse(); |
|
725 | this.get_cell(i).collapse(); | |
731 | this.dirty = true; |
|
726 | this.dirty = true; | |
732 | }; |
|
727 | }; | |
733 |
|
728 | |||
734 |
|
729 | |||
735 | Notebook.prototype.expand = function (index) { |
|
730 | Notebook.prototype.expand = function (index) { | |
736 | var i = this.index_or_selected(index); |
|
731 | var i = this.index_or_selected(index); | |
737 | this.get_cell(i).expand(); |
|
732 | this.get_cell(i).expand(); | |
738 | this.dirty = true; |
|
733 | this.dirty = true; | |
739 | }; |
|
734 | }; | |
740 |
|
735 | |||
741 |
|
736 | |||
742 | Notebook.prototype.toggle_output = function (index) { |
|
737 | Notebook.prototype.toggle_output = function (index) { | |
743 | var i = this.index_or_selected(index); |
|
738 | var i = this.index_or_selected(index); | |
744 | this.get_cell(i).toggle_output(); |
|
739 | this.get_cell(i).toggle_output(); | |
745 | this.dirty = true; |
|
740 | this.dirty = true; | |
746 | }; |
|
741 | }; | |
747 |
|
742 | |||
748 |
|
743 | |||
749 | Notebook.prototype.set_timebeforetooltip = function (time) { |
|
744 | Notebook.prototype.set_timebeforetooltip = function (time) { | |
750 | this.time_before_tooltip = time; |
|
745 | this.time_before_tooltip = time; | |
751 | }; |
|
746 | }; | |
752 |
|
747 | |||
753 |
|
748 | |||
754 | Notebook.prototype.set_tooltipontab = function (state) { |
|
749 | Notebook.prototype.set_tooltipontab = function (state) { | |
755 | this.tooltip_on_tab = state; |
|
750 | this.tooltip_on_tab = state; | |
756 | }; |
|
751 | }; | |
757 |
|
752 | |||
758 |
|
753 | |||
759 | Notebook.prototype.set_smartcompleter = function (state) { |
|
754 | Notebook.prototype.set_smartcompleter = function (state) { | |
760 | this.smart_completer = state; |
|
755 | this.smart_completer = state; | |
761 | }; |
|
756 | }; | |
762 |
|
757 | |||
763 |
|
758 | |||
764 | Notebook.prototype.clear_all_output = function () { |
|
759 | Notebook.prototype.clear_all_output = function () { | |
765 | var ncells = this.ncells(); |
|
760 | var ncells = this.ncells(); | |
766 | var cells = this.get_cells(); |
|
761 | var cells = this.get_cells(); | |
767 | for (var i=0; i<ncells; i++) { |
|
762 | for (var i=0; i<ncells; i++) { | |
768 | if (cells[i] instanceof IPython.CodeCell) { |
|
763 | if (cells[i] instanceof IPython.CodeCell) { | |
769 | cells[i].clear_output(true,true,true); |
|
764 | cells[i].clear_output(true,true,true); | |
770 | } |
|
765 | } | |
771 | }; |
|
766 | }; | |
772 | this.dirty = true; |
|
767 | this.dirty = true; | |
773 | }; |
|
768 | }; | |
774 |
|
769 | |||
775 |
|
770 | |||
776 | // Other cell functions: line numbers, ... |
|
771 | // Other cell functions: line numbers, ... | |
777 |
|
772 | |||
778 | Notebook.prototype.cell_toggle_line_numbers = function() { |
|
773 | Notebook.prototype.cell_toggle_line_numbers = function() { | |
779 | this.get_selected_cell().toggle_line_numbers(); |
|
774 | this.get_selected_cell().toggle_line_numbers(); | |
780 | }; |
|
775 | }; | |
781 |
|
776 | |||
782 | // Kernel related things |
|
777 | // Kernel related things | |
783 |
|
778 | |||
784 | Notebook.prototype.start_kernel = function () { |
|
779 | Notebook.prototype.start_kernel = function () { | |
785 | this.kernel = new IPython.Kernel(); |
|
780 | this.kernel = new IPython.Kernel(); | |
786 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
781 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
787 | this.kernel.start(notebook_id, $.proxy(this.kernel_started, this)); |
|
782 | this.kernel.start(notebook_id, $.proxy(this.kernel_started, this)); | |
788 | }; |
|
783 | }; | |
789 |
|
784 | |||
790 |
|
785 | |||
791 | Notebook.prototype.restart_kernel = function () { |
|
786 | Notebook.prototype.restart_kernel = function () { | |
792 | var that = this; |
|
787 | var that = this; | |
793 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
788 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
794 |
|
789 | |||
795 | var dialog = $('<div/>'); |
|
790 | var dialog = $('<div/>'); | |
796 | dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.'); |
|
791 | dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.'); | |
797 | $(document).append(dialog); |
|
792 | $(document).append(dialog); | |
798 | dialog.dialog({ |
|
793 | dialog.dialog({ | |
799 | resizable: false, |
|
794 | resizable: false, | |
800 | modal: true, |
|
795 | modal: true, | |
801 | title: "Restart kernel or continue running?", |
|
796 | title: "Restart kernel or continue running?", | |
802 | closeText: '', |
|
797 | closeText: '', | |
803 | buttons : { |
|
798 | buttons : { | |
804 | "Restart": function () { |
|
799 | "Restart": function () { | |
805 | that.kernel.restart($.proxy(that.kernel_started, that)); |
|
800 | that.kernel.restart($.proxy(that.kernel_started, that)); | |
806 | $(this).dialog('close'); |
|
801 | $(this).dialog('close'); | |
807 | }, |
|
802 | }, | |
808 | "Continue running": function () { |
|
803 | "Continue running": function () { | |
809 | $(this).dialog('close'); |
|
804 | $(this).dialog('close'); | |
810 | } |
|
805 | } | |
811 | } |
|
806 | } | |
812 | }); |
|
807 | }); | |
813 | }; |
|
808 | }; | |
814 |
|
809 | |||
815 |
|
810 | |||
816 | Notebook.prototype.kernel_started = function () { |
|
811 | Notebook.prototype.kernel_started = function () { | |
817 | console.log("Kernel started: ", this.kernel.kernel_id); |
|
812 | console.log("Kernel started: ", this.kernel.kernel_id); | |
818 | this.kernel.shell_channel.onmessage = $.proxy(this.handle_shell_reply,this); |
|
813 | this.kernel.shell_channel.onmessage = $.proxy(this.handle_shell_reply,this); | |
819 | this.kernel.iopub_channel.onmessage = $.proxy(this.handle_iopub_reply,this); |
|
814 | this.kernel.iopub_channel.onmessage = $.proxy(this.handle_iopub_reply,this); | |
820 | }; |
|
815 | }; | |
821 |
|
816 | |||
822 |
|
817 | |||
823 | Notebook.prototype.handle_shell_reply = function (e) { |
|
818 | Notebook.prototype.handle_shell_reply = function (e) { | |
824 | reply = $.parseJSON(e.data); |
|
819 | reply = $.parseJSON(e.data); | |
825 | var header = reply.header; |
|
820 | var header = reply.header; | |
826 | var content = reply.content; |
|
821 | var content = reply.content; | |
827 | var msg_type = header.msg_type; |
|
822 | var msg_type = header.msg_type; | |
828 | // console.log(reply); |
|
823 | // console.log(reply); | |
829 | var cell = this.cell_for_msg(reply.parent_header.msg_id); |
|
824 | var cell = this.cell_for_msg(reply.parent_header.msg_id); | |
830 | if (msg_type === "execute_reply") { |
|
825 | if (msg_type === "execute_reply") { | |
831 | cell.set_input_prompt(content.execution_count); |
|
826 | cell.set_input_prompt(content.execution_count); | |
832 | cell.element.removeClass("running"); |
|
827 | cell.element.removeClass("running"); | |
833 | this.dirty = true; |
|
828 | this.dirty = true; | |
834 | } else if (msg_type === "complete_reply") { |
|
829 | } else if (msg_type === "complete_reply") { | |
835 | cell.finish_completing(content.matched_text, content.matches); |
|
830 | cell.finish_completing(content.matched_text, content.matches); | |
836 | } else if (msg_type === "object_info_reply"){ |
|
831 | } else if (msg_type === "object_info_reply"){ | |
837 | //console.log('back from object_info_request : ') |
|
832 | //console.log('back from object_info_request : ') | |
838 | rep = reply.content; |
|
833 | rep = reply.content; | |
839 | if(rep.found) |
|
834 | if(rep.found) | |
840 | { |
|
835 | { | |
841 | cell.finish_tooltip(rep); |
|
836 | cell.finish_tooltip(rep); | |
842 | } |
|
837 | } | |
843 | } else { |
|
838 | } else { | |
844 | //console.log("unknown reply:"+msg_type); |
|
839 | //console.log("unknown reply:"+msg_type); | |
845 | } |
|
840 | } | |
846 | // when having a rely from object_info_reply, |
|
841 | // when having a rely from object_info_reply, | |
847 | // no payload so no nned to handle it |
|
842 | // no payload so no nned to handle it | |
848 | if(typeof(content.payload)!='undefined') { |
|
843 | if(typeof(content.payload)!='undefined') { | |
849 | var payload = content.payload || []; |
|
844 | var payload = content.payload || []; | |
850 | this.handle_payload(cell, payload); |
|
845 | this.handle_payload(cell, payload); | |
851 | } |
|
846 | } | |
852 | }; |
|
847 | }; | |
853 |
|
848 | |||
854 |
|
849 | |||
855 | Notebook.prototype.handle_payload = function (cell, payload) { |
|
850 | Notebook.prototype.handle_payload = function (cell, payload) { | |
856 | var l = payload.length; |
|
851 | var l = payload.length; | |
857 | for (var i=0; i<l; i++) { |
|
852 | for (var i=0; i<l; i++) { | |
858 | if (payload[i].source === 'IPython.zmq.page.page') { |
|
853 | if (payload[i].source === 'IPython.zmq.page.page') { | |
859 | if (payload[i].text.trim() !== '') { |
|
854 | if (payload[i].text.trim() !== '') { | |
860 | IPython.pager.clear(); |
|
855 | IPython.pager.clear(); | |
861 | IPython.pager.expand(); |
|
856 | IPython.pager.expand(); | |
862 | IPython.pager.append_text(payload[i].text); |
|
857 | IPython.pager.append_text(payload[i].text); | |
863 | } |
|
858 | } | |
864 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { |
|
859 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { | |
865 | var index = this.find_cell_index(cell); |
|
860 | var index = this.find_cell_index(cell); | |
866 | var new_cell = this.insert_cell_below('code',index); |
|
861 | var new_cell = this.insert_cell_below('code',index); | |
867 | new_cell.set_text(payload[i].text); |
|
862 | new_cell.set_text(payload[i].text); | |
868 | this.dirty = true; |
|
863 | this.dirty = true; | |
869 | } |
|
864 | } | |
870 | }; |
|
865 | }; | |
871 | }; |
|
866 | }; | |
872 |
|
867 | |||
873 |
|
868 | |||
874 | Notebook.prototype.handle_iopub_reply = function (e) { |
|
869 | Notebook.prototype.handle_iopub_reply = function (e) { | |
875 | reply = $.parseJSON(e.data); |
|
870 | reply = $.parseJSON(e.data); | |
876 | var content = reply.content; |
|
871 | var content = reply.content; | |
877 | // console.log(reply); |
|
872 | // console.log(reply); | |
878 | var msg_type = reply.header.msg_type; |
|
873 | var msg_type = reply.header.msg_type; | |
879 | var cell = this.cell_for_msg(reply.parent_header.msg_id); |
|
874 | var cell = this.cell_for_msg(reply.parent_header.msg_id); | |
880 | if (msg_type !== 'status' && !cell){ |
|
875 | if (msg_type !== 'status' && !cell){ | |
881 | // message not from this notebook, but should be attached to a cell |
|
876 | // message not from this notebook, but should be attached to a cell | |
882 | console.log("Received IOPub message not caused by one of my cells"); |
|
877 | console.log("Received IOPub message not caused by one of my cells"); | |
883 | console.log(reply); |
|
878 | console.log(reply); | |
884 | return; |
|
879 | return; | |
885 | } |
|
880 | } | |
886 | var output_types = ['stream','display_data','pyout','pyerr']; |
|
881 | var output_types = ['stream','display_data','pyout','pyerr']; | |
887 | if (output_types.indexOf(msg_type) >= 0) { |
|
882 | if (output_types.indexOf(msg_type) >= 0) { | |
888 | this.handle_output(cell, msg_type, content); |
|
883 | this.handle_output(cell, msg_type, content); | |
889 | } else if (msg_type === 'status') { |
|
884 | } else if (msg_type === 'status') { | |
890 | if (content.execution_state === 'busy') { |
|
885 | if (content.execution_state === 'busy') { | |
891 | IPython.kernel_status_widget.status_busy(); |
|
886 | IPython.kernel_status_widget.status_busy(); | |
892 | } else if (content.execution_state === 'idle') { |
|
887 | } else if (content.execution_state === 'idle') { | |
893 | IPython.kernel_status_widget.status_idle(); |
|
888 | IPython.kernel_status_widget.status_idle(); | |
894 | } else if (content.execution_state === 'dead') { |
|
889 | } else if (content.execution_state === 'dead') { | |
895 | this.handle_status_dead(); |
|
890 | this.handle_status_dead(); | |
896 | }; |
|
891 | }; | |
897 | } else if (msg_type === 'clear_output') { |
|
892 | } else if (msg_type === 'clear_output') { | |
898 | cell.clear_output(content.stdout, content.stderr, content.other); |
|
893 | cell.clear_output(content.stdout, content.stderr, content.other); | |
899 | }; |
|
894 | }; | |
900 | }; |
|
895 | }; | |
901 |
|
896 | |||
902 |
|
897 | |||
903 | Notebook.prototype.handle_status_dead = function () { |
|
898 | Notebook.prototype.handle_status_dead = function () { | |
904 | var that = this; |
|
899 | var that = this; | |
905 | this.kernel.stop_channels(); |
|
900 | this.kernel.stop_channels(); | |
906 | var dialog = $('<div/>'); |
|
901 | var dialog = $('<div/>'); | |
907 | dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.'); |
|
902 | dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.'); | |
908 | $(document).append(dialog); |
|
903 | $(document).append(dialog); | |
909 | dialog.dialog({ |
|
904 | dialog.dialog({ | |
910 | resizable: false, |
|
905 | resizable: false, | |
911 | modal: true, |
|
906 | modal: true, | |
912 | title: "Dead kernel", |
|
907 | title: "Dead kernel", | |
913 | buttons : { |
|
908 | buttons : { | |
914 | "Restart": function () { |
|
909 | "Restart": function () { | |
915 | that.start_kernel(); |
|
910 | that.start_kernel(); | |
916 | $(this).dialog('close'); |
|
911 | $(this).dialog('close'); | |
917 | }, |
|
912 | }, | |
918 | "Continue running": function () { |
|
913 | "Continue running": function () { | |
919 | $(this).dialog('close'); |
|
914 | $(this).dialog('close'); | |
920 | } |
|
915 | } | |
921 | } |
|
916 | } | |
922 | }); |
|
917 | }); | |
923 | }; |
|
918 | }; | |
924 |
|
919 | |||
925 |
|
920 | |||
926 | Notebook.prototype.handle_output = function (cell, msg_type, content) { |
|
921 | Notebook.prototype.handle_output = function (cell, msg_type, content) { | |
927 | var json = {}; |
|
922 | var json = {}; | |
928 | json.output_type = msg_type; |
|
923 | json.output_type = msg_type; | |
929 | if (msg_type === "stream") { |
|
924 | if (msg_type === "stream") { | |
930 | json.text = utils.fixConsole(content.data); |
|
925 | json.text = utils.fixConsole(content.data); | |
931 | json.stream = content.name; |
|
926 | json.stream = content.name; | |
932 | } else if (msg_type === "display_data") { |
|
927 | } else if (msg_type === "display_data") { | |
933 | json = this.convert_mime_types(json, content.data); |
|
928 | json = this.convert_mime_types(json, content.data); | |
934 | } else if (msg_type === "pyout") { |
|
929 | } else if (msg_type === "pyout") { | |
935 | json.prompt_number = content.execution_count; |
|
930 | json.prompt_number = content.execution_count; | |
936 | json = this.convert_mime_types(json, content.data); |
|
931 | json = this.convert_mime_types(json, content.data); | |
937 | } else if (msg_type === "pyerr") { |
|
932 | } else if (msg_type === "pyerr") { | |
938 | json.ename = content.ename; |
|
933 | json.ename = content.ename; | |
939 | json.evalue = content.evalue; |
|
934 | json.evalue = content.evalue; | |
940 | var traceback = []; |
|
935 | var traceback = []; | |
941 | for (var i=0; i<content.traceback.length; i++) { |
|
936 | for (var i=0; i<content.traceback.length; i++) { | |
942 | traceback.push(utils.fixConsole(content.traceback[i])); |
|
937 | traceback.push(utils.fixConsole(content.traceback[i])); | |
943 | } |
|
938 | } | |
944 | json.traceback = traceback; |
|
939 | json.traceback = traceback; | |
945 | }; |
|
940 | }; | |
946 | cell.append_output(json); |
|
941 | cell.append_output(json); | |
947 | this.dirty = true; |
|
942 | this.dirty = true; | |
948 | }; |
|
943 | }; | |
949 |
|
944 | |||
950 |
|
945 | |||
951 | Notebook.prototype.convert_mime_types = function (json, data) { |
|
946 | Notebook.prototype.convert_mime_types = function (json, data) { | |
952 | if (data['text/plain'] !== undefined) { |
|
947 | if (data['text/plain'] !== undefined) { | |
953 | json.text = utils.fixConsole(data['text/plain']); |
|
948 | json.text = utils.fixConsole(data['text/plain']); | |
954 | }; |
|
949 | }; | |
955 | if (data['text/html'] !== undefined) { |
|
950 | if (data['text/html'] !== undefined) { | |
956 | json.html = data['text/html']; |
|
951 | json.html = data['text/html']; | |
957 | }; |
|
952 | }; | |
958 | if (data['image/svg+xml'] !== undefined) { |
|
953 | if (data['image/svg+xml'] !== undefined) { | |
959 | json.svg = data['image/svg+xml']; |
|
954 | json.svg = data['image/svg+xml']; | |
960 | }; |
|
955 | }; | |
961 | if (data['image/png'] !== undefined) { |
|
956 | if (data['image/png'] !== undefined) { | |
962 | json.png = data['image/png']; |
|
957 | json.png = data['image/png']; | |
963 | }; |
|
958 | }; | |
964 | if (data['image/jpeg'] !== undefined) { |
|
959 | if (data['image/jpeg'] !== undefined) { | |
965 | json.jpeg = data['image/jpeg']; |
|
960 | json.jpeg = data['image/jpeg']; | |
966 | }; |
|
961 | }; | |
967 | if (data['text/latex'] !== undefined) { |
|
962 | if (data['text/latex'] !== undefined) { | |
968 | json.latex = data['text/latex']; |
|
963 | json.latex = data['text/latex']; | |
969 | }; |
|
964 | }; | |
970 | if (data['application/json'] !== undefined) { |
|
965 | if (data['application/json'] !== undefined) { | |
971 | json.json = data['application/json']; |
|
966 | json.json = data['application/json']; | |
972 | }; |
|
967 | }; | |
973 | if (data['application/javascript'] !== undefined) { |
|
968 | if (data['application/javascript'] !== undefined) { | |
974 | json.javascript = data['application/javascript']; |
|
969 | json.javascript = data['application/javascript']; | |
975 | } |
|
970 | } | |
976 | return json; |
|
971 | return json; | |
977 | }; |
|
972 | }; | |
978 |
|
973 | |||
979 |
|
974 | |||
980 | Notebook.prototype.execute_selected_cell = function (options) { |
|
975 | Notebook.prototype.execute_selected_cell = function (options) { | |
981 | // add_new: should a new cell be added if we are at the end of the nb |
|
976 | // add_new: should a new cell be added if we are at the end of the nb | |
982 | // terminal: execute in terminal mode, which stays in the current cell |
|
977 | // terminal: execute in terminal mode, which stays in the current cell | |
983 | default_options = {terminal: false, add_new: true}; |
|
978 | default_options = {terminal: false, add_new: true}; | |
984 | $.extend(default_options, options); |
|
979 | $.extend(default_options, options); | |
985 | var that = this; |
|
980 | var that = this; | |
986 | var cell = that.get_selected_cell(); |
|
981 | var cell = that.get_selected_cell(); | |
987 | var cell_index = that.find_cell_index(cell); |
|
982 | var cell_index = that.find_cell_index(cell); | |
988 | if (cell instanceof IPython.CodeCell) { |
|
983 | if (cell instanceof IPython.CodeCell) { | |
989 | cell.clear_output(true, true, true); |
|
984 | cell.clear_output(true, true, true); | |
990 | cell.set_input_prompt('*'); |
|
985 | cell.set_input_prompt('*'); | |
991 | cell.element.addClass("running"); |
|
986 | cell.element.addClass("running"); | |
992 | var code = cell.get_text(); |
|
987 | var code = cell.get_text(); | |
993 | var msg_id = that.kernel.execute(cell.get_text()); |
|
988 | var msg_id = that.kernel.execute(cell.get_text()); | |
994 | that.msg_cell_map[msg_id] = cell.cell_id; |
|
989 | that.msg_cell_map[msg_id] = cell.cell_id; | |
995 | } else if (cell instanceof IPython.HTMLCell) { |
|
990 | } else if (cell instanceof IPython.HTMLCell) { | |
996 | cell.render(); |
|
991 | cell.render(); | |
997 | } |
|
992 | } | |
998 | if (default_options.terminal) { |
|
993 | if (default_options.terminal) { | |
999 | cell.select_all(); |
|
994 | cell.select_all(); | |
1000 | } else { |
|
995 | } else { | |
1001 | if ((cell_index === (that.ncells()-1)) && default_options.add_new) { |
|
996 | if ((cell_index === (that.ncells()-1)) && default_options.add_new) { | |
1002 | that.insert_cell_below('code'); |
|
997 | that.insert_cell_below('code'); | |
1003 | // If we are adding a new cell at the end, scroll down to show it. |
|
998 | // If we are adding a new cell at the end, scroll down to show it. | |
1004 | that.scroll_to_bottom(); |
|
999 | that.scroll_to_bottom(); | |
1005 | } else { |
|
1000 | } else { | |
1006 | that.select(cell_index+1); |
|
1001 | that.select(cell_index+1); | |
1007 | }; |
|
1002 | }; | |
1008 | }; |
|
1003 | }; | |
1009 | this.dirty = true; |
|
1004 | this.dirty = true; | |
1010 | }; |
|
1005 | }; | |
1011 |
|
1006 | |||
1012 |
|
1007 | |||
1013 | Notebook.prototype.execute_all_cells = function () { |
|
1008 | Notebook.prototype.execute_all_cells = function () { | |
1014 | var ncells = this.ncells(); |
|
1009 | var ncells = this.ncells(); | |
1015 | for (var i=0; i<ncells; i++) { |
|
1010 | for (var i=0; i<ncells; i++) { | |
1016 | this.select(i); |
|
1011 | this.select(i); | |
1017 | this.execute_selected_cell({add_new:false}); |
|
1012 | this.execute_selected_cell({add_new:false}); | |
1018 | }; |
|
1013 | }; | |
1019 | this.scroll_to_bottom(); |
|
1014 | this.scroll_to_bottom(); | |
1020 | }; |
|
1015 | }; | |
1021 |
|
1016 | |||
1022 |
|
1017 | |||
1023 | Notebook.prototype.request_tool_tip = function (cell,func) { |
|
1018 | Notebook.prototype.request_tool_tip = function (cell,func) { | |
1024 | // Feel free to shorten this logic if you are better |
|
1019 | // Feel free to shorten this logic if you are better | |
1025 | // than me in regEx |
|
1020 | // than me in regEx | |
1026 | // basicaly you shoul be able to get xxx.xxx.xxx from |
|
1021 | // basicaly you shoul be able to get xxx.xxx.xxx from | |
1027 | // something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2, |
|
1022 | // something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2, | |
1028 | // remove everything between matchin bracket (need to iterate) |
|
1023 | // remove everything between matchin bracket (need to iterate) | |
1029 | matchBracket = /\([^\(\)]+\)/g; |
|
1024 | matchBracket = /\([^\(\)]+\)/g; | |
1030 | oldfunc = func; |
|
1025 | oldfunc = func; | |
1031 | func = func.replace(matchBracket,""); |
|
1026 | func = func.replace(matchBracket,""); | |
1032 | while( oldfunc != func ) |
|
1027 | while( oldfunc != func ) | |
1033 | { |
|
1028 | { | |
1034 | oldfunc = func; |
|
1029 | oldfunc = func; | |
1035 | func = func.replace(matchBracket,""); |
|
1030 | func = func.replace(matchBracket,""); | |
1036 | } |
|
1031 | } | |
1037 | // remove everythin after last open bracket |
|
1032 | // remove everythin after last open bracket | |
1038 | endBracket = /\([^\(]*$/g; |
|
1033 | endBracket = /\([^\(]*$/g; | |
1039 | func = func.replace(endBracket,""); |
|
1034 | func = func.replace(endBracket,""); | |
1040 | var re = /[a-zA-Z._]+$/g; |
|
1035 | var re = /[a-zA-Z._]+$/g; | |
1041 | var msg_id = this.kernel.object_info_request(re.exec(func)); |
|
1036 | var msg_id = this.kernel.object_info_request(re.exec(func)); | |
1042 | if(typeof(msg_id)!='undefined'){ |
|
1037 | if(typeof(msg_id)!='undefined'){ | |
1043 | this.msg_cell_map[msg_id] = cell.cell_id; |
|
1038 | this.msg_cell_map[msg_id] = cell.cell_id; | |
1044 | } |
|
1039 | } | |
1045 | }; |
|
1040 | }; | |
1046 |
|
1041 | |||
1047 | Notebook.prototype.complete_cell = function (cell, line, cursor_pos) { |
|
1042 | Notebook.prototype.complete_cell = function (cell, line, cursor_pos) { | |
1048 | var msg_id = this.kernel.complete(line, cursor_pos); |
|
1043 | var msg_id = this.kernel.complete(line, cursor_pos); | |
1049 | this.msg_cell_map[msg_id] = cell.cell_id; |
|
1044 | this.msg_cell_map[msg_id] = cell.cell_id; | |
1050 | }; |
|
1045 | }; | |
1051 |
|
1046 | |||
1052 | // Persistance and loading |
|
1047 | // Persistance and loading | |
1053 |
|
1048 | |||
1054 |
|
1049 | |||
1055 | Notebook.prototype.fromJSON = function (data) { |
|
1050 | Notebook.prototype.fromJSON = function (data) { | |
1056 | var ncells = this.ncells(); |
|
1051 | var ncells = this.ncells(); | |
1057 | var i; |
|
1052 | var i; | |
1058 | for (i=0; i<ncells; i++) { |
|
1053 | for (i=0; i<ncells; i++) { | |
1059 | // Always delete cell 0 as they get renumbered as they are deleted. |
|
1054 | // Always delete cell 0 as they get renumbered as they are deleted. | |
1060 | this.delete_cell(0); |
|
1055 | this.delete_cell(0); | |
1061 | }; |
|
1056 | }; | |
1062 | // Save the metadata |
|
1057 | // Save the metadata | |
1063 | this.metadata = data.metadata; |
|
1058 | this.metadata = data.metadata; | |
1064 | // Only handle 1 worksheet for now. |
|
1059 | // Only handle 1 worksheet for now. | |
1065 | var worksheet = data.worksheets[0]; |
|
1060 | var worksheet = data.worksheets[0]; | |
1066 | if (worksheet !== undefined) { |
|
1061 | if (worksheet !== undefined) { | |
1067 | var new_cells = worksheet.cells; |
|
1062 | var new_cells = worksheet.cells; | |
1068 | ncells = new_cells.length; |
|
1063 | ncells = new_cells.length; | |
1069 | var cell_data = null; |
|
1064 | var cell_data = null; | |
1070 | var new_cell = null; |
|
1065 | var new_cell = null; | |
1071 | for (i=0; i<ncells; i++) { |
|
1066 | for (i=0; i<ncells; i++) { | |
1072 | cell_data = new_cells[i]; |
|
1067 | cell_data = new_cells[i]; | |
1073 | new_cell = this.insert_cell_below(cell_data.cell_type); |
|
1068 | new_cell = this.insert_cell_below(cell_data.cell_type); | |
1074 | new_cell.fromJSON(cell_data); |
|
1069 | new_cell.fromJSON(cell_data); | |
1075 | }; |
|
1070 | }; | |
1076 | }; |
|
1071 | }; | |
1077 | }; |
|
1072 | }; | |
1078 |
|
1073 | |||
1079 |
|
1074 | |||
1080 | Notebook.prototype.toJSON = function () { |
|
1075 | Notebook.prototype.toJSON = function () { | |
1081 | var cells = this.get_cells(); |
|
1076 | var cells = this.get_cells(); | |
1082 | var ncells = cells.length; |
|
1077 | var ncells = cells.length; | |
1083 | cell_array = new Array(ncells); |
|
1078 | cell_array = new Array(ncells); | |
1084 | for (var i=0; i<ncells; i++) { |
|
1079 | for (var i=0; i<ncells; i++) { | |
1085 | cell_array[i] = cells[i].toJSON(); |
|
1080 | cell_array[i] = cells[i].toJSON(); | |
1086 | }; |
|
1081 | }; | |
1087 | data = { |
|
1082 | data = { | |
1088 | // Only handle 1 worksheet for now. |
|
1083 | // Only handle 1 worksheet for now. | |
1089 | worksheets : [{cells:cell_array}], |
|
1084 | worksheets : [{cells:cell_array}], | |
1090 | metadata : this.metadata |
|
1085 | metadata : this.metadata | |
1091 | }; |
|
1086 | }; | |
1092 | return data; |
|
1087 | return data; | |
1093 | }; |
|
1088 | }; | |
1094 |
|
1089 | |||
1095 | Notebook.prototype.save_notebook = function () { |
|
1090 | Notebook.prototype.save_notebook = function () { | |
1096 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
1091 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
1097 | var nbname = IPython.save_widget.get_notebook_name(); |
|
1092 | var nbname = IPython.save_widget.get_notebook_name(); | |
1098 | // We may want to move the name/id/nbformat logic inside toJSON? |
|
1093 | // We may want to move the name/id/nbformat logic inside toJSON? | |
1099 | var data = this.toJSON(); |
|
1094 | var data = this.toJSON(); | |
1100 | data.metadata.name = nbname; |
|
1095 | data.metadata.name = nbname; | |
1101 | data.nbformat = 2; |
|
1096 | data.nbformat = 2; | |
1102 | // We do the call with settings so we can set cache to false. |
|
1097 | // We do the call with settings so we can set cache to false. | |
1103 | var settings = { |
|
1098 | var settings = { | |
1104 | processData : false, |
|
1099 | processData : false, | |
1105 | cache : false, |
|
1100 | cache : false, | |
1106 | type : "PUT", |
|
1101 | type : "PUT", | |
1107 | data : JSON.stringify(data), |
|
1102 | data : JSON.stringify(data), | |
1108 | headers : {'Content-Type': 'application/json'}, |
|
1103 | headers : {'Content-Type': 'application/json'}, | |
1109 | success : $.proxy(this.notebook_saved,this), |
|
1104 | success : $.proxy(this.notebook_saved,this), | |
1110 | error : $.proxy(this.notebook_save_failed,this) |
|
1105 | error : $.proxy(this.notebook_save_failed,this) | |
1111 | }; |
|
1106 | }; | |
1112 | IPython.save_widget.status_saving(); |
|
1107 | IPython.save_widget.status_saving(); | |
1113 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id; |
|
1108 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id; | |
1114 | $.ajax(url, settings); |
|
1109 | $.ajax(url, settings); | |
1115 | }; |
|
1110 | }; | |
1116 |
|
1111 | |||
1117 |
|
1112 | |||
1118 | Notebook.prototype.notebook_saved = function (data, status, xhr) { |
|
1113 | Notebook.prototype.notebook_saved = function (data, status, xhr) { | |
1119 | this.dirty = false; |
|
1114 | this.dirty = false; | |
1120 | IPython.save_widget.notebook_saved(); |
|
1115 | IPython.save_widget.notebook_saved(); | |
1121 | IPython.save_widget.status_last_saved(); |
|
1116 | IPython.save_widget.status_last_saved(); | |
1122 | }; |
|
1117 | }; | |
1123 |
|
1118 | |||
1124 |
|
1119 | |||
1125 | Notebook.prototype.notebook_save_failed = function (xhr, status, error_msg) { |
|
1120 | Notebook.prototype.notebook_save_failed = function (xhr, status, error_msg) { | |
1126 | IPython.save_widget.status_save_failed(); |
|
1121 | IPython.save_widget.status_save_failed(); | |
1127 | }; |
|
1122 | }; | |
1128 |
|
1123 | |||
1129 |
|
1124 | |||
1130 | Notebook.prototype.load_notebook = function () { |
|
1125 | Notebook.prototype.load_notebook = function () { | |
1131 | var that = this; |
|
1126 | var that = this; | |
1132 | var notebook_id = IPython.save_widget.get_notebook_id(); |
|
1127 | var notebook_id = IPython.save_widget.get_notebook_id(); | |
1133 | // We do the call with settings so we can set cache to false. |
|
1128 | // We do the call with settings so we can set cache to false. | |
1134 | var settings = { |
|
1129 | var settings = { | |
1135 | processData : false, |
|
1130 | processData : false, | |
1136 | cache : false, |
|
1131 | cache : false, | |
1137 | type : "GET", |
|
1132 | type : "GET", | |
1138 | dataType : "json", |
|
1133 | dataType : "json", | |
1139 | success : function (data, status, xhr) { |
|
1134 | success : function (data, status, xhr) { | |
1140 | that.notebook_loaded(data, status, xhr); |
|
1135 | that.notebook_loaded(data, status, xhr); | |
1141 | } |
|
1136 | } | |
1142 | }; |
|
1137 | }; | |
1143 | IPython.save_widget.status_loading(); |
|
1138 | IPython.save_widget.status_loading(); | |
1144 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id; |
|
1139 | var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id; | |
1145 | $.ajax(url, settings); |
|
1140 | $.ajax(url, settings); | |
1146 | }; |
|
1141 | }; | |
1147 |
|
1142 | |||
1148 |
|
1143 | |||
1149 | Notebook.prototype.notebook_loaded = function (data, status, xhr) { |
|
1144 | Notebook.prototype.notebook_loaded = function (data, status, xhr) { | |
1150 | this.fromJSON(data); |
|
1145 | this.fromJSON(data); | |
1151 | if (this.ncells() === 0) { |
|
1146 | if (this.ncells() === 0) { | |
1152 | this.insert_cell_below('code'); |
|
1147 | this.insert_cell_below('code'); | |
1153 | }; |
|
1148 | }; | |
1154 | IPython.save_widget.status_last_saved(); |
|
1149 | IPython.save_widget.status_last_saved(); | |
1155 | IPython.save_widget.set_notebook_name(data.metadata.name); |
|
1150 | IPython.save_widget.set_notebook_name(data.metadata.name); | |
1156 | this.dirty = false; |
|
1151 | this.dirty = false; | |
1157 | if (! this.read_only) { |
|
1152 | if (! this.read_only) { | |
1158 | this.start_kernel(); |
|
1153 | this.start_kernel(); | |
1159 | } |
|
1154 | } | |
1160 | this.select(0); |
|
1155 | this.select(0); | |
1161 | this.scroll_to_top(); |
|
1156 | this.scroll_to_top(); | |
1162 | IPython.save_widget.update_url(); |
|
1157 | IPython.save_widget.update_url(); | |
1163 | IPython.layout_manager.do_resize(); |
|
1158 | IPython.layout_manager.do_resize(); | |
1164 | }; |
|
1159 | }; | |
1165 |
|
1160 | |||
1166 | IPython.Notebook = Notebook; |
|
1161 | IPython.Notebook = Notebook; | |
1167 |
|
1162 | |||
1168 |
|
1163 | |||
1169 | return IPython; |
|
1164 | return IPython; | |
1170 |
|
1165 | |||
1171 | }(IPython)); |
|
1166 | }(IPython)); | |
1172 |
|
1167 |
@@ -1,116 +1,115 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // On document ready |
|
9 | // On document ready | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 |
|
12 | |||
13 | $(document).ready(function () { |
|
13 | $(document).ready(function () { | |
14 | if (window.MathJax){ |
|
14 | if (window.MathJax){ | |
15 | // MathJax loaded |
|
15 | // MathJax loaded | |
16 | MathJax.Hub.Config({ |
|
16 | MathJax.Hub.Config({ | |
17 | tex2jax: { |
|
17 | tex2jax: { | |
18 | inlineMath: [ ['$','$'], ["\\(","\\)"] ], |
|
18 | inlineMath: [ ['$','$'], ["\\(","\\)"] ], | |
19 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ] |
|
19 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ] | |
20 | }, |
|
20 | }, | |
21 | displayAlign: 'left', // Change this to 'center' to center equations. |
|
21 | displayAlign: 'left', // Change this to 'center' to center equations. | |
22 | "HTML-CSS": { |
|
22 | "HTML-CSS": { | |
23 | styles: {'.MathJax_Display': {"margin": 0}} |
|
23 | styles: {'.MathJax_Display': {"margin": 0}} | |
24 | } |
|
24 | } | |
25 | }); |
|
25 | }); | |
26 | }else if (window.mathjax_url != ""){ |
|
26 | }else if (window.mathjax_url != ""){ | |
27 | // Don't have MathJax, but should. Show dialog. |
|
27 | // Don't have MathJax, but should. Show dialog. | |
28 | var dialog = $('<div></div>') |
|
28 | var dialog = $('<div></div>') | |
29 | .append( |
|
29 | .append( | |
30 | $("<p></p>").addClass('dialog').html( |
|
30 | $("<p></p>").addClass('dialog').html( | |
31 | "Math/LaTeX rendering will be disabled." |
|
31 | "Math/LaTeX rendering will be disabled." | |
32 | ) |
|
32 | ) | |
33 | ).append( |
|
33 | ).append( | |
34 | $("<p></p>").addClass('dialog').html( |
|
34 | $("<p></p>").addClass('dialog').html( | |
35 | "If you have administrative access to the notebook server and" + |
|
35 | "If you have administrative access to the notebook server and" + | |
36 | " a working internet connection, you can install a local copy" + |
|
36 | " a working internet connection, you can install a local copy" + | |
37 | " of MathJax for offline use with the following command on the server" + |
|
37 | " of MathJax for offline use with the following command on the server" + | |
38 | " at a Python or IPython prompt:" |
|
38 | " at a Python or IPython prompt:" | |
39 | ) |
|
39 | ) | |
40 | ).append( |
|
40 | ).append( | |
41 | $("<pre></pre>").addClass('dialog').html( |
|
41 | $("<pre></pre>").addClass('dialog').html( | |
42 | ">>> from IPython.external import mathjax; mathjax.install_mathjax()" |
|
42 | ">>> from IPython.external import mathjax; mathjax.install_mathjax()" | |
43 | ) |
|
43 | ) | |
44 | ).append( |
|
44 | ).append( | |
45 | $("<p></p>").addClass('dialog').html( |
|
45 | $("<p></p>").addClass('dialog').html( | |
46 | "This will try to install MathJax into the IPython source directory." |
|
46 | "This will try to install MathJax into the IPython source directory." | |
47 | ) |
|
47 | ) | |
48 | ).append( |
|
48 | ).append( | |
49 | $("<p></p>").addClass('dialog').html( |
|
49 | $("<p></p>").addClass('dialog').html( | |
50 | "If IPython is installed to a location that requires" + |
|
50 | "If IPython is installed to a location that requires" + | |
51 | " administrative privileges to write, you will need to make this call as" + |
|
51 | " administrative privileges to write, you will need to make this call as" + | |
52 | " an administrator, via 'sudo'." |
|
52 | " an administrator, via 'sudo'." | |
53 | ) |
|
53 | ) | |
54 | ).append( |
|
54 | ).append( | |
55 | $("<p></p>").addClass('dialog').html( |
|
55 | $("<p></p>").addClass('dialog').html( | |
56 | "When you start the notebook server, you can instruct it to disable MathJax support altogether:" |
|
56 | "When you start the notebook server, you can instruct it to disable MathJax support altogether:" | |
57 | ) |
|
57 | ) | |
58 | ).append( |
|
58 | ).append( | |
59 | $("<pre></pre>").addClass('dialog').html( |
|
59 | $("<pre></pre>").addClass('dialog').html( | |
60 | "$ ipython notebook --no-mathjax" |
|
60 | "$ ipython notebook --no-mathjax" | |
61 | ) |
|
61 | ) | |
62 | ).append( |
|
62 | ).append( | |
63 | $("<p></p>").addClass('dialog').html( |
|
63 | $("<p></p>").addClass('dialog').html( | |
64 | "which will prevent this dialog from appearing." |
|
64 | "which will prevent this dialog from appearing." | |
65 | ) |
|
65 | ) | |
66 | ).dialog({ |
|
66 | ).dialog({ | |
67 | title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'", |
|
67 | title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'", | |
68 | width: "70%", |
|
68 | width: "70%", | |
69 | modal: true, |
|
69 | modal: true, | |
70 | }) |
|
70 | }) | |
71 | }else{ |
|
71 | }else{ | |
72 | // No MathJax, but none expected. No dialog. |
|
72 | // No MathJax, but none expected. No dialog. | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 |
|
75 | |||
76 | IPython.markdown_converter = new Markdown.Converter(); |
|
76 | IPython.markdown_converter = new Markdown.Converter(); | |
77 | IPython.read_only = $('meta[name=read_only]').attr("content") == 'True'; |
|
77 | IPython.read_only = $('meta[name=read_only]').attr("content") == 'True'; | |
78 |
|
78 | |||
79 | $('div#header').addClass('border-box-sizing'); |
|
79 | $('div#header').addClass('border-box-sizing'); | |
80 | $('div#main_app').addClass('border-box-sizing ui-widget ui-widget-content'); |
|
80 | $('div#main_app').addClass('border-box-sizing ui-widget ui-widget-content'); | |
81 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); |
|
81 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); | |
82 |
|
82 | |||
83 | IPython.layout_manager = new IPython.LayoutManager(); |
|
83 | IPython.layout_manager = new IPython.LayoutManager(); | |
84 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
84 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
85 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
85 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
86 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); |
|
86 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); | |
87 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); |
|
87 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); | |
88 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
88 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
89 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); |
|
89 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); | |
90 | IPython.menubar = new IPython.MenuBar('#menubar') |
|
90 | IPython.menubar = new IPython.MenuBar('#menubar') | |
91 | IPython.kernel_status_widget.status_idle(); |
|
91 | IPython.kernel_status_widget.status_idle(); | |
92 | IPython.fulledit_widget = new IPython.FullEditWidget('#fulledit_widget'); |
|
|||
93 |
|
92 | |||
94 | IPython.layout_manager.do_resize(); |
|
93 | IPython.layout_manager.do_resize(); | |
95 |
|
94 | |||
96 | // These have display: none in the css file and are made visible here to prevent FLOUC. |
|
95 | // These have display: none in the css file and are made visible here to prevent FLOUC. | |
97 | $('div#header').css('display','block'); |
|
96 | $('div#header').css('display','block'); | |
98 |
|
97 | |||
99 | if(IPython.read_only){ |
|
98 | if(IPython.read_only){ | |
100 | // hide various elements from read-only view |
|
99 | // hide various elements from read-only view | |
101 | $('div#pager').remove(); |
|
100 | $('div#pager').remove(); | |
102 | $('div#pager_splitter').remove(); |
|
101 | $('div#pager_splitter').remove(); | |
103 | $('span#login_widget').removeClass('hidden'); |
|
102 | $('span#login_widget').removeClass('hidden'); | |
104 |
|
103 | |||
105 | // set the notebook name field as not modifiable |
|
104 | // set the notebook name field as not modifiable | |
106 | $('#notebook_name').attr('disabled','disabled') |
|
105 | $('#notebook_name').attr('disabled','disabled') | |
107 | } |
|
106 | } | |
108 |
|
107 | |||
109 | $('div#menubar').css('display','block'); |
|
108 | $('div#menubar').css('display','block'); | |
110 | $('div#main_app').css('display','block'); |
|
109 | $('div#main_app').css('display','block'); | |
111 |
|
110 | |||
112 | IPython.layout_manager.do_resize(); |
|
111 | IPython.layout_manager.do_resize(); | |
113 | IPython.notebook.load_notebook(); |
|
112 | IPython.notebook.load_notebook(); | |
114 |
|
113 | |||
115 | }); |
|
114 | }); | |
116 |
|
115 |
@@ -1,69 +1,68 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // QuickHelp button |
|
9 | // QuickHelp button | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | |||
14 | var QuickHelp = function (selector) { |
|
14 | var QuickHelp = function (selector) { | |
15 | }; |
|
15 | }; | |
16 |
|
16 | |||
17 | QuickHelp.prototype.show_keyboard_shortcuts = function () { |
|
17 | QuickHelp.prototype.show_keyboard_shortcuts = function () { | |
18 | // toggles display of keyboard shortcut dialog |
|
18 | // toggles display of keyboard shortcut dialog | |
19 | var that = this; |
|
19 | var that = this; | |
20 | if ( this.shortcut_dialog ){ |
|
20 | if ( this.shortcut_dialog ){ | |
21 | // if dialog is already shown, close it |
|
21 | // if dialog is already shown, close it | |
22 | this.shortcut_dialog.dialog("close"); |
|
22 | this.shortcut_dialog.dialog("close"); | |
23 | this.shortcut_dialog = null; |
|
23 | this.shortcut_dialog = null; | |
24 | return; |
|
24 | return; | |
25 | } |
|
25 | } | |
26 | var dialog = $('<div/>'); |
|
26 | var dialog = $('<div/>'); | |
27 | this.shortcut_dialog = dialog; |
|
27 | this.shortcut_dialog = dialog; | |
28 | var shortcuts = [ |
|
28 | var shortcuts = [ | |
29 | {key: 'Shift-Enter', help: 'run cell'}, |
|
29 | {key: 'Shift-Enter', help: 'run cell'}, | |
30 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, |
|
30 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, | |
31 | {key: 'Ctrl-m x', help: 'cut cell'}, |
|
31 | {key: 'Ctrl-m x', help: 'cut cell'}, | |
32 | {key: 'Ctrl-m c', help: 'copy cell'}, |
|
32 | {key: 'Ctrl-m c', help: 'copy cell'}, | |
33 | {key: 'Ctrl-m v', help: 'paste cell'}, |
|
33 | {key: 'Ctrl-m v', help: 'paste cell'}, | |
34 | {key: 'Ctrl-m d', help: 'delete cell'}, |
|
34 | {key: 'Ctrl-m d', help: 'delete cell'}, | |
35 | {key: 'Ctrl-m e', help: 'toggle edit cell in Ace'}, |
|
|||
36 | {key: 'Ctrl-m a', help: 'insert cell above'}, |
|
35 | {key: 'Ctrl-m a', help: 'insert cell above'}, | |
37 | {key: 'Ctrl-m b', help: 'insert cell below'}, |
|
36 | {key: 'Ctrl-m b', help: 'insert cell below'}, | |
38 | {key: 'Ctrl-m t', help: 'toggle output'}, |
|
37 | {key: 'Ctrl-m t', help: 'toggle output'}, | |
39 | {key: 'Ctrl-m l', help: 'toggle line numbers'}, |
|
38 | {key: 'Ctrl-m l', help: 'toggle line numbers'}, | |
40 | {key: 'Ctrl-m s', help: 'save notebook'}, |
|
39 | {key: 'Ctrl-m s', help: 'save notebook'}, | |
41 | {key: 'Ctrl-m j', help: 'move cell down'}, |
|
40 | {key: 'Ctrl-m j', help: 'move cell down'}, | |
42 | {key: 'Ctrl-m k', help: 'move cell up'}, |
|
41 | {key: 'Ctrl-m k', help: 'move cell up'}, | |
43 | {key: 'Ctrl-m y', help: 'code cell'}, |
|
42 | {key: 'Ctrl-m y', help: 'code cell'}, | |
44 | {key: 'Ctrl-m m', help: 'markdown cell'}, |
|
43 | {key: 'Ctrl-m m', help: 'markdown cell'}, | |
45 | {key: 'Ctrl-m p', help: 'select previous'}, |
|
44 | {key: 'Ctrl-m p', help: 'select previous'}, | |
46 | {key: 'Ctrl-m n', help: 'select next'}, |
|
45 | {key: 'Ctrl-m n', help: 'select next'}, | |
47 | {key: 'Ctrl-m i', help: 'interrupt kernel'}, |
|
46 | {key: 'Ctrl-m i', help: 'interrupt kernel'}, | |
48 | {key: 'Ctrl-m .', help: 'restart kernel'}, |
|
47 | {key: 'Ctrl-m .', help: 'restart kernel'}, | |
49 | {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} |
|
48 | {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} | |
50 | ]; |
|
49 | ]; | |
51 | for (var i=0; i<shortcuts.length; i++) { |
|
50 | for (var i=0; i<shortcuts.length; i++) { | |
52 | dialog.append($('<div>'). |
|
51 | dialog.append($('<div>'). | |
53 | append($('<span/>').addClass('shortcut_key').html(shortcuts[i].key)). |
|
52 | append($('<span/>').addClass('shortcut_key').html(shortcuts[i].key)). | |
54 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) |
|
53 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) | |
55 | ); |
|
54 | ); | |
56 | }; |
|
55 | }; | |
57 | dialog.bind('dialogclose', function(event) { |
|
56 | dialog.bind('dialogclose', function(event) { | |
58 | // dialog has been closed, allow it to be drawn again. |
|
57 | // dialog has been closed, allow it to be drawn again. | |
59 | that.shortcut_dialog = null; |
|
58 | that.shortcut_dialog = null; | |
60 | }); |
|
59 | }); | |
61 | dialog.dialog({title: 'Keyboard shortcuts', closeText: ''}); |
|
60 | dialog.dialog({title: 'Keyboard shortcuts', closeText: ''}); | |
62 | }; |
|
61 | }; | |
63 |
|
62 | |||
64 | // Set module variables |
|
63 | // Set module variables | |
65 | IPython.QuickHelp = QuickHelp; |
|
64 | IPython.QuickHelp = QuickHelp; | |
66 |
|
65 | |||
67 | return IPython; |
|
66 | return IPython; | |
68 |
|
67 | |||
69 | }(IPython)); |
|
68 | }(IPython)); |
@@ -1,207 +1,189 | |||||
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 | {% if mathjax_url %} |
|
9 | {% if mathjax_url %} | |
10 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> |
|
10 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> | |
11 | {% end %} |
|
11 | {% end %} | |
12 | <script type="text/javascript"> |
|
12 | <script type="text/javascript"> | |
13 | // MathJax disabled, set as null to distingish from *missing* MathJax, |
|
13 | // MathJax disabled, set as null to distingish from *missing* MathJax, | |
14 | // where it will be undefined, and should prompt a dialog later. |
|
14 | // where it will be undefined, and should prompt a dialog later. | |
15 | window.mathjax_url = "{{mathjax_url}}"; |
|
15 | window.mathjax_url = "{{mathjax_url}}"; | |
16 | </script> |
|
16 | </script> | |
17 |
|
17 | |||
18 | <link rel="stylesheet" href="/static/jquery/css/themes/base/jquery-ui.min.css" type="text/css" /> |
|
18 | <link rel="stylesheet" href="/static/jquery/css/themes/base/jquery-ui.min.css" type="text/css" /> | |
19 | <link rel="stylesheet" href="/static/codemirror/lib/codemirror.css"> |
|
19 | <link rel="stylesheet" href="/static/codemirror/lib/codemirror.css"> | |
20 | <link rel="stylesheet" href="/static/codemirror/theme/ipython.css"> |
|
20 | <link rel="stylesheet" href="/static/codemirror/theme/ipython.css"> | |
21 |
|
21 | |||
22 | <link rel="stylesheet" href="/static/prettify/prettify.css"/> |
|
22 | <link rel="stylesheet" href="/static/prettify/prettify.css"/> | |
23 |
|
23 | |||
24 | <link rel="stylesheet" href="/static/css/boilerplate.css" type="text/css" /> |
|
24 | <link rel="stylesheet" href="/static/css/boilerplate.css" type="text/css" /> | |
25 | <link rel="stylesheet" href="/static/css/layout.css" type="text/css" /> |
|
25 | <link rel="stylesheet" href="/static/css/layout.css" type="text/css" /> | |
26 | <link rel="stylesheet" href="/static/css/base.css" type="text/css" /> |
|
26 | <link rel="stylesheet" href="/static/css/base.css" type="text/css" /> | |
27 | <link rel="stylesheet" href="/static/css/notebook.css" type="text/css" /> |
|
27 | <link rel="stylesheet" href="/static/css/notebook.css" type="text/css" /> | |
28 | <link rel="stylesheet" href="/static/css/renderedhtml.css" type="text/css" /> |
|
28 | <link rel="stylesheet" href="/static/css/renderedhtml.css" type="text/css" /> | |
29 |
|
29 | |||
30 | {% comment In the notebook, the read-only flag is used to determine %} |
|
30 | {% comment In the notebook, the read-only flag is used to determine %} | |
31 | {% comment whether to hide the side panels and switch off input %} |
|
31 | {% comment whether to hide the side panels and switch off input %} | |
32 | <meta name="read_only" content="{{read_only and not logged_in}}"/> |
|
32 | <meta name="read_only" content="{{read_only and not logged_in}}"/> | |
33 |
|
33 | |||
34 | </head> |
|
34 | </head> | |
35 |
|
35 | |||
36 | <body |
|
36 | <body | |
37 | data-project={{project}} data-notebook-id={{notebook_id}} |
|
37 | data-project={{project}} data-notebook-id={{notebook_id}} | |
38 | data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}} |
|
38 | data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}} | |
39 | > |
|
39 | > | |
40 |
|
40 | |||
41 | <div id="header"> |
|
41 | <div id="header"> | |
42 | <span id="ipython_notebook"><h1><a href='..' alt='dashboard'><img src='/static/ipynblogo.png' alt='IPython Notebook'/></a></h1></span> |
|
42 | <span id="ipython_notebook"><h1><a href='..' alt='dashboard'><img src='/static/ipynblogo.png' alt='IPython Notebook'/></a></h1></span> | |
43 | <span id="save_widget"> |
|
43 | <span id="save_widget"> | |
44 | <span id="notebook_name"></span> |
|
44 | <span id="notebook_name"></span> | |
45 | <span id="save_status"></span> |
|
45 | <span id="save_status"></span> | |
46 | </span> |
|
46 | </span> | |
47 |
|
47 | |||
48 | <span id="login_widget"> |
|
48 | <span id="login_widget"> | |
49 | {% comment This is a temporary workaround to hide the logout button %} |
|
49 | {% comment This is a temporary workaround to hide the logout button %} | |
50 | {% comment when appropriate until notebook.html is templated %} |
|
50 | {% comment when appropriate until notebook.html is templated %} | |
51 | {% if logged_in %} |
|
51 | {% if logged_in %} | |
52 | <button id="logout">Logout</button> |
|
52 | <button id="logout">Logout</button> | |
53 | {% elif not logged_in and login_available %} |
|
53 | {% elif not logged_in and login_available %} | |
54 | <button id="login">Login</button> |
|
54 | <button id="login">Login</button> | |
55 | {% end %} |
|
55 | {% end %} | |
56 | </span> |
|
56 | </span> | |
57 |
|
57 | |||
58 | <span id="kernel_status">Idle</span> |
|
58 | <span id="kernel_status">Idle</span> | |
59 | </div> |
|
59 | </div> | |
60 |
|
60 | |||
61 | <div id="menubar"> |
|
61 | <div id="menubar"> | |
62 | <ul id="menus"> |
|
62 | <ul id="menus"> | |
63 | <li><a href="#">File</a> |
|
63 | <li><a href="#">File</a> | |
64 | <ul> |
|
64 | <ul> | |
65 | <li id="new_notebook"><a href="#">New</a></li> |
|
65 | <li id="new_notebook"><a href="#">New</a></li> | |
66 | <li id="open_notebook"><a href="#">Open...</a></li> |
|
66 | <li id="open_notebook"><a href="#">Open...</a></li> | |
67 | <hr/> |
|
67 | <hr/> | |
68 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> |
|
68 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> | |
69 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
69 | <li id="rename_notebook"><a href="#">Rename...</a></li> | |
70 | <li id="save_notebook"><a href="#">Save</a></li> |
|
70 | <li id="save_notebook"><a href="#">Save</a></li> | |
71 | <hr/> |
|
71 | <hr/> | |
72 | <li><a href="#">Download as</a> |
|
72 | <li><a href="#">Download as</a> | |
73 | <ul> |
|
73 | <ul> | |
74 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
|
74 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> | |
75 | <li id="download_py"><a href="#">Python (.py)</a></li> |
|
75 | <li id="download_py"><a href="#">Python (.py)</a></li> | |
76 | </ul> |
|
76 | </ul> | |
77 | </li> |
|
77 | </li> | |
78 | <hr/> |
|
78 | <hr/> | |
79 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> |
|
79 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> | |
80 | </ul> |
|
80 | </ul> | |
81 | </li> |
|
81 | </li> | |
82 | <li><a href="#">Edit</a> |
|
82 | <li><a href="#">Edit</a> | |
83 | <ul> |
|
83 | <ul> | |
84 | <li id="cut_cell"><a href="#">Cut</a></li> |
|
84 | <li id="cut_cell"><a href="#">Cut</a></li> | |
85 | <li id="copy_cell"><a href="#">Copy</a></li> |
|
85 | <li id="copy_cell"><a href="#">Copy</a></li> | |
86 | <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste</a></li> |
|
86 | <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste</a></li> | |
87 | <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Above</a></li> |
|
87 | <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Above</a></li> | |
88 | <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Below</a></li> |
|
88 | <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Below</a></li> | |
89 | <li id="delete_cell"><a href="#">Delete</a></li> |
|
89 | <li id="delete_cell"><a href="#">Delete</a></li> | |
90 | <hr/> |
|
90 | <hr/> | |
91 | <li id="split_cell"><a href="#">Split</a></li> |
|
91 | <li id="split_cell"><a href="#">Split</a></li> | |
92 | <li id="merge_cell_above"><a href="#">Merge Above</a></li> |
|
92 | <li id="merge_cell_above"><a href="#">Merge Above</a></li> | |
93 | <li id="merge_cell_below"><a href="#">Merge Below</a></li> |
|
93 | <li id="merge_cell_below"><a href="#">Merge Below</a></li> | |
94 | <hr/> |
|
94 | <hr/> | |
95 | <li id="move_cell_up"><a href="#">Move Up</a></li> |
|
95 | <li id="move_cell_up"><a href="#">Move Up</a></li> | |
96 | <li id="move_cell_down"><a href="#">Move Down</a></li> |
|
96 | <li id="move_cell_down"><a href="#">Move Down</a></li> | |
97 | <hr/> |
|
97 | <hr/> | |
98 | <li id="select_previous"><a href="#">Select Previous</a></li> |
|
98 | <li id="select_previous"><a href="#">Select Previous</a></li> | |
99 | <li id="select_next"><a href="#">Select Next</a></li> |
|
99 | <li id="select_next"><a href="#">Select Next</a></li> | |
100 | </ul> |
|
100 | </ul> | |
101 | </li> |
|
101 | </li> | |
102 | <li><a href="#">Insert</a> |
|
102 | <li><a href="#">Insert</a> | |
103 | <ul> |
|
103 | <ul> | |
104 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> |
|
104 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> | |
105 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> |
|
105 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> | |
106 | </ul> |
|
106 | </ul> | |
107 | </li> |
|
107 | </li> | |
108 | <li><a href="#">Cell</a> |
|
108 | <li><a href="#">Cell</a> | |
109 | <ul> |
|
109 | <ul> | |
110 | <li id="full_edit_cell"><a href="#">Edit in Ace</a></li> |
|
|||
111 | <hr/> |
|
|||
112 | <li id="run_cell"><a href="#">Run</a></li> |
|
110 | <li id="run_cell"><a href="#">Run</a></li> | |
113 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> |
|
111 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> | |
114 | <li id="run_all_cells"><a href="#">Run All</a></li> |
|
112 | <li id="run_all_cells"><a href="#">Run All</a></li> | |
115 | <hr/> |
|
113 | <hr/> | |
116 | <li id="to_code"><a href="#">Code Cell</a></li> |
|
114 | <li id="to_code"><a href="#">Code Cell</a></li> | |
117 | <li id="to_markdown"><a href="#">Markdown Cell</a></li> |
|
115 | <li id="to_markdown"><a href="#">Markdown Cell</a></li> | |
118 | <hr/> |
|
116 | <hr/> | |
119 | <li id="toggle_output"><a href="#">Toggle Output</a></li> |
|
117 | <li id="toggle_output"><a href="#">Toggle Output</a></li> | |
120 | <li id="clear_all_output"><a href="#">Clear All Output</a></li> |
|
118 | <li id="clear_all_output"><a href="#">Clear All Output</a></li> | |
121 | </ul> |
|
119 | </ul> | |
122 | </li> |
|
120 | </li> | |
123 | <li><a href="#">Kernel</a> |
|
121 | <li><a href="#">Kernel</a> | |
124 | <ul> |
|
122 | <ul> | |
125 | <li id="int_kernel"><a href="#">Interrupt</a></li> |
|
123 | <li id="int_kernel"><a href="#">Interrupt</a></li> | |
126 | <li id="restart_kernel"><a href="#">Restart</a></li> |
|
124 | <li id="restart_kernel"><a href="#">Restart</a></li> | |
127 | </ul> |
|
125 | </ul> | |
128 | </li> |
|
126 | </li> | |
129 | <li><a href="#">Help</a> |
|
127 | <li><a href="#">Help</a> | |
130 | <ul> |
|
128 | <ul> | |
131 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> |
|
129 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> | |
132 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> |
|
130 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> | |
133 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
131 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> | |
134 | <hr/> |
|
132 | <hr/> | |
135 | <li><a href="https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts" target="_blank">Ace Keyboard Shortcuts</a></li> |
|
|||
136 | <hr/> |
|
|||
137 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> |
|
133 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> | |
138 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
|
134 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> | |
139 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> |
|
135 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> | |
140 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> |
|
136 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> | |
141 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> |
|
137 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> | |
142 | </ul> |
|
138 | </ul> | |
143 | </li> |
|
139 | </li> | |
144 | </ul> |
|
140 | </ul> | |
145 |
|
141 | |||
146 | </div> |
|
142 | </div> | |
147 |
|
143 | |||
148 | <div id="main_app"> |
|
144 | <div id="main_app"> | |
149 |
|
145 | |||
150 | <div id="notebook_panel"> |
|
146 | <div id="notebook_panel"> | |
151 | <div id="notebook"></div> |
|
147 | <div id="notebook"></div> | |
152 | <div id="pager_splitter"></div> |
|
148 | <div id="pager_splitter"></div> | |
153 | <div id="pager"></div> |
|
149 | <div id="pager"></div> | |
154 | </div> |
|
150 | </div> | |
155 |
|
151 | |||
156 | </div> |
|
152 | </div> | |
157 |
|
153 | |||
158 | <div id="fulledit_widget" > |
|
|||
159 | <div id="fulledit_header"> |
|
|||
160 | <button id="close_fulledit">Close</button> |
|
|||
161 | </div> |
|
|||
162 | <div id="fulledit_editor">some text</div> |
|
|||
163 | </div> |
|
|||
164 |
|
||||
165 | <script src="/static/jquery/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> |
|
154 | <script src="/static/jquery/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> | |
166 | <script src="/static/jquery/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> |
|
155 | <script src="/static/jquery/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> | |
167 |
|
156 | |||
168 | <script src="/static/codemirror/lib/codemirror.js" charset="utf-8"></script> |
|
157 | <script src="/static/codemirror/lib/codemirror.js" charset="utf-8"></script> | |
169 | <script src="/static/codemirror/mode/python/python.js" charset="utf-8"></script> |
|
158 | <script src="/static/codemirror/mode/python/python.js" charset="utf-8"></script> | |
170 | <script src="/static/codemirror/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> |
|
159 | <script src="/static/codemirror/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> | |
171 | <script src="/static/codemirror/mode/xml/xml.js" charset="utf-8"></script> |
|
160 | <script src="/static/codemirror/mode/xml/xml.js" charset="utf-8"></script> | |
172 | <script src="/static/codemirror/mode/javascript/javascript.js" charset="utf-8"></script> |
|
161 | <script src="/static/codemirror/mode/javascript/javascript.js" charset="utf-8"></script> | |
173 | <script src="/static/codemirror/mode/css/css.js" charset="utf-8"></script> |
|
162 | <script src="/static/codemirror/mode/css/css.js" charset="utf-8"></script> | |
174 | <script src="/static/codemirror/mode/rst/rst.js" charset="utf-8"></script> |
|
163 | <script src="/static/codemirror/mode/rst/rst.js" charset="utf-8"></script> | |
175 | <script src="/static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script> |
|
164 | <script src="/static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script> | |
176 |
|
165 | |||
177 | <script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script> |
|
|||
178 | <script src="/static/ace/mode-python.js" type="text/javascript" charset="utf-8"></script> |
|
|||
179 | <script src="/static/ace/mode-markdown.js" type="text/javascript" charset="utf-8"></script> |
|
|||
180 | <script src="/static/ace/mode-html.js" type="text/javascript" charset="utf-8"></script> |
|
|||
181 | <script src="/static/ace/theme-textmate.js" type="text/javascript" charset="utf-8"></script> |
|
|||
182 |
|
||||
183 | <script src="/static/pagedown/Markdown.Converter.js" charset="utf-8"></script> |
|
166 | <script src="/static/pagedown/Markdown.Converter.js" charset="utf-8"></script> | |
184 |
|
167 | |||
185 | <script src="/static/prettify/prettify.js" charset="utf-8"></script> |
|
168 | <script src="/static/prettify/prettify.js" charset="utf-8"></script> | |
186 | <script src="/static/dateformat/date.format.js" charset="utf-8"></script> |
|
169 | <script src="/static/dateformat/date.format.js" charset="utf-8"></script> | |
187 |
|
170 | |||
188 | <script src="/static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
171 | <script src="/static/js/namespace.js" type="text/javascript" charset="utf-8"></script> | |
189 | <script src="/static/js/utils.js" type="text/javascript" charset="utf-8"></script> |
|
172 | <script src="/static/js/utils.js" type="text/javascript" charset="utf-8"></script> | |
190 | <script src="/static/js/cell.js" type="text/javascript" charset="utf-8"></script> |
|
173 | <script src="/static/js/cell.js" type="text/javascript" charset="utf-8"></script> | |
191 | <script src="/static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
174 | <script src="/static/js/codecell.js" type="text/javascript" charset="utf-8"></script> | |
192 | <script src="/static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
175 | <script src="/static/js/textcell.js" type="text/javascript" charset="utf-8"></script> | |
193 | <script src="/static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
176 | <script src="/static/js/kernel.js" type="text/javascript" charset="utf-8"></script> | |
194 | <script src="/static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> |
|
177 | <script src="/static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> | |
195 | <script src="/static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
178 | <script src="/static/js/layout.js" type="text/javascript" charset="utf-8"></script> | |
196 | <script src="/static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
179 | <script src="/static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
197 | <script src="/static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script> |
|
180 | <script src="/static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script> | |
198 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> |
|
181 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> | |
199 | <script src="/static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
182 | <script src="/static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
200 | <script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script> |
|
183 | <script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script> | |
201 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
184 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
202 | <script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script> |
|
185 | <script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script> | |
203 | <script src="/static/js/fulleditwidget.js" type="text/javascript" charset="utf-8"></script> |
|
|||
204 |
|
186 | |||
205 | </body> |
|
187 | </body> | |
206 |
|
188 | |||
207 | </html> |
|
189 | </html> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now