Show More
@@ -1,375 +1,378 b'' | |||||
1 | /** |
|
1 | /** | |
2 | * HTML5 ✰ Boilerplate |
|
2 | * HTML5 ✰ Boilerplate | |
3 | * |
|
3 | * | |
4 | * style.css contains a reset, font normalization and some base styles. |
|
4 | * style.css contains a reset, font normalization and some base styles. | |
5 | * |
|
5 | * | |
6 | * Credit is left where credit is due. |
|
6 | * Credit is left where credit is due. | |
7 | * Much inspiration was taken from these projects: |
|
7 | * Much inspiration was taken from these projects: | |
8 | * - yui.yahooapis.com/2.8.1/build/base/base.css |
|
8 | * - yui.yahooapis.com/2.8.1/build/base/base.css | |
9 | * - camendesign.com/design/ |
|
9 | * - camendesign.com/design/ | |
10 | * - praegnanz.de/weblog/htmlcssjs-kickstart |
|
10 | * - praegnanz.de/weblog/htmlcssjs-kickstart | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | /** |
|
14 | /** | |
15 | * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline) |
|
15 | * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline) | |
16 | * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark |
|
16 | * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark | |
17 | * html5doctor.com/html-5-reset-stylesheet/ |
|
17 | * html5doctor.com/html-5-reset-stylesheet/ | |
18 | */ |
|
18 | */ | |
19 |
|
19 | |||
20 | html, body, div, span, object, iframe, |
|
20 | html, body, div, span, object, iframe, | |
21 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, |
|
21 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
22 | abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, |
|
22 | abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, | |
23 | small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, |
|
23 | small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, | |
24 | fieldset, form, label, legend, |
|
24 | fieldset, form, label, legend, | |
25 | table, caption, tbody, tfoot, thead, tr, th, td, |
|
25 | table, caption, tbody, tfoot, thead, tr, th, td, | |
26 | article, aside, canvas, details, figcaption, figure, |
|
26 | article, aside, canvas, details, figcaption, figure, | |
27 | footer, header, hgroup, menu, nav, section, summary, |
|
27 | footer, header, hgroup, menu, nav, section, summary, | |
28 | time, mark, audio, video { |
|
28 | time, mark, audio, video { | |
29 | margin: 0; |
|
29 | margin: 0; | |
30 | padding: 0; |
|
30 | padding: 0; | |
31 | border: 0; |
|
31 | border: 0; | |
32 | font-size: 100%; |
|
32 | font-size: 100%; | |
33 | font: inherit; |
|
33 | font: inherit; | |
34 | vertical-align: baseline; |
|
34 | vertical-align: baseline; | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | article, aside, details, figcaption, figure, |
|
37 | article, aside, details, figcaption, figure, | |
38 | footer, header, hgroup, menu, nav, section { |
|
38 | footer, header, hgroup, menu, nav, section { | |
39 | display: block; |
|
39 | display: block; | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | blockquote, q { quotes: none; } |
|
42 | blockquote, q { quotes: none; } | |
43 |
|
43 | |||
44 | blockquote:before, blockquote:after, |
|
44 | blockquote:before, blockquote:after, | |
45 | q:before, q:after { content: ""; content: none; } |
|
45 | q:before, q:after { content: ""; content: none; } | |
46 |
|
46 | |||
47 | ins { background-color: #ff9; color: #000; text-decoration: none; } |
|
47 | ins { background-color: #ff9; color: #000; text-decoration: none; } | |
48 |
|
48 | |||
49 | mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; } |
|
49 | mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; } | |
50 |
|
50 | |||
51 | del { text-decoration: line-through; } |
|
51 | del { text-decoration: line-through; } | |
52 |
|
52 | |||
53 | abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; } |
|
53 | abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; } | |
54 |
|
54 | |||
55 | table { border-collapse: collapse; border-spacing: 0; } |
|
55 | table { border-collapse: collapse; border-spacing: 0; } | |
56 |
|
56 | |||
57 | hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } |
|
57 | hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } | |
58 |
|
58 | |||
59 | input, select { vertical-align: middle; } |
|
59 | input, select { vertical-align: middle; } | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | /** |
|
62 | /** | |
63 | * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/ |
|
63 | * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/ | |
64 | */ |
|
64 | */ | |
65 |
|
65 | |||
66 | body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */ |
|
66 | body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */ | |
67 | select, input, textarea, button { font:99% sans-serif; } |
|
67 | select, input, textarea, button { font:99% sans-serif; } | |
68 |
|
68 | |||
69 | /* Normalize monospace sizing: |
|
69 | /* Normalize monospace sizing: | |
70 | en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */ |
|
70 | en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */ | |
71 | pre, code, kbd, samp { font-family: monospace, sans-serif; } |
|
71 | pre, code, kbd, samp { font-family: monospace, sans-serif; } | |
72 |
|
72 | |||
73 |
|
73 | |||
74 | /** |
|
74 | /** | |
75 | * Primary styles |
|
75 | * Primary styles | |
76 | * |
|
76 | * | |
77 | * Author: IPython Development Team |
|
77 | * Author: IPython Development Team | |
78 | */ |
|
78 | */ | |
79 |
|
79 | |||
80 |
|
80 | |||
81 | body { |
|
81 | body { | |
82 | background-color: white; |
|
82 | background-color: white; | |
83 | /* This makes sure that the body covers the entire window and needs to |
|
83 | /* This makes sure that the body covers the entire window and needs to | |
84 | be in a different element than the display: box in wrapper below */ |
|
84 | be in a different element than the display: box in wrapper below */ | |
85 | position: absolute; |
|
85 | position: absolute; | |
86 | left: 0px; |
|
86 | left: 0px; | |
87 | right: 0px; |
|
87 | right: 0px; | |
88 | top: 0px; |
|
88 | top: 0px; | |
89 | bottom: 0px; |
|
89 | bottom: 0px; | |
90 | overflow: hidden; |
|
90 | overflow: hidden; | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 |
|
93 | |||
94 | div#header { |
|
94 | div#header { | |
95 | /* Initially hidden to prevent FLOUC */ |
|
95 | /* Initially hidden to prevent FLOUC */ | |
96 | display: none; |
|
96 | display: none; | |
97 | position: relative; |
|
97 | position: relative; | |
98 | height: 45px; |
|
98 | height: 45px; | |
99 | padding: 5px; |
|
99 | padding: 5px; | |
100 | margin: 0px; |
|
100 | margin: 0px; | |
101 | width: 100%; |
|
101 | width: 100%; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | span#ipython_notebook { |
|
104 | span#ipython_notebook { | |
105 | position: absolute; |
|
105 | position: absolute; | |
106 | padding: 2px; |
|
106 | padding: 2px; | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | span#ipython_notebook h1 { |
|
109 | span#ipython_notebook h1 { | |
110 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
110 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
111 | font-size: 197%; |
|
111 | font-size: 197%; | |
112 | display: inline; |
|
112 | display: inline; | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | span#save_widget { |
|
115 | span#save_widget { | |
116 | position: absolute; |
|
116 | position: absolute; | |
117 | left: 0px; |
|
117 | left: 0px; | |
118 | padding: 5px 0px; |
|
118 | padding: 5px 0px; | |
119 | margin: 0px 0px 0px 0px; |
|
119 | margin: 0px 0px 0px 0px; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | input#notebook_name { |
|
122 | input#notebook_name { | |
123 | height: 1em; |
|
123 | height: 1em; | |
124 | line-height: 1em; |
|
124 | line-height: 1em; | |
125 | padding: 5px; |
|
125 | padding: 5px; | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | span#kernel_status { |
|
128 | span#kernel_status { | |
129 | position: absolute; |
|
129 | position: absolute; | |
130 | padding: 8px 5px 5px 5px; |
|
130 | padding: 8px 5px 5px 5px; | |
131 | right: 10px; |
|
131 | right: 10px; | |
132 | font-weight: bold; |
|
132 | font-weight: bold; | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | .status_idle { |
|
135 | .status_idle { | |
136 | color: gray; |
|
136 | color: gray; | |
137 | } |
|
137 | } | |
138 |
|
138 | |||
139 | .status_busy { |
|
139 | .status_busy { | |
140 | color: red; |
|
140 | color: red; | |
141 | } |
|
141 | } | |
142 |
|
142 | |||
143 | .status_restarting { |
|
143 | .status_restarting { | |
144 | color: black; |
|
144 | color: black; | |
145 | } |
|
145 | } | |
146 |
|
146 | |||
147 | div#notebook_app { |
|
147 | div#notebook_app { | |
148 | /* Initially hidden to prevent FLOUC */ |
|
148 | /* Initially hidden to prevent FLOUC */ | |
149 | display: none; |
|
149 | display: none; | |
150 | width: 100%; |
|
150 | width: 100%; | |
151 | position: relative; |
|
151 | position: relative; | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | div#left_panel { |
|
154 | div#left_panel { | |
155 | overflow-y: auto; |
|
155 | overflow-y: auto; | |
156 | top: 0px; |
|
156 | top: 0px; | |
157 | left: 0px; |
|
157 | left: 0px; | |
158 | margin: 0px; |
|
158 | margin: 0px; | |
159 | padding: 0px; |
|
159 | padding: 0px; | |
160 | position: absolute; |
|
160 | position: absolute; | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | h3.section_header { |
|
163 | h3.section_header { | |
164 | padding: 5px; |
|
164 | padding: 5px; | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | div.section_content { |
|
167 | div.section_content { | |
168 | padding: 5px; |
|
168 | padding: 5px; | |
169 | } |
|
169 | } | |
170 |
|
170 | |||
171 |
|
171 | |||
172 | span.section_row_buttons > button { |
|
172 | span.section_row_buttons > button { | |
173 | width: 60px; |
|
173 | width: 60px; | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 | .section_row { |
|
176 | .section_row { | |
177 | margin: 5px 0px; |
|
177 | margin: 5px 0px; | |
178 | } |
|
178 | } | |
179 |
|
179 | |||
180 | .section_row_buttons { |
|
180 | .section_row_buttons { | |
181 | float: right; |
|
181 | float: right; | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | .section_row_header { |
|
184 | .section_row_header { | |
185 | float: left; |
|
185 | float: left; | |
186 | font-size: 85%; |
|
186 | font-size: 85%; | |
187 | padding: 0.2em 0em; |
|
187 | padding: 0.2em 0em; | |
188 | font-weight: bold; |
|
188 | font-weight: bold; | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | span.button_label { |
|
191 | span.button_label { | |
192 | padding: 0.2em 1em; |
|
192 | padding: 0.2em 1em; | |
193 | font-size: 77%; |
|
193 | font-size: 77%; | |
194 | float: right; |
|
194 | float: right; | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 | /* This is needed because FF was adding a 2px margin top and bottom. */ |
|
197 | /* This is needed because FF was adding a 2px margin top and bottom. */ | |
198 | .section_row .ui-button { |
|
198 | .section_row .ui-button { | |
199 | margin-top: 0px; |
|
199 | margin-top: 0px; | |
200 | margin-bottom: 0px; |
|
200 | margin-bottom: 0px; | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 |
|
203 | |||
204 | .ui-button .ui-button-text { |
|
204 | .ui-button .ui-button-text { | |
205 | padding: 0.2em 0.8em; |
|
205 | padding: 0.2em 0.8em; | |
206 | font-size: 77%; |
|
206 | font-size: 77%; | |
207 | } |
|
207 | } | |
208 |
|
208 | |||
209 | div#left_panel_splitter { |
|
209 | div#left_panel_splitter { | |
210 | width: 8px; |
|
210 | width: 8px; | |
211 | top: 0px; |
|
211 | top: 0px; | |
212 | left: 202px; |
|
212 | left: 202px; | |
213 | margin: 0px; |
|
213 | margin: 0px; | |
214 | padding: 0px; |
|
214 | padding: 0px; | |
215 | position: absolute; |
|
215 | position: absolute; | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 | div#notebook_panel { |
|
218 | div#notebook_panel { | |
219 | /* The L margin will be set in the Javascript code*/ |
|
219 | /* The L margin will be set in the Javascript code*/ | |
220 | margin: 0px 0px 0px 0px; |
|
220 | margin: 0px 0px 0px 0px; | |
221 | padding: 0px; |
|
221 | padding: 0px; | |
222 | } |
|
222 | } | |
223 |
|
223 | |||
224 | div#notebook { |
|
224 | div#notebook { | |
225 | overflow-y: scroll; |
|
225 | overflow-y: scroll; | |
226 | overflow-x: auto; |
|
226 | overflow-x: auto; | |
227 | width: 100%; |
|
227 | width: 100%; | |
228 | padding: 0px 15px 0px 15px; |
|
228 | padding: 0px 15px 0px 15px; | |
229 | margin: 0px |
|
229 | margin: 0px | |
230 | background-color: white; |
|
230 | background-color: white; | |
231 | } |
|
231 | } | |
232 |
|
232 | |||
233 | div#pager_splitter { |
|
233 | div#pager_splitter { | |
234 | height: 8px; |
|
234 | height: 8px; | |
235 | } |
|
235 | } | |
236 |
|
236 | |||
237 | div#pager { |
|
237 | div#pager { | |
238 | padding: 15px; |
|
238 | padding: 15px; | |
239 | overflow: auto; |
|
239 | overflow: auto; | |
240 | } |
|
240 | } | |
241 |
|
241 | |||
242 | div.cell { |
|
242 | div.cell { | |
243 | width: 100%; |
|
243 | width: 100%; | |
244 | padding: 5px; |
|
244 | padding: 5px; | |
245 | /* This acts as a spacer between cells, that is outside the border */ |
|
245 | /* This acts as a spacer between cells, that is outside the border */ | |
246 | margin: 15px 0px 15px 0px; |
|
246 | margin: 15px 0px 15px 0px; | |
247 | } |
|
247 | } | |
248 |
|
248 | |||
249 | div.code_cell { |
|
249 | div.code_cell { | |
250 | background-color: white; |
|
250 | background-color: white; | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | div.prompt { |
|
253 | div.prompt { | |
254 | width: 80px; |
|
254 | width: 80px; | |
255 | padding: 0.4em; |
|
255 | padding: 0.4em; | |
256 | margin: 0px; |
|
256 | margin: 0px; | |
257 | font-family: monospace; |
|
257 | font-family: monospace; | |
258 | } |
|
258 | } | |
259 |
|
259 | |||
260 | div.input_prompt { |
|
260 | div.input_prompt { | |
261 | color: navy; |
|
261 | color: navy; | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 | div.output { |
|
264 | div.output { | |
265 | /* This is a spacer between the input and output of each cell */ |
|
265 | /* This is a spacer between the input and output of each cell */ | |
266 | margin-top: 15px; |
|
266 | margin-top: 15px; | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 | div.output_prompt { |
|
269 | div.output_prompt { | |
270 | color: darkred; |
|
270 | color: darkred; | |
271 | } |
|
271 | } | |
272 |
|
272 | |||
273 | div.output_area { |
|
273 | div.output_area { | |
274 | text-align: left; |
|
274 | text-align: left; | |
275 | color: black; |
|
275 | color: black; | |
276 | font-family: monospace; |
|
276 | font-family: monospace; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | div.output_stream { |
|
279 | div.output_stream { | |
280 | padding: 0.4em; |
|
280 | padding: 0.4em; | |
281 | } |
|
281 | } | |
282 |
|
282 | |||
283 | div.output_latex { |
|
283 | div.output_latex { | |
284 | /* Slightly bigger than the rest of the notebook */ |
|
284 | /* Slightly bigger than the rest of the notebook */ | |
285 | font-size: 116%; |
|
285 | font-size: 116%; | |
286 | } |
|
286 | } | |
287 |
|
287 | |||
|
288 | div.output_html { | |||
|
289 | } | |||
|
290 | ||||
288 | div.output_png { |
|
291 | div.output_png { | |
289 | } |
|
292 | } | |
290 |
|
293 | |||
291 | div.text_cell { |
|
294 | div.text_cell { | |
292 | background-color: white; |
|
295 | background-color: white; | |
293 | } |
|
296 | } | |
294 |
|
297 | |||
295 | textarea.text_cell_input { |
|
298 | textarea.text_cell_input { | |
296 | /* Slightly bigger than the rest of the notebook */ |
|
299 | /* Slightly bigger than the rest of the notebook */ | |
297 | font-size: 116%; |
|
300 | font-size: 116%; | |
298 | font-family: monospace; |
|
301 | font-family: monospace; | |
299 | outline: none; |
|
302 | outline: none; | |
300 | resize: none; |
|
303 | resize: none; | |
301 | width: inherit; |
|
304 | width: inherit; | |
302 | border-style: none; |
|
305 | border-style: none; | |
303 | padding: 0px; |
|
306 | padding: 0px; | |
304 | margin: 0px; |
|
307 | margin: 0px; | |
305 | color: black; |
|
308 | color: black; | |
306 | } |
|
309 | } | |
307 |
|
310 | |||
308 | div.text_cell_render { |
|
311 | div.text_cell_render { | |
309 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
312 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
310 | /* Slightly bigger than the rest of the notebook */ |
|
313 | /* Slightly bigger than the rest of the notebook */ | |
311 | font-size: 116%; |
|
314 | font-size: 116%; | |
312 | outline: none; |
|
315 | outline: none; | |
313 | resize: none; |
|
316 | resize: none; | |
314 | width: inherit; |
|
317 | width: inherit; | |
315 | border-style: none; |
|
318 | border-style: none; | |
316 | padding: 5px; |
|
319 | padding: 5px; | |
317 | color: black; |
|
320 | color: black; | |
318 | } |
|
321 | } | |
319 |
|
322 | |||
320 | div.text_cell_render em {font-style: italic;} |
|
323 | div.text_cell_render em {font-style: italic;} | |
321 | div.text_cell_render strong {font-weight: bold;} |
|
324 | div.text_cell_render strong {font-weight: bold;} | |
322 | div.text_cell_render u {text-decoration: underline;} |
|
325 | div.text_cell_render u {text-decoration: underline;} | |
323 | div.text_cell_render :link { text-decoration: underline } |
|
326 | div.text_cell_render :link { text-decoration: underline } | |
324 | div.text_cell_render :visited { text-decoration: underline } |
|
327 | div.text_cell_render :visited { text-decoration: underline } | |
325 | div.text_cell_render h1 {font-size: 197%; margin: .67em 0; font-weight: bold;} |
|
328 | div.text_cell_render h1 {font-size: 197%; margin: .67em 0; font-weight: bold;} | |
326 | div.text_cell_render h2 {font-size: 153.9%; margin: .75em 0; font-weight: bold;} |
|
329 | div.text_cell_render h2 {font-size: 153.9%; margin: .75em 0; font-weight: bold;} | |
327 | div.text_cell_render h3 {font-size: 116%; margin: .83em 0; font-weight: bold;} |
|
330 | div.text_cell_render h3 {font-size: 116%; margin: .83em 0; font-weight: bold;} | |
328 | div.text_cell_render h4 {margin: 1.12em 0; font-weight: bold;} |
|
331 | div.text_cell_render h4 {margin: 1.12em 0; font-weight: bold;} | |
329 | div.text_cell_render h5 {font-size: 85%.; margin: 1.5em 0; font-weight: bold;} |
|
332 | div.text_cell_render h5 {font-size: 85%.; margin: 1.5em 0; font-weight: bold;} | |
330 | div.text_cell_render h6 {font-size: 77%; margin: 1.67em 0; font-weight: bold;} |
|
333 | div.text_cell_render h6 {font-size: 77%; margin: 1.67em 0; font-weight: bold;} | |
331 | div.text_cell_render ul {list-style:disc; margin-left: 40px;} |
|
334 | div.text_cell_render ul {list-style:disc; margin-left: 40px;} | |
332 | div.text_cell_render ul ul {list-style:square; margin-left: 40px;} |
|
335 | div.text_cell_render ul ul {list-style:square; margin-left: 40px;} | |
333 | div.text_cell_render ul ul ul {list-style:circle; margin-left: 40px;} |
|
336 | div.text_cell_render ul ul ul {list-style:circle; margin-left: 40px;} | |
334 | div.text_cell_render ol {list-style:upper-roman; margin-left: 40px;} |
|
337 | div.text_cell_render ol {list-style:upper-roman; margin-left: 40px;} | |
335 | div.text_cell_render ol ol {list-style:upper-alpha;} |
|
338 | div.text_cell_render ol ol {list-style:upper-alpha;} | |
336 | div.text_cell_render ol ol ol {list-style:decimal;} |
|
339 | div.text_cell_render ol ol ol {list-style:decimal;} | |
337 | div.text_cell_render ol ol ol ol {list-style:lower-alpha;} |
|
340 | div.text_cell_render ol ol ol ol {list-style:lower-alpha;} | |
338 | div.text_cell_render ol ol ol ol ol {list-style:lower-roman;} |
|
341 | div.text_cell_render ol ol ol ol ol {list-style:lower-roman;} | |
339 |
|
342 | |||
340 |
|
343 | |||
341 | .CodeMirror { |
|
344 | .CodeMirror { | |
342 | overflow: hidden; /* Changed from auto to remove scrollbar */ |
|
345 | overflow: hidden; /* Changed from auto to remove scrollbar */ | |
343 | height: auto; /* Changed to auto to autogrow */ |
|
346 | height: auto; /* Changed to auto to autogrow */ | |
344 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
347 | line-height: 1.231; /* Changed from 1em to our global default */ | |
345 | } |
|
348 | } | |
346 |
|
349 | |||
347 | /* CSS font colors for translated ANSI colors. */ |
|
350 | /* CSS font colors for translated ANSI colors. */ | |
348 |
|
351 | |||
349 |
|
352 | |||
350 | .ansiblack {color: black;} |
|
353 | .ansiblack {color: black;} | |
351 | .ansired {color: darkred;} |
|
354 | .ansired {color: darkred;} | |
352 | .ansigreen {color: darkgreen;} |
|
355 | .ansigreen {color: darkgreen;} | |
353 | .ansiyellow {color: brown;} |
|
356 | .ansiyellow {color: brown;} | |
354 | .ansiblue {color: darkblue;} |
|
357 | .ansiblue {color: darkblue;} | |
355 | .ansipurple {color: darkviolet;} |
|
358 | .ansipurple {color: darkviolet;} | |
356 | .ansicyan {color: steelblue;} |
|
359 | .ansicyan {color: steelblue;} | |
357 | .ansigrey {color: grey;} |
|
360 | .ansigrey {color: grey;} | |
358 | .ansibold {font-weight: bold;} |
|
361 | .ansibold {font-weight: bold;} | |
359 |
|
362 | |||
360 | .completions { |
|
363 | .completions { | |
361 | position: absolute; |
|
364 | position: absolute; | |
362 | z-index: 10; |
|
365 | z-index: 10; | |
363 | overflow: auto; |
|
366 | overflow: auto; | |
364 | border: 1px solid black; |
|
367 | border: 1px solid black; | |
365 | } |
|
368 | } | |
366 |
|
369 | |||
367 | .completions select { |
|
370 | .completions select { | |
368 | background: white; |
|
371 | background: white; | |
369 | outline: none; |
|
372 | outline: none; | |
370 | border: none; |
|
373 | border: none; | |
371 | padding: 0px; |
|
374 | padding: 0px; | |
372 | margin: 0px; |
|
375 | margin: 0px; | |
373 | font-family: monospace; |
|
376 | font-family: monospace; | |
374 | } |
|
377 | } | |
375 |
|
378 |
@@ -1,312 +1,323 b'' | |||||
1 |
|
1 | |||
2 | //============================================================================ |
|
2 | //============================================================================ | |
3 | // CodeCell |
|
3 | // CodeCell | |
4 | //============================================================================ |
|
4 | //============================================================================ | |
5 |
|
5 | |||
6 | var IPython = (function (IPython) { |
|
6 | var IPython = (function (IPython) { | |
7 |
|
7 | |||
8 | var utils = IPython.utils; |
|
8 | var utils = IPython.utils; | |
9 |
|
9 | |||
10 | var CodeCell = function (notebook) { |
|
10 | var CodeCell = function (notebook) { | |
11 | this.code_mirror = null; |
|
11 | this.code_mirror = null; | |
12 | this.input_prompt_number = ' '; |
|
12 | this.input_prompt_number = ' '; | |
13 | this.is_completing = false; |
|
13 | this.is_completing = false; | |
14 | this.completion_cursor = null; |
|
14 | this.completion_cursor = null; | |
15 | IPython.Cell.apply(this, arguments); |
|
15 | IPython.Cell.apply(this, arguments); | |
16 | }; |
|
16 | }; | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | CodeCell.prototype = new IPython.Cell(); |
|
19 | CodeCell.prototype = new IPython.Cell(); | |
20 |
|
20 | |||
21 |
|
21 | |||
22 | CodeCell.prototype.create_element = function () { |
|
22 | CodeCell.prototype.create_element = function () { | |
23 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox'); |
|
23 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox'); | |
24 | var input = $('<div></div>').addClass('input hbox'); |
|
24 | var input = $('<div></div>').addClass('input hbox'); | |
25 | input.append($('<div/>').addClass('prompt input_prompt')); |
|
25 | input.append($('<div/>').addClass('prompt input_prompt')); | |
26 | var input_area = $('<div/>').addClass('input_area box-flex1'); |
|
26 | var input_area = $('<div/>').addClass('input_area box-flex1'); | |
27 | this.code_mirror = CodeMirror(input_area.get(0), { |
|
27 | this.code_mirror = CodeMirror(input_area.get(0), { | |
28 | indentUnit : 4, |
|
28 | indentUnit : 4, | |
29 | enterMode : 'flat', |
|
29 | enterMode : 'flat', | |
30 | tabMode: 'shift', |
|
30 | tabMode: 'shift', | |
31 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) |
|
31 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) | |
32 | }); |
|
32 | }); | |
33 | input.append(input_area); |
|
33 | input.append(input_area); | |
34 | var output = $('<div></div>').addClass('output vbox'); |
|
34 | var output = $('<div></div>').addClass('output vbox'); | |
35 | cell.append(input).append(output); |
|
35 | cell.append(input).append(output); | |
36 | this.element = cell; |
|
36 | this.element = cell; | |
37 | this.collapse() |
|
37 | this.collapse() | |
38 | }; |
|
38 | }; | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { |
|
41 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { | |
42 | // This method gets called in CodeMirror's onKeyDown/onKeyPress handlers and |
|
42 | // This method gets called in CodeMirror's onKeyDown/onKeyPress handlers and | |
43 | // is used to provide custom key handling. Its return value is used to determine |
|
43 | // is used to provide custom key handling. Its return value is used to determine | |
44 | // if CodeMirror should ignore the event: true = ignore, false = don't ignore. |
|
44 | // if CodeMirror should ignore the event: true = ignore, false = don't ignore. | |
45 | if (event.keyCode === 13 && event.shiftKey) { |
|
45 | if (event.keyCode === 13 && event.shiftKey) { | |
46 | // Always ignore shift-enter in CodeMirror as we handle it. |
|
46 | // Always ignore shift-enter in CodeMirror as we handle it. | |
47 | return true; |
|
47 | return true; | |
48 | // } else if (event.keyCode == 32 && (event.ctrlKey || event.metaKey) && !event.altKey) { |
|
48 | // } else if (event.keyCode == 32 && (event.ctrlKey || event.metaKey) && !event.altKey) { | |
49 | } else if (event.keyCode == 9) { |
|
49 | } else if (event.keyCode == 9) { | |
50 | var cur = editor.getCursor(); |
|
50 | var cur = editor.getCursor(); | |
51 | var pre_cursor = editor.getRange({line:cur.line,ch:0},cur).trim(); |
|
51 | var pre_cursor = editor.getRange({line:cur.line,ch:0},cur).trim(); | |
52 | if (pre_cursor === "") { |
|
52 | if (pre_cursor === "") { | |
53 | // Don't autocomplete if the part of the line before the cursor is empty. |
|
53 | // Don't autocomplete if the part of the line before the cursor is empty. | |
54 | // In this case, let CodeMirror handle indentation. |
|
54 | // In this case, let CodeMirror handle indentation. | |
55 | return false; |
|
55 | return false; | |
56 | } else { |
|
56 | } else { | |
57 | // Autocomplete the current line. |
|
57 | // Autocomplete the current line. | |
58 | event.stop(); |
|
58 | event.stop(); | |
59 | var line = editor.getLine(cur.line); |
|
59 | var line = editor.getLine(cur.line); | |
60 | this.is_completing = true; |
|
60 | this.is_completing = true; | |
61 | this.completion_cursor = cur; |
|
61 | this.completion_cursor = cur; | |
62 | IPython.notebook.complete_cell(this, line, cur.ch); |
|
62 | IPython.notebook.complete_cell(this, line, cur.ch); | |
63 | return true; |
|
63 | return true; | |
64 | } |
|
64 | } | |
65 | } else { |
|
65 | } else { | |
66 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { |
|
66 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { | |
67 | this.is_completing = false; |
|
67 | this.is_completing = false; | |
68 | this.completion_cursor = null; |
|
68 | this.completion_cursor = null; | |
69 | } |
|
69 | } | |
70 | return false; |
|
70 | return false; | |
71 | }; |
|
71 | }; | |
72 | }; |
|
72 | }; | |
73 |
|
73 | |||
74 |
|
74 | |||
75 | CodeCell.prototype.finish_completing = function (matched_text, matches) { |
|
75 | CodeCell.prototype.finish_completing = function (matched_text, matches) { | |
76 | if (!this.is_completing || matches.length === 0) {return;} |
|
76 | if (!this.is_completing || matches.length === 0) {return;} | |
77 | // console.log("Got matches", matched_text, matches); |
|
77 | // console.log("Got matches", matched_text, matches); | |
78 |
|
78 | |||
79 | var that = this; |
|
79 | var that = this; | |
80 | var cur = this.completion_cursor; |
|
80 | var cur = this.completion_cursor; | |
81 | var complete = $('<div/>').addClass('completions'); |
|
81 | var complete = $('<div/>').addClass('completions'); | |
82 | var select = $('<select/>').attr('multiple','true'); |
|
82 | var select = $('<select/>').attr('multiple','true'); | |
83 | for (var i=0; i<matches.length; ++i) { |
|
83 | for (var i=0; i<matches.length; ++i) { | |
84 | select.append($('<option/>').text(matches[i])); |
|
84 | select.append($('<option/>').text(matches[i])); | |
85 | } |
|
85 | } | |
86 | select.children().first().attr('selected','true'); |
|
86 | select.children().first().attr('selected','true'); | |
87 | select.attr('size',Math.min(10,matches.length)); |
|
87 | select.attr('size',Math.min(10,matches.length)); | |
88 | var pos = this.code_mirror.cursorCoords(); |
|
88 | var pos = this.code_mirror.cursorCoords(); | |
89 | complete.css('left',pos.x+'px'); |
|
89 | complete.css('left',pos.x+'px'); | |
90 | complete.css('top',pos.yBot+'px'); |
|
90 | complete.css('top',pos.yBot+'px'); | |
91 | complete.append(select); |
|
91 | complete.append(select); | |
92 |
|
92 | |||
93 | $('body').append(complete); |
|
93 | $('body').append(complete); | |
94 | var done = false; |
|
94 | var done = false; | |
95 |
|
95 | |||
96 | var insert = function (selected_text) { |
|
96 | var insert = function (selected_text) { | |
97 | that.code_mirror.replaceRange( |
|
97 | that.code_mirror.replaceRange( | |
98 | selected_text, |
|
98 | selected_text, | |
99 | {line: cur.line, ch: (cur.ch-matched_text.length)}, |
|
99 | {line: cur.line, ch: (cur.ch-matched_text.length)}, | |
100 | {line: cur.line, ch: cur.ch} |
|
100 | {line: cur.line, ch: cur.ch} | |
101 | ); |
|
101 | ); | |
102 | }; |
|
102 | }; | |
103 |
|
103 | |||
104 | var close = function () { |
|
104 | var close = function () { | |
105 | if (done) return; |
|
105 | if (done) return; | |
106 | done = true; |
|
106 | done = true; | |
107 | complete.remove(); |
|
107 | complete.remove(); | |
108 | that.is_completing = false; |
|
108 | that.is_completing = false; | |
109 | that.completion_cursor = null; |
|
109 | that.completion_cursor = null; | |
110 | }; |
|
110 | }; | |
111 |
|
111 | |||
112 | var pick = function () { |
|
112 | var pick = function () { | |
113 | insert(select.val()[0]); |
|
113 | insert(select.val()[0]); | |
114 | close(); |
|
114 | close(); | |
115 | setTimeout(function(){that.code_mirror.focus();}, 50); |
|
115 | setTimeout(function(){that.code_mirror.focus();}, 50); | |
116 | }; |
|
116 | }; | |
117 |
|
117 | |||
118 | select.blur(close); |
|
118 | select.blur(close); | |
119 | select.keydown(function (event) { |
|
119 | select.keydown(function (event) { | |
120 | var code = event.which; |
|
120 | var code = event.which; | |
121 | if (code === 13 || code === 32) { |
|
121 | if (code === 13 || code === 32) { | |
122 | // Pressing SPACE or ENTER will cause a pick |
|
122 | // Pressing SPACE or ENTER will cause a pick | |
123 | event.stopPropagation(); |
|
123 | event.stopPropagation(); | |
124 | event.preventDefault(); |
|
124 | event.preventDefault(); | |
125 | pick(); |
|
125 | pick(); | |
126 | } else if (code === 38 || code === 40) { |
|
126 | } else if (code === 38 || code === 40) { | |
127 | // We don't want the document keydown handler to handle UP/DOWN, |
|
127 | // We don't want the document keydown handler to handle UP/DOWN, | |
128 | // but we want the default action. |
|
128 | // but we want the default action. | |
129 | event.stopPropagation(); |
|
129 | event.stopPropagation(); | |
130 | } else { |
|
130 | } else { | |
131 | // All other key presses simple exit completion. |
|
131 | // All other key presses simple exit completion. | |
132 | event.stopPropagation(); |
|
132 | event.stopPropagation(); | |
133 | event.preventDefault(); |
|
133 | event.preventDefault(); | |
134 | close(); |
|
134 | close(); | |
135 | that.code_mirror.focus(); |
|
135 | that.code_mirror.focus(); | |
136 | } |
|
136 | } | |
137 | }); |
|
137 | }); | |
138 | // Double click also causes a pick. |
|
138 | // Double click also causes a pick. | |
139 | select.dblclick(pick); |
|
139 | select.dblclick(pick); | |
140 | select.focus(); |
|
140 | select.focus(); | |
141 | }; |
|
141 | }; | |
142 |
|
142 | |||
143 |
|
143 | |||
144 | CodeCell.prototype.select = function () { |
|
144 | CodeCell.prototype.select = function () { | |
145 | IPython.Cell.prototype.select.apply(this); |
|
145 | IPython.Cell.prototype.select.apply(this); | |
146 | this.code_mirror.focus(); |
|
146 | this.code_mirror.focus(); | |
147 | }; |
|
147 | }; | |
148 |
|
148 | |||
149 |
|
149 | |||
150 | CodeCell.prototype.append_pyout = function (data, n) { |
|
150 | CodeCell.prototype.append_pyout = function (data, n) { | |
151 | var toinsert = $("<div/>").addClass("output_area output_pyout hbox"); |
|
151 | var toinsert = $("<div/>").addClass("output_area output_pyout hbox"); | |
152 | toinsert.append($('<div/>'). |
|
152 | toinsert.append($('<div/>'). | |
153 | addClass('prompt output_prompt'). |
|
153 | addClass('prompt output_prompt'). | |
154 | html('Out[' + n + ']:') |
|
154 | html('Out[' + n + ']:') | |
155 | ); |
|
155 | ); | |
156 | this.append_display_data(data, toinsert); |
|
156 | this.append_display_data(data, toinsert); | |
157 | toinsert.children().last().addClass("box_flex1"); |
|
157 | toinsert.children().last().addClass("box_flex1"); | |
158 | this.element.find("div.output").append(toinsert); |
|
158 | this.element.find("div.output").append(toinsert); | |
159 | // If we just output latex, typeset it. |
|
159 | // If we just output latex, typeset it. | |
160 | if (data["text/latex"] !== undefined) { |
|
160 | if (data["text/latex"] !== undefined) { | |
161 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
161 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
162 | }; |
|
162 | }; | |
163 | }; |
|
163 | }; | |
164 |
|
164 | |||
165 |
|
165 | |||
166 | CodeCell.prototype.append_pyerr = function (ename, evalue, tb) { |
|
166 | CodeCell.prototype.append_pyerr = function (ename, evalue, tb) { | |
167 | var s = ''; |
|
167 | var s = ''; | |
168 | var len = tb.length; |
|
168 | var len = tb.length; | |
169 | for (var i=0; i<len; i++) { |
|
169 | for (var i=0; i<len; i++) { | |
170 | s = s + tb[i] + '\n'; |
|
170 | s = s + tb[i] + '\n'; | |
171 | } |
|
171 | } | |
172 | s = s + '\n'; |
|
172 | s = s + '\n'; | |
173 | this.append_stream(s); |
|
173 | this.append_stream(s); | |
174 | }; |
|
174 | }; | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | CodeCell.prototype.append_display_data = function (data, element) { |
|
177 | CodeCell.prototype.append_display_data = function (data, element) { | |
178 |
if (data["text/l |
|
178 | if (data["text/html"] !== undefined) { | |
|
179 | this.append_html(data["text/html"], element); | |||
|
180 | } else if (data["text/latex"] !== undefined) { | |||
179 | this.append_latex(data["text/latex"], element); |
|
181 | this.append_latex(data["text/latex"], element); | |
180 | // If it is undefined, then we just appended to div.output, which |
|
182 | // If it is undefined, then we just appended to div.output, which | |
181 | // makes the latex visible and we can typeset it. The typesetting |
|
183 | // makes the latex visible and we can typeset it. The typesetting | |
182 | // has to be done after the latex is on the page. |
|
184 | // has to be done after the latex is on the page. | |
183 | if (element === undefined) { |
|
185 | if (element === undefined) { | |
184 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
186 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
185 | }; |
|
187 | }; | |
186 | } else if (data["image/svg+xml"] !== undefined) { |
|
188 | } else if (data["image/svg+xml"] !== undefined) { | |
187 | this.append_svg(data["image/svg+xml"], element); |
|
189 | this.append_svg(data["image/svg+xml"], element); | |
188 | } else if (data["image/png"] !== undefined) { |
|
190 | } else if (data["image/png"] !== undefined) { | |
189 | this.append_png(data["image/png"], element); |
|
191 | this.append_png(data["image/png"], element); | |
190 | } else if (data["text/plain"] !== undefined) { |
|
192 | } else if (data["text/plain"] !== undefined) { | |
191 | this.append_stream(data["text/plain"], element); |
|
193 | this.append_stream(data["text/plain"], element); | |
192 | }; |
|
194 | }; | |
193 | return element; |
|
195 | return element; | |
194 | }; |
|
196 | }; | |
195 |
|
197 | |||
196 |
|
198 | |||
|
199 | CodeCell.prototype.append_html = function (html, element) { | |||
|
200 | element = element || this.element.find("div.output"); | |||
|
201 | var toinsert = $("<div/>").addClass("output_area output_html"); | |||
|
202 | toinsert.append(html); | |||
|
203 | element.append(toinsert); | |||
|
204 | return element; | |||
|
205 | } | |||
|
206 | ||||
|
207 | ||||
197 | CodeCell.prototype.append_stream = function (data, element) { |
|
208 | CodeCell.prototype.append_stream = function (data, element) { | |
198 | element = element || this.element.find("div.output"); |
|
209 | element = element || this.element.find("div.output"); | |
199 | var toinsert = $("<div/>").addClass("output_area output_stream"); |
|
210 | var toinsert = $("<div/>").addClass("output_area output_stream"); | |
200 | toinsert.append($("<pre/>").html(utils.fixConsole(data))); |
|
211 | toinsert.append($("<pre/>").html(utils.fixConsole(data))); | |
201 | element.append(toinsert); |
|
212 | element.append(toinsert); | |
202 | return element; |
|
213 | return element; | |
203 | }; |
|
214 | }; | |
204 |
|
215 | |||
205 |
|
216 | |||
206 | CodeCell.prototype.append_svg = function (svg, element) { |
|
217 | CodeCell.prototype.append_svg = function (svg, element) { | |
207 | element = element || this.element.find("div.output"); |
|
218 | element = element || this.element.find("div.output"); | |
208 | var toinsert = $("<div/>").addClass("output_area output_svg"); |
|
219 | var toinsert = $("<div/>").addClass("output_area output_svg"); | |
209 | toinsert.append(svg); |
|
220 | toinsert.append(svg); | |
210 | element.append(toinsert); |
|
221 | element.append(toinsert); | |
211 | return element; |
|
222 | return element; | |
212 | }; |
|
223 | }; | |
213 |
|
224 | |||
214 |
|
225 | |||
215 | CodeCell.prototype.append_png = function (png, element) { |
|
226 | CodeCell.prototype.append_png = function (png, element) { | |
216 | element = element || this.element.find("div.output"); |
|
227 | element = element || this.element.find("div.output"); | |
217 | var toinsert = $("<div/>").addClass("output_area output_png"); |
|
228 | var toinsert = $("<div/>").addClass("output_area output_png"); | |
218 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); |
|
229 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); | |
219 | element.append(toinsert); |
|
230 | element.append(toinsert); | |
220 | return element; |
|
231 | return element; | |
221 | }; |
|
232 | }; | |
222 |
|
233 | |||
223 |
|
234 | |||
224 | CodeCell.prototype.append_latex = function (latex, element) { |
|
235 | CodeCell.prototype.append_latex = function (latex, element) { | |
225 | // This method cannot do the typesetting because the latex first has to |
|
236 | // This method cannot do the typesetting because the latex first has to | |
226 | // be on the page. |
|
237 | // be on the page. | |
227 | element = element || this.element.find("div.output"); |
|
238 | element = element || this.element.find("div.output"); | |
228 | var toinsert = $("<div/>").addClass("output_area output_latex"); |
|
239 | var toinsert = $("<div/>").addClass("output_area output_latex"); | |
229 | toinsert.append(latex); |
|
240 | toinsert.append(latex); | |
230 | element.append(toinsert); |
|
241 | element.append(toinsert); | |
231 | return element; |
|
242 | return element; | |
232 | } |
|
243 | } | |
233 |
|
244 | |||
234 |
|
245 | |||
235 | CodeCell.prototype.clear_output = function () { |
|
246 | CodeCell.prototype.clear_output = function () { | |
236 | this.element.find("div.output").html(""); |
|
247 | this.element.find("div.output").html(""); | |
237 | }; |
|
248 | }; | |
238 |
|
249 | |||
239 |
|
250 | |||
240 | CodeCell.prototype.clear_input = function () { |
|
251 | CodeCell.prototype.clear_input = function () { | |
241 | this.code_mirror.setValue(''); |
|
252 | this.code_mirror.setValue(''); | |
242 | }; |
|
253 | }; | |
243 |
|
254 | |||
244 |
|
255 | |||
245 | CodeCell.prototype.collapse = function () { |
|
256 | CodeCell.prototype.collapse = function () { | |
246 | this.element.find('div.output').hide(); |
|
257 | this.element.find('div.output').hide(); | |
247 | }; |
|
258 | }; | |
248 |
|
259 | |||
249 |
|
260 | |||
250 | CodeCell.prototype.expand = function () { |
|
261 | CodeCell.prototype.expand = function () { | |
251 | this.element.find('div.output').show(); |
|
262 | this.element.find('div.output').show(); | |
252 | }; |
|
263 | }; | |
253 |
|
264 | |||
254 |
|
265 | |||
255 | CodeCell.prototype.set_input_prompt = function (number) { |
|
266 | CodeCell.prototype.set_input_prompt = function (number) { | |
256 | var n = number || ' '; |
|
267 | var n = number || ' '; | |
257 | this.input_prompt_number = n |
|
268 | this.input_prompt_number = n | |
258 | this.element.find('div.input_prompt').html('In [' + n + ']:'); |
|
269 | this.element.find('div.input_prompt').html('In [' + n + ']:'); | |
259 | }; |
|
270 | }; | |
260 |
|
271 | |||
261 |
|
272 | |||
262 | CodeCell.prototype.get_code = function () { |
|
273 | CodeCell.prototype.get_code = function () { | |
263 | return this.code_mirror.getValue(); |
|
274 | return this.code_mirror.getValue(); | |
264 | }; |
|
275 | }; | |
265 |
|
276 | |||
266 |
|
277 | |||
267 | CodeCell.prototype.set_code = function (code) { |
|
278 | CodeCell.prototype.set_code = function (code) { | |
268 | return this.code_mirror.setValue(code); |
|
279 | return this.code_mirror.setValue(code); | |
269 | }; |
|
280 | }; | |
270 |
|
281 | |||
271 |
|
282 | |||
272 | CodeCell.prototype.at_top = function () { |
|
283 | CodeCell.prototype.at_top = function () { | |
273 | var cursor = this.code_mirror.getCursor(); |
|
284 | var cursor = this.code_mirror.getCursor(); | |
274 | if (cursor.line === 0) { |
|
285 | if (cursor.line === 0) { | |
275 | return true; |
|
286 | return true; | |
276 | } else { |
|
287 | } else { | |
277 | return false; |
|
288 | return false; | |
278 | } |
|
289 | } | |
279 | }; |
|
290 | }; | |
280 |
|
291 | |||
281 |
|
292 | |||
282 | CodeCell.prototype.at_bottom = function () { |
|
293 | CodeCell.prototype.at_bottom = function () { | |
283 | var cursor = this.code_mirror.getCursor(); |
|
294 | var cursor = this.code_mirror.getCursor(); | |
284 | if (cursor.line === (this.code_mirror.lineCount()-1)) { |
|
295 | if (cursor.line === (this.code_mirror.lineCount()-1)) { | |
285 | return true; |
|
296 | return true; | |
286 | } else { |
|
297 | } else { | |
287 | return false; |
|
298 | return false; | |
288 | } |
|
299 | } | |
289 | }; |
|
300 | }; | |
290 |
|
301 | |||
291 |
|
302 | |||
292 | CodeCell.prototype.fromJSON = function (data) { |
|
303 | CodeCell.prototype.fromJSON = function (data) { | |
293 | if (data.cell_type === 'code') { |
|
304 | if (data.cell_type === 'code') { | |
294 | this.set_code(data.code); |
|
305 | this.set_code(data.code); | |
295 | this.set_input_prompt(data.prompt_number); |
|
306 | this.set_input_prompt(data.prompt_number); | |
296 | }; |
|
307 | }; | |
297 | }; |
|
308 | }; | |
298 |
|
309 | |||
299 |
|
310 | |||
300 | CodeCell.prototype.toJSON = function () { |
|
311 | CodeCell.prototype.toJSON = function () { | |
301 | return { |
|
312 | return { | |
302 | code : this.get_code(), |
|
313 | code : this.get_code(), | |
303 | cell_type : 'code', |
|
314 | cell_type : 'code', | |
304 | prompt_number : this.input_prompt_number |
|
315 | prompt_number : this.input_prompt_number | |
305 | }; |
|
316 | }; | |
306 | }; |
|
317 | }; | |
307 |
|
318 | |||
308 | IPython.CodeCell = CodeCell; |
|
319 | IPython.CodeCell = CodeCell; | |
309 |
|
320 | |||
310 | return IPython; |
|
321 | return IPython; | |
311 | }(IPython)); |
|
322 | }(IPython)); | |
312 |
|
323 |
General Comments 0
You need to be logged in to leave comments.
Login now