Show More
@@ -29,7 +29,7 b' time, mark, audio, video {' | |||||
29 | margin: 0; |
|
29 | margin: 0; | |
30 | padding: 0; |
|
30 | padding: 0; | |
31 | border: 0; |
|
31 | border: 0; | |
32 |
|
|
32 | /* font-size: 100%;*/ | |
33 | font: inherit; |
|
33 | font: inherit; | |
34 | vertical-align: baseline; |
|
34 | vertical-align: baseline; | |
35 | } |
|
35 | } | |
@@ -62,12 +62,16 b' input, select { vertical-align: middle; }' | |||||
62 | en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */ |
|
62 | en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */ | |
63 | pre, code, kbd, samp { font-family: monospace, sans-serif; } |
|
63 | pre, code, kbd, samp { font-family: monospace, sans-serif; } | |
64 |
|
64 | |||
65 |
|
65 | pre { | ||
|
66 | text-align: left; | |||
|
67 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; | |||
|
68 | font-size: 12pt; | |||
|
69 | } | |||
66 |
|
70 | |||
67 | body { |
|
71 | body { | |
68 | background-color: white; |
|
72 | background-color: white; | |
69 | font-size: 11pt; |
|
73 | /* This won't propagate to all children so we also set it below */ | |
70 |
|
74 | font-size: 12pt; | ||
71 | /* This makes sure that the body covers the entire window and needs to |
|
75 | /* This makes sure that the body covers the entire window and needs to | |
72 | be in a different element than the display: box in wrapper below */ |
|
76 | be in a different element than the display: box in wrapper below */ | |
73 | position: absolute; |
|
77 | position: absolute; | |
@@ -79,12 +83,11 b' body {' | |||||
79 |
|
83 | |||
80 | div#wrapper { |
|
84 | div#wrapper { | |
81 | display: box; |
|
85 | display: box; | |
82 | box-orient: vertical; |
|
|||
83 |
|
||||
84 | display: -webkit-box; |
|
86 | display: -webkit-box; | |
85 | -webkit-box-orient: vertical; |
|
|||
86 |
|
||||
87 | display: -moz-box; |
|
87 | display: -moz-box; | |
|
88 | ||||
|
89 | box-orient: vertical; | |||
|
90 | -webkit-box-orient: vertical; | |||
88 | -moz-box-orient: vertical; |
|
91 | -moz-box-orient: vertical; | |
89 |
|
92 | |||
90 | /* This is needed to make sure the wrapper fills the body */ |
|
93 | /* This is needed to make sure the wrapper fills the body */ | |
@@ -104,7 +107,7 b' span#ipython_notebook h1 {' | |||||
104 | } |
|
107 | } | |
105 |
|
108 | |||
106 | div#tools { |
|
109 | div#tools { | |
107 |
font-size: 1 |
|
110 | font-size: 11pt; | |
108 | } |
|
111 | } | |
109 |
|
112 | |||
110 | span#kernel_status { |
|
113 | span#kernel_status { | |
@@ -134,9 +137,8 b' div.notebook {' | |||||
134 | overflow-y: auto; |
|
137 | overflow-y: auto; | |
135 | overflow-x: hidden; |
|
138 | overflow-x: hidden; | |
136 | padding: 5px; |
|
139 | padding: 5px; | |
137 | /* padding-top: 5px;*/ |
|
|||
138 | /* padding-bottom: 5px;*/ |
|
|||
139 | background-color: white; |
|
140 | background-color: white; | |
|
141 | font-size: 12pt; | |||
140 |
|
142 | |||
141 | /* Allow the notebook div to take up the rest of the vertical space */ |
|
143 | /* Allow the notebook div to take up the rest of the vertical space */ | |
142 | box-flex: 1; |
|
144 | box-flex: 1; | |
@@ -152,10 +154,18 b' div.cell {' | |||||
152 | width: 100%; |
|
154 | width: 100%; | |
153 | padding: 5px; |
|
155 | padding: 5px; | |
154 | position: relative; |
|
156 | position: relative; | |
155 | display: table; |
|
157 | ||
156 | box-sizing: border-box; |
|
158 | box-sizing: border-box; | |
157 | -moz-box-sizing: border-box; |
|
159 | -moz-box-sizing: border-box; | |
158 | -webkit-box-sizing: border-box; |
|
160 | -webkit-box-sizing: border-box; | |
|
161 | ||||
|
162 | display: box; | |||
|
163 | display: -webkit-box; | |||
|
164 | display: -moz-box; | |||
|
165 | ||||
|
166 | box-orient: vertical; | |||
|
167 | -webkit-box-orient: vertical; | |||
|
168 | -moz-box-orient: vertical; | |||
159 | } |
|
169 | } | |
160 |
|
170 | |||
161 | div.code_cell { |
|
171 | div.code_cell { | |
@@ -163,24 +173,19 b' div.code_cell {' | |||||
163 | } |
|
173 | } | |
164 |
|
174 | |||
165 | div.prompt { |
|
175 | div.prompt { | |
166 | vertical-align: top; |
|
176 | width: 90px; | |
167 | display: table-cell; |
|
|||
168 | width: 80px; |
|
|||
169 | padding: 0px; |
|
177 | padding: 0px; | |
170 | margin: 0px; |
|
178 | margin: 0px; | |
171 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; |
|
179 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; | |
172 | font-weight: normal; |
|
|||
173 | font-style: normal; |
|
|||
174 | } |
|
180 | } | |
175 |
|
181 | |||
176 | div.input { |
|
182 | div.input { | |
177 | display: box; |
|
183 | display: box; | |
178 | box-orient: horizontal; |
|
|||
179 |
|
||||
180 | display: -webkit-box; |
|
184 | display: -webkit-box; | |
181 | -webkit-box-orient: horizontal; |
|
|||
182 |
|
||||
183 | display: -moz-box; |
|
185 | display: -moz-box; | |
|
186 | ||||
|
187 | box-orient: horizontal; | |||
|
188 | -webkit-box-orient: horizontal; | |||
184 | -moz-box-orient: horizontal; |
|
189 | -moz-box-orient: horizontal; | |
185 | } |
|
190 | } | |
186 |
|
191 | |||
@@ -192,6 +197,7 b' div.input_area {' | |||||
192 | box-flex: 1; |
|
197 | box-flex: 1; | |
193 | -webkit-box-flex: 1; |
|
198 | -webkit-box-flex: 1; | |
194 | -moz-box-flex: 1; |
|
199 | -moz-box-flex: 1; | |
|
200 | ||||
195 | box-sizing: border-box; |
|
201 | box-sizing: border-box; | |
196 | -moz-box-sizing: border-box; |
|
202 | -moz-box-sizing: border-box; | |
197 | -webkit-box-sizing: border-box; |
|
203 | -webkit-box-sizing: border-box; | |
@@ -201,9 +207,8 b' textarea.input_textarea {' | |||||
201 | width: 100%; |
|
207 | width: 100%; | |
202 | text-align: left; |
|
208 | text-align: left; | |
203 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; |
|
209 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; | |
204 |
font-size: |
|
210 | font-size: 12pt; | |
205 | border-style: none; |
|
211 | border-style: none; | |
206 | display: table-cell; |
|
|||
207 | padding: 0px; |
|
212 | padding: 0px; | |
208 | margin: 0px; |
|
213 | margin: 0px; | |
209 | overflow: auto; |
|
214 | overflow: auto; | |
@@ -213,12 +218,21 b' textarea.input_textarea {' | |||||
213 |
|
218 | |||
214 | div.output { |
|
219 | div.output { | |
215 | display: box; |
|
220 | display: box; | |
216 | box-orient: horizontal; |
|
|||
217 |
|
||||
218 | display: -webkit-box; |
|
221 | display: -webkit-box; | |
219 | -webkit-box-orient: horizontal; |
|
222 | display: -moz-box; | |
220 |
|
223 | |||
|
224 | box-orient: vertical; | |||
|
225 | -webkit-box-orient: vertical; | |||
|
226 | -moz-box-orient: vertical; | |||
|
227 | } | |||
|
228 | ||||
|
229 | div.output_pyout { | |||
|
230 | display: box; | |||
|
231 | display: -webkit-box; | |||
221 | display: -moz-box; |
|
232 | display: -moz-box; | |
|
233 | ||||
|
234 | box-orient: horizontal; | |||
|
235 | -webkit-box-orient: horizontal; | |||
222 | -moz-box-orient: horizontal; |
|
236 | -moz-box-orient: horizontal; | |
223 | } |
|
237 | } | |
224 |
|
238 | |||
@@ -228,8 +242,19 b' div.output_prompt {' | |||||
228 |
|
242 | |||
229 | div.output_area { |
|
243 | div.output_area { | |
230 | text-align: left; |
|
244 | text-align: left; | |
|
245 | color: black; | |||
231 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; |
|
246 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; | |
232 | display: table-cell; |
|
247 | font-size: 12pt; | |
|
248 | } | |||
|
249 | ||||
|
250 | div.output_latex { | |||
|
251 | font-size: 13pt; | |||
|
252 | } | |||
|
253 | ||||
|
254 | .box_flex1 { | |||
|
255 | box-flex: 1; | |||
|
256 | -webkit-box-flex: 1; | |||
|
257 | -moz-box-flex: 1; | |||
233 | } |
|
258 | } | |
234 |
|
259 | |||
235 | div.text_cell { |
|
260 | div.text_cell { | |
@@ -237,8 +262,10 b' div.text_cell {' | |||||
237 | } |
|
262 | } | |
238 |
|
263 | |||
239 | textarea.text_cell_input { |
|
264 | textarea.text_cell_input { | |
240 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
265 | font-family: Monaco, Consolas, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; | |
241 | font-size: 12pt; |
|
266 | /* font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;*/ | |
|
267 | /* Slightly bigger than the rest of the notebook */ | |||
|
268 | font-size: 13pt; | |||
242 | outline: none; |
|
269 | outline: none; | |
243 | resize: none; |
|
270 | resize: none; | |
244 | width: inherit; |
|
271 | width: inherit; | |
@@ -250,7 +277,8 b' textarea.text_cell_input {' | |||||
250 |
|
277 | |||
251 | div.text_cell_render { |
|
278 | div.text_cell_render { | |
252 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
279 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
253 | font-size: 12pt; |
|
280 | /* Slightly bigger than the rest of the notebook */ | |
|
281 | font-size: 13pt; | |||
254 | outline: none; |
|
282 | outline: none; | |
255 | resize: none; |
|
283 | resize: none; | |
256 | width: inherit; |
|
284 | width: inherit; |
@@ -103,7 +103,6 b' Notebook.prototype.bind_events = function () {' | |||||
103 | if (cell instanceof CodeCell) { |
|
103 | if (cell instanceof CodeCell) { | |
104 | event.preventDefault(); |
|
104 | event.preventDefault(); | |
105 | cell.clear_output(); |
|
105 | cell.clear_output(); | |
106 | cell.hide_output_prompt(); |
|
|||
107 | var code = cell.get_code(); |
|
106 | var code = cell.get_code(); | |
108 | if (that.notebook_load_re.test(code)) { |
|
107 | if (that.notebook_load_re.test(code)) { | |
109 | var code_parts = code.split(' '); |
|
108 | var code_parts = code.split(' '); | |
@@ -442,7 +441,7 b' Notebook.prototype._kernel_started = function () {' | |||||
442 | var msg_type = reply.msg_type; |
|
441 | var msg_type = reply.msg_type; | |
443 | var cell = that.cell_for_msg(reply.parent_header.msg_id); |
|
442 | var cell = that.cell_for_msg(reply.parent_header.msg_id); | |
444 | if (msg_type === "execute_reply") { |
|
443 | if (msg_type === "execute_reply") { | |
445 | cell.set_prompt(reply.content.execution_count); |
|
444 | cell.set_input_prompt(reply.content.execution_count); | |
446 | }; |
|
445 | }; | |
447 | }; |
|
446 | }; | |
448 |
|
447 | |||
@@ -454,10 +453,12 b' Notebook.prototype._kernel_started = function () {' | |||||
454 | if (msg_type === "stream") { |
|
453 | if (msg_type === "stream") { | |
455 | cell.expand(); |
|
454 | cell.expand(); | |
456 | cell.append_stream(reply.content.data + "\n"); |
|
455 | cell.append_stream(reply.content.data + "\n"); | |
457 |
} else if (msg_type === |
|
456 | } else if (msg_type === "display_data") { | |
458 | cell.show_output_prompt(); |
|
|||
459 | cell.expand(); |
|
457 | cell.expand(); | |
460 | cell.append_display_data(reply.content.data); |
|
458 | cell.append_display_data(reply.content.data); | |
|
459 | } else if (msg_type === "pyout") { | |||
|
460 | cell.expand(); | |||
|
461 | cell.append_pyout(reply.content.data, reply.content.execution_count) | |||
461 | } else if (msg_type === "status") { |
|
462 | } else if (msg_type === "status") { | |
462 | if (reply.content.execution_state === "busy") { |
|
463 | if (reply.content.execution_state === "busy") { | |
463 | that.kernel.status_busy(); |
|
464 | that.kernel.status_busy(); | |
@@ -469,11 +470,6 b' Notebook.prototype._kernel_started = function () {' | |||||
469 | }; |
|
470 | }; | |
470 |
|
471 | |||
471 |
|
472 | |||
472 | Notebook.prototype._handle_execute_reply = function (reply, cell) { |
|
|||
473 | cell.set_prompt(reply.content.execution_count); |
|
|||
474 | }; |
|
|||
475 |
|
||||
476 |
|
||||
477 | // Persistance and loading |
|
473 | // Persistance and loading | |
478 |
|
474 | |||
479 |
|
475 | |||
@@ -624,7 +620,6 b' Cell.prototype.create_element = function () {};' | |||||
624 | var CodeCell = function (notebook) { |
|
620 | var CodeCell = function (notebook) { | |
625 | Cell.apply(this, arguments); |
|
621 | Cell.apply(this, arguments); | |
626 | this.input_prompt_number = ' '; |
|
622 | this.input_prompt_number = ' '; | |
627 | this.output_prompt_number = ' '; |
|
|||
628 | }; |
|
623 | }; | |
629 |
|
624 | |||
630 |
|
625 | |||
@@ -638,46 +633,77 b' CodeCell.prototype.create_element = function () {' | |||||
638 | var input_textarea = $('<textarea/>').addClass('input_textarea').attr('rows',1).attr('wrap','hard').autogrow(); |
|
633 | var input_textarea = $('<textarea/>').addClass('input_textarea').attr('rows',1).attr('wrap','hard').autogrow(); | |
639 | input.append($('<div/>').addClass('input_area').append(input_textarea)); |
|
634 | input.append($('<div/>').addClass('input_area').append(input_textarea)); | |
640 | var output = $('<div></div>').addClass('output'); |
|
635 | var output = $('<div></div>').addClass('output'); | |
641 | output.append($('<div/>').addClass('prompt output_prompt')); |
|
|||
642 | output.append($('<div/>').addClass('output_area')); |
|
|||
643 | cell.append(input).append(output); |
|
636 | cell.append(input).append(output); | |
644 | this.element = cell; |
|
637 | this.element = cell; | |
645 | this.collapse() |
|
638 | this.collapse() | |
646 | }; |
|
639 | }; | |
647 |
|
640 | |||
648 |
|
641 | |||
649 |
CodeCell.prototype.append_ |
|
642 | CodeCell.prototype.append_pyout = function (data, n) { | |
650 | var data_list = data.split("\n"); |
|
643 | var toinsert = $("<div/>").addClass("output_area output_pyout"); | |
651 | console.log(data_list); |
|
644 | toinsert.append($('<div/>'). | |
652 | if (data_list.length > 0) { |
|
645 | addClass('prompt output_prompt'). | |
653 | for (var i=0; i<data_list.length; i++) { |
|
646 | html('Out[' + n + ']:') | |
654 | console.log(i, data_list[i]); |
|
647 | ); | |
655 | var toinsert = $("<div/>"). |
|
648 | this.append_display_data(data, toinsert); | |
656 | append( |
|
649 | toinsert.children().last().addClass("box_flex1"); | |
657 | $("<pre/>").append(fixConsole(data_list[i])) |
|
650 | this.element.find("div.output").append(toinsert); | |
658 | ); |
|
651 | // If we just output latex, typeset it. | |
659 | this.element.find("div.output_area").append(toinsert); |
|
652 | if (data["text/latex"] !== undefined) { | |
660 | }; |
|
653 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
661 | } |
|
654 | }; | |
662 | }; |
|
655 | }; | |
663 |
|
656 | |||
664 |
|
657 | |||
665 | CodeCell.prototype.append_display_data = function (data) { |
|
658 | CodeCell.prototype.append_display_data = function (data, element) { | |
666 |
if (data[" |
|
659 | if (data["text/latex"] !== undefined) { | |
667 |
this.append_ |
|
660 | this.append_latex(data["text/latex"], element); | |
|
661 | // If it is undefined, then we just appended to div.output, which | |||
|
662 | // makes the latex visible and we can typeset it. The typesetting | |||
|
663 | // has to be done after the latex is on the page. | |||
|
664 | if (element === undefined) { | |||
|
665 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |||
|
666 | }; | |||
|
667 | } else if (data["image/svg+xml"] !== undefined) { | |||
|
668 | this.append_svg(data["image/svg+xml"], element); | |||
668 | } else if (data["text/plain"] !== undefined) { |
|
669 | } else if (data["text/plain"] !== undefined) { | |
669 |
|
|
670 | this.append_stream(data["text/plain"], element); | |
670 | this.append_stream(data["text/plain"]); |
|
|||
671 | }; |
|
671 | }; | |
|
672 | return element; | |||
672 | }; |
|
673 | }; | |
673 |
|
674 | |||
674 | CodeCell.prototype.append_svg = function (svg) { |
|
675 | ||
675 | this.element.find("div.output_area").append(svg); |
|
676 | CodeCell.prototype.append_stream = function (data, element) { | |
|
677 | element = element || this.element.find("div.output"); | |||
|
678 | var toinsert = $("<div/>").addClass("output_area output_stream"); | |||
|
679 | toinsert.append($("<pre/>").html(fixConsole(data))); | |||
|
680 | element.append(toinsert); | |||
|
681 | return element; | |||
676 | }; |
|
682 | }; | |
677 |
|
683 | |||
678 |
|
684 | |||
|
685 | CodeCell.prototype.append_svg = function (svg, element) { | |||
|
686 | element = element || this.element.find("div.output"); | |||
|
687 | var toinsert = $("<div/>").addClass("output_area output_svg"); | |||
|
688 | toinsert.append(svg); | |||
|
689 | element.append(toinsert); | |||
|
690 | return element; | |||
|
691 | }; | |||
|
692 | ||||
|
693 | ||||
|
694 | CodeCell.prototype.append_latex = function (latex, element) { | |||
|
695 | // This method cannot do the typesetting because the latex first has to | |||
|
696 | // be on the page. | |||
|
697 | element = element || this.element.find("div.output"); | |||
|
698 | var toinsert = $("<div/>").addClass("output_area output_latex"); | |||
|
699 | toinsert.append(latex); | |||
|
700 | element.append(toinsert); | |||
|
701 | return element; | |||
|
702 | } | |||
|
703 | ||||
|
704 | ||||
679 | CodeCell.prototype.clear_output = function () { |
|
705 | CodeCell.prototype.clear_output = function () { | |
680 |
this.element.find("div.output |
|
706 | this.element.find("div.output").html(""); | |
681 | }; |
|
707 | }; | |
682 |
|
708 | |||
683 |
|
709 | |||
@@ -691,11 +717,6 b' CodeCell.prototype.expand = function () {' | |||||
691 | }; |
|
717 | }; | |
692 |
|
718 | |||
693 |
|
719 | |||
694 | CodeCell.prototype.set_prompt = function (number) { |
|
|||
695 | this.set_input_prompt(number); |
|
|||
696 | this.set_output_prompt(number); |
|
|||
697 | }; |
|
|||
698 |
|
||||
699 | CodeCell.prototype.set_input_prompt = function (number) { |
|
720 | CodeCell.prototype.set_input_prompt = function (number) { | |
700 | var n = number || ' '; |
|
721 | var n = number || ' '; | |
701 | this.input_prompt_number = n |
|
722 | this.input_prompt_number = n | |
@@ -703,23 +724,6 b' CodeCell.prototype.set_input_prompt = function (number) {' | |||||
703 | }; |
|
724 | }; | |
704 |
|
725 | |||
705 |
|
726 | |||
706 | CodeCell.prototype.set_output_prompt = function (number) { |
|
|||
707 | var n = number || ' '; |
|
|||
708 | this.output_prompt_number = n |
|
|||
709 | this.element.find('div.output_prompt').html('Out[' + n + ']:'); |
|
|||
710 | }; |
|
|||
711 |
|
||||
712 |
|
||||
713 | CodeCell.prototype.hide_output_prompt = function () { |
|
|||
714 | this.element.find('div.output_prompt').hide(); |
|
|||
715 | }; |
|
|||
716 |
|
||||
717 |
|
||||
718 | CodeCell.prototype.show_output_prompt = function () { |
|
|||
719 | this.element.find('div.output_prompt').show(); |
|
|||
720 | }; |
|
|||
721 |
|
||||
722 |
|
||||
723 | CodeCell.prototype.get_code = function () { |
|
727 | CodeCell.prototype.get_code = function () { | |
724 | return this.element.find("textarea.input_textarea").val(); |
|
728 | return this.element.find("textarea.input_textarea").val(); | |
725 | }; |
|
729 | }; | |
@@ -962,7 +966,8 b' $(document).ready(function () {' | |||||
962 | tex2jax: { |
|
966 | tex2jax: { | |
963 | inlineMath: [ ['$','$'], ["\\(","\\)"] ], |
|
967 | inlineMath: [ ['$','$'], ["\\(","\\)"] ], | |
964 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ], |
|
968 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ], | |
965 | } |
|
969 | }, | |
|
970 | displayAlign: 'left' // Change this to 'center' to center equations. | |||
966 | }); |
|
971 | }); | |
967 |
|
972 | |||
968 | IPYTHON.notebook = new Notebook('div.notebook'); |
|
973 | IPYTHON.notebook = new Notebook('div.notebook'); |
General Comments 0
You need to be logged in to leave comments.
Login now