Show More
@@ -1,90 +1,91 b'' | |||||
1 |
|
1 | |||
2 | //============================================================================ |
|
2 | //============================================================================ | |
3 | // Cell |
|
3 | // Cell | |
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 Cell = function (notebook) { |
|
10 | var Cell = function (notebook) { | |
11 | this.notebook = notebook; |
|
11 | this.notebook = notebook; | |
12 | this.selected = false; |
|
12 | this.selected = false; | |
13 | this.element; |
|
13 | this.element = null; | |
14 | this.create_element(); |
|
14 | this.create_element(); | |
15 |
if (this.element !== |
|
15 | if (this.element !== null) { | |
|
16 | this.set_autoindent(true); | |||
16 | this.element.data("cell", this); |
|
17 | this.element.data("cell", this); | |
17 | this.bind_events(); |
|
18 | this.bind_events(); | |
18 | } |
|
19 | } | |
19 | this.cell_id = utils.uuid(); |
|
20 | this.cell_id = utils.uuid(); | |
20 | }; |
|
21 | }; | |
21 |
|
22 | |||
22 |
|
23 | |||
23 | Cell.prototype.select = function () { |
|
24 | Cell.prototype.select = function () { | |
24 | this.element.addClass('ui-widget-content ui-corner-all'); |
|
25 | this.element.addClass('ui-widget-content ui-corner-all'); | |
25 | this.selected = true; |
|
26 | this.selected = true; | |
26 | // TODO: we need to test across browsers to see if both of these are needed. |
|
27 | // TODO: we need to test across browsers to see if both of these are needed. | |
27 | // In the meantime, there should not be any harm in having them both. |
|
28 | // In the meantime, there should not be any harm in having them both. | |
28 | this.element.find('textarea').trigger('focusin'); |
|
29 | this.element.find('textarea').trigger('focusin'); | |
29 | this.element.find('textarea').trigger('focus'); |
|
30 | this.element.find('textarea').trigger('focus'); | |
30 | }; |
|
31 | }; | |
31 |
|
32 | |||
32 |
|
33 | |||
33 | Cell.prototype.unselect = function () { |
|
34 | Cell.prototype.unselect = function () { | |
34 | this.element.removeClass('ui-widget-content ui-corner-all'); |
|
35 | this.element.removeClass('ui-widget-content ui-corner-all'); | |
35 | this.selected = false; |
|
36 | this.selected = false; | |
36 | }; |
|
37 | }; | |
37 |
|
38 | |||
38 |
|
39 | |||
39 | Cell.prototype.bind_events = function () { |
|
40 | Cell.prototype.bind_events = function () { | |
40 | var that = this; |
|
41 | var that = this; | |
41 | var nb = that.notebook |
|
42 | var nb = that.notebook | |
42 | that.element.click(function (event) { |
|
43 | that.element.click(function (event) { | |
43 | if (that.selected === false) { |
|
44 | if (that.selected === false) { | |
44 | nb.select(nb.find_cell_index(that)); |
|
45 | nb.select(nb.find_cell_index(that)); | |
45 | }; |
|
46 | }; | |
46 | }); |
|
47 | }); | |
47 | that.element.focusin(function (event) { |
|
48 | that.element.focusin(function (event) { | |
48 | if (that.selected === false) { |
|
49 | if (that.selected === false) { | |
49 | nb.select(nb.find_cell_index(that)); |
|
50 | nb.select(nb.find_cell_index(that)); | |
50 | }; |
|
51 | }; | |
51 | }); |
|
52 | }); | |
52 | }; |
|
53 | }; | |
53 |
|
54 | |||
54 | Cell.prototype.grow = function(element) { |
|
55 | Cell.prototype.grow = function(element) { | |
55 | // Grow the cell by hand. This is used upon reloading from JSON, when the |
|
56 | // Grow the cell by hand. This is used upon reloading from JSON, when the | |
56 | // autogrow handler is not called. |
|
57 | // autogrow handler is not called. | |
57 | var dom = element.get(0); |
|
58 | var dom = element.get(0); | |
58 | var lines_count = 0; |
|
59 | var lines_count = 0; | |
59 | // modified split rule from |
|
60 | // modified split rule from | |
60 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 |
|
61 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 | |
61 | var lines = dom.value.split(/\r|\r\n|\n/); |
|
62 | var lines = dom.value.split(/\r|\r\n|\n/); | |
62 | lines_count = lines.length; |
|
63 | lines_count = lines.length; | |
63 | if (lines_count >= 1) { |
|
64 | if (lines_count >= 1) { | |
64 | dom.rows = lines_count; |
|
65 | dom.rows = lines_count; | |
65 | } else { |
|
66 | } else { | |
66 | dom.rows = 1; |
|
67 | dom.rows = 1; | |
67 | } |
|
68 | } | |
68 | }; |
|
69 | }; | |
69 |
|
70 | |||
70 |
|
71 | |||
71 | Cell.prototype.set_autoindent = function (state) { |
|
72 | Cell.prototype.set_autoindent = function (state) { | |
72 | if (state) { |
|
73 | if (state) { | |
73 | this.code_mirror.setOption('tabMode', 'indent'); |
|
74 | this.code_mirror.setOption('tabMode', 'indent'); | |
74 | this.code_mirror.setOption('enterMode', 'indent'); |
|
75 | this.code_mirror.setOption('enterMode', 'indent'); | |
75 | } else { |
|
76 | } else { | |
76 | this.code_mirror.setOption('tabMode', 'shift'); |
|
77 | this.code_mirror.setOption('tabMode', 'shift'); | |
77 | this.code_mirror.setOption('enterMode', 'flat'); |
|
78 | this.code_mirror.setOption('enterMode', 'flat'); | |
78 | } |
|
79 | } | |
79 | }; |
|
80 | }; | |
80 |
|
81 | |||
81 |
|
82 | |||
82 | // Subclasses must implement create_element. |
|
83 | // Subclasses must implement create_element. | |
83 | Cell.prototype.create_element = function () {}; |
|
84 | Cell.prototype.create_element = function () {}; | |
84 |
|
85 | |||
85 | IPython.Cell = Cell; |
|
86 | IPython.Cell = Cell; | |
86 |
|
87 | |||
87 | return IPython; |
|
88 | return IPython; | |
88 |
|
89 | |||
89 | }(IPython)); |
|
90 | }(IPython)); | |
90 |
|
91 |
@@ -1,410 +1,409 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 | this.outputs = []; |
|
15 | this.outputs = []; | |
16 | IPython.Cell.apply(this, arguments); |
|
16 | IPython.Cell.apply(this, arguments); | |
17 | }; |
|
17 | }; | |
18 |
|
18 | |||
19 |
|
19 | |||
20 | CodeCell.prototype = new IPython.Cell(); |
|
20 | CodeCell.prototype = new IPython.Cell(); | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | CodeCell.prototype.create_element = function () { |
|
23 | CodeCell.prototype.create_element = function () { | |
24 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox'); |
|
24 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox'); | |
25 | var input = $('<div></div>').addClass('input hbox'); |
|
25 | var input = $('<div></div>').addClass('input hbox'); | |
26 | input.append($('<div/>').addClass('prompt input_prompt')); |
|
26 | input.append($('<div/>').addClass('prompt input_prompt')); | |
27 | var input_area = $('<div/>').addClass('input_area box-flex1'); |
|
27 | var input_area = $('<div/>').addClass('input_area box-flex1'); | |
28 | this.code_mirror = CodeMirror(input_area.get(0), { |
|
28 | this.code_mirror = CodeMirror(input_area.get(0), { | |
29 | indentUnit : 4, |
|
29 | indentUnit : 4, | |
30 | enterMode : 'flat', |
|
|||
31 | tabMode: 'shift', |
|
|||
32 | mode: 'python', |
|
30 | mode: 'python', | |
33 | theme: 'ipython', |
|
31 | theme: 'ipython', | |
34 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) |
|
32 | onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) | |
35 | }); |
|
33 | }); | |
36 | input.append(input_area); |
|
34 | input.append(input_area); | |
37 | var output = $('<div></div>').addClass('output vbox'); |
|
35 | var output = $('<div></div>').addClass('output vbox'); | |
38 | cell.append(input).append(output); |
|
36 | cell.append(input).append(output); | |
39 | this.element = cell; |
|
37 | this.element = cell; | |
40 | this.collapse() |
|
38 | this.collapse() | |
41 | }; |
|
39 | }; | |
42 |
|
40 | |||
43 |
|
41 | |||
44 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { |
|
42 | CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { | |
45 | // This method gets called in CodeMirror's onKeyDown/onKeyPress handlers and |
|
43 | // This method gets called in CodeMirror's onKeyDown/onKeyPress handlers and | |
46 | // is used to provide custom key handling. Its return value is used to determine |
|
44 | // is used to provide custom key handling. Its return value is used to determine | |
47 | // if CodeMirror should ignore the event: true = ignore, false = don't ignore. |
|
45 | // if CodeMirror should ignore the event: true = ignore, false = don't ignore. | |
48 | if (event.keyCode === 13 && event.shiftKey) { |
|
46 | if (event.keyCode === 13 && event.shiftKey) { | |
49 | // Always ignore shift-enter in CodeMirror as we handle it. |
|
47 | // Always ignore shift-enter in CodeMirror as we handle it. | |
50 | return true; |
|
48 | return true; | |
51 | } else if (event.keyCode === 9) { |
|
49 | } else if (event.keyCode === 9) { | |
52 | var cur = editor.getCursor(); |
|
50 | var cur = editor.getCursor(); | |
53 | 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(); | |
54 | if (pre_cursor === "") { |
|
52 | if (pre_cursor === "") { | |
55 | // 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. | |
56 | // In this case, let CodeMirror handle indentation. |
|
54 | // In this case, let CodeMirror handle indentation. | |
57 | return false; |
|
55 | return false; | |
58 | } else { |
|
56 | } else { | |
59 | // Autocomplete the current line. |
|
57 | // Autocomplete the current line. | |
60 | event.stop(); |
|
58 | event.stop(); | |
61 | var line = editor.getLine(cur.line); |
|
59 | var line = editor.getLine(cur.line); | |
62 | this.is_completing = true; |
|
60 | this.is_completing = true; | |
63 | this.completion_cursor = cur; |
|
61 | this.completion_cursor = cur; | |
64 | IPython.notebook.complete_cell(this, line, cur.ch); |
|
62 | IPython.notebook.complete_cell(this, line, cur.ch); | |
65 | return true; |
|
63 | return true; | |
66 | } |
|
64 | } | |
67 | } else if (event.keyCode === 8) { |
|
65 | } else if (event.keyCode === 8 && event.type == 'keydown') { | |
|
66 | console.log(event); | |||
68 | // If backspace and the line ends with 4 spaces, remove them. |
|
67 | // If backspace and the line ends with 4 spaces, remove them. | |
69 | var cur = editor.getCursor(); |
|
68 | var cur = editor.getCursor(); | |
70 | var line = editor.getLine(cur.line); |
|
69 | var line = editor.getLine(cur.line); | |
71 | var ending = line.slice(-4); |
|
70 | var ending = line.slice(-4); | |
72 | if (ending === ' ') { |
|
71 | if (ending === ' ') { | |
73 | editor.replaceRange('', |
|
72 | editor.replaceRange('', | |
74 | {line: cur.line, ch: cur.ch-4}, |
|
73 | {line: cur.line, ch: cur.ch-4}, | |
75 | {line: cur.line, ch: cur.ch} |
|
74 | {line: cur.line, ch: cur.ch} | |
76 | ); |
|
75 | ); | |
77 | event.stop(); |
|
76 | event.stop(); | |
78 | return true; |
|
77 | return true; | |
79 | } else { |
|
78 | } else { | |
80 | return false; |
|
79 | return false; | |
81 | }; |
|
80 | }; | |
82 | } else { |
|
81 | } else { | |
83 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { |
|
82 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { | |
84 | this.is_completing = false; |
|
83 | this.is_completing = false; | |
85 | this.completion_cursor = null; |
|
84 | this.completion_cursor = null; | |
86 | } |
|
85 | } | |
87 | return false; |
|
86 | return false; | |
88 | }; |
|
87 | }; | |
89 | }; |
|
88 | }; | |
90 |
|
89 | |||
91 |
|
90 | |||
92 | CodeCell.prototype.finish_completing = function (matched_text, matches) { |
|
91 | CodeCell.prototype.finish_completing = function (matched_text, matches) { | |
93 | if (!this.is_completing || matches.length === 0) {return;} |
|
92 | if (!this.is_completing || matches.length === 0) {return;} | |
94 | // console.log("Got matches", matched_text, matches); |
|
93 | // console.log("Got matches", matched_text, matches); | |
95 |
|
94 | |||
96 | var that = this; |
|
95 | var that = this; | |
97 | var cur = this.completion_cursor; |
|
96 | var cur = this.completion_cursor; | |
98 | var complete = $('<div/>').addClass('completions'); |
|
97 | var complete = $('<div/>').addClass('completions'); | |
99 | var select = $('<select/>').attr('multiple','true'); |
|
98 | var select = $('<select/>').attr('multiple','true'); | |
100 | for (var i=0; i<matches.length; ++i) { |
|
99 | for (var i=0; i<matches.length; ++i) { | |
101 | select.append($('<option/>').text(matches[i])); |
|
100 | select.append($('<option/>').text(matches[i])); | |
102 | } |
|
101 | } | |
103 | select.children().first().attr('selected','true'); |
|
102 | select.children().first().attr('selected','true'); | |
104 | select.attr('size',Math.min(10,matches.length)); |
|
103 | select.attr('size',Math.min(10,matches.length)); | |
105 | var pos = this.code_mirror.cursorCoords(); |
|
104 | var pos = this.code_mirror.cursorCoords(); | |
106 | complete.css('left',pos.x+'px'); |
|
105 | complete.css('left',pos.x+'px'); | |
107 | complete.css('top',pos.yBot+'px'); |
|
106 | complete.css('top',pos.yBot+'px'); | |
108 | complete.append(select); |
|
107 | complete.append(select); | |
109 |
|
108 | |||
110 | $('body').append(complete); |
|
109 | $('body').append(complete); | |
111 | var done = false; |
|
110 | var done = false; | |
112 |
|
111 | |||
113 | var insert = function (selected_text) { |
|
112 | var insert = function (selected_text) { | |
114 | that.code_mirror.replaceRange( |
|
113 | that.code_mirror.replaceRange( | |
115 | selected_text, |
|
114 | selected_text, | |
116 | {line: cur.line, ch: (cur.ch-matched_text.length)}, |
|
115 | {line: cur.line, ch: (cur.ch-matched_text.length)}, | |
117 | {line: cur.line, ch: cur.ch} |
|
116 | {line: cur.line, ch: cur.ch} | |
118 | ); |
|
117 | ); | |
119 | }; |
|
118 | }; | |
120 |
|
119 | |||
121 | var close = function () { |
|
120 | var close = function () { | |
122 | if (done) return; |
|
121 | if (done) return; | |
123 | done = true; |
|
122 | done = true; | |
124 | complete.remove(); |
|
123 | complete.remove(); | |
125 | that.is_completing = false; |
|
124 | that.is_completing = false; | |
126 | that.completion_cursor = null; |
|
125 | that.completion_cursor = null; | |
127 | }; |
|
126 | }; | |
128 |
|
127 | |||
129 | var pick = function () { |
|
128 | var pick = function () { | |
130 | insert(select.val()[0]); |
|
129 | insert(select.val()[0]); | |
131 | close(); |
|
130 | close(); | |
132 | setTimeout(function(){that.code_mirror.focus();}, 50); |
|
131 | setTimeout(function(){that.code_mirror.focus();}, 50); | |
133 | }; |
|
132 | }; | |
134 |
|
133 | |||
135 | select.blur(close); |
|
134 | select.blur(close); | |
136 | select.keydown(function (event) { |
|
135 | select.keydown(function (event) { | |
137 | var code = event.which; |
|
136 | var code = event.which; | |
138 | if (code === 13 || code === 32) { |
|
137 | if (code === 13 || code === 32) { | |
139 | // Pressing SPACE or ENTER will cause a pick |
|
138 | // Pressing SPACE or ENTER will cause a pick | |
140 | event.stopPropagation(); |
|
139 | event.stopPropagation(); | |
141 | event.preventDefault(); |
|
140 | event.preventDefault(); | |
142 | pick(); |
|
141 | pick(); | |
143 | } else if (code === 38 || code === 40) { |
|
142 | } else if (code === 38 || code === 40) { | |
144 | // We don't want the document keydown handler to handle UP/DOWN, |
|
143 | // We don't want the document keydown handler to handle UP/DOWN, | |
145 | // but we want the default action. |
|
144 | // but we want the default action. | |
146 | event.stopPropagation(); |
|
145 | event.stopPropagation(); | |
147 | } else { |
|
146 | } else { | |
148 | // All other key presses simple exit completion. |
|
147 | // All other key presses simple exit completion. | |
149 | event.stopPropagation(); |
|
148 | event.stopPropagation(); | |
150 | event.preventDefault(); |
|
149 | event.preventDefault(); | |
151 | close(); |
|
150 | close(); | |
152 | that.code_mirror.focus(); |
|
151 | that.code_mirror.focus(); | |
153 | } |
|
152 | } | |
154 | }); |
|
153 | }); | |
155 | // Double click also causes a pick. |
|
154 | // Double click also causes a pick. | |
156 | select.dblclick(pick); |
|
155 | select.dblclick(pick); | |
157 | select.focus(); |
|
156 | select.focus(); | |
158 | }; |
|
157 | }; | |
159 |
|
158 | |||
160 |
|
159 | |||
161 | CodeCell.prototype.select = function () { |
|
160 | CodeCell.prototype.select = function () { | |
162 | IPython.Cell.prototype.select.apply(this); |
|
161 | IPython.Cell.prototype.select.apply(this); | |
163 | // Todo: this dance is needed because as of CodeMirror 2.12, focus is |
|
162 | // Todo: this dance is needed because as of CodeMirror 2.12, focus is | |
164 | // not causing the cursor to blink if the editor is empty initially. |
|
163 | // not causing the cursor to blink if the editor is empty initially. | |
165 | // While this seems to fix the issue, this should be fixed |
|
164 | // While this seems to fix the issue, this should be fixed | |
166 | // in CodeMirror proper. |
|
165 | // in CodeMirror proper. | |
167 | var s = this.code_mirror.getValue(); |
|
166 | var s = this.code_mirror.getValue(); | |
168 | if (s === '') this.code_mirror.setValue('.'); |
|
167 | if (s === '') this.code_mirror.setValue('.'); | |
169 | this.code_mirror.focus(); |
|
168 | this.code_mirror.focus(); | |
170 | if (s === '') this.code_mirror.setValue(''); |
|
169 | if (s === '') this.code_mirror.setValue(''); | |
171 | }; |
|
170 | }; | |
172 |
|
171 | |||
173 |
|
172 | |||
174 | CodeCell.prototype.append_output = function (json) { |
|
173 | CodeCell.prototype.append_output = function (json) { | |
175 | this.expand(); |
|
174 | this.expand(); | |
176 | if (json.output_type === 'pyout') { |
|
175 | if (json.output_type === 'pyout') { | |
177 | this.append_pyout(json); |
|
176 | this.append_pyout(json); | |
178 | } else if (json.output_type === 'pyerr') { |
|
177 | } else if (json.output_type === 'pyerr') { | |
179 | this.append_pyerr(json); |
|
178 | this.append_pyerr(json); | |
180 | } else if (json.output_type === 'display_data') { |
|
179 | } else if (json.output_type === 'display_data') { | |
181 | this.append_display_data(json); |
|
180 | this.append_display_data(json); | |
182 | } else if (json.output_type === 'stream') { |
|
181 | } else if (json.output_type === 'stream') { | |
183 | this.append_stream(json); |
|
182 | this.append_stream(json); | |
184 | }; |
|
183 | }; | |
185 | this.outputs.push(json); |
|
184 | this.outputs.push(json); | |
186 | }; |
|
185 | }; | |
187 |
|
186 | |||
188 |
|
187 | |||
189 | CodeCell.prototype.append_pyout = function (json) { |
|
188 | CodeCell.prototype.append_pyout = function (json) { | |
190 | n = json.prompt_number || ' '; |
|
189 | n = json.prompt_number || ' '; | |
191 | var toinsert = $("<div/>").addClass("output_area output_pyout hbox"); |
|
190 | var toinsert = $("<div/>").addClass("output_area output_pyout hbox"); | |
192 | toinsert.append($('<div/>'). |
|
191 | toinsert.append($('<div/>'). | |
193 | addClass('prompt output_prompt'). |
|
192 | addClass('prompt output_prompt'). | |
194 | html('Out[' + n + ']:') |
|
193 | html('Out[' + n + ']:') | |
195 | ); |
|
194 | ); | |
196 | this.append_mime_type(json, toinsert); |
|
195 | this.append_mime_type(json, toinsert); | |
197 | toinsert.children().last().addClass("box_flex1"); |
|
196 | toinsert.children().last().addClass("box_flex1"); | |
198 | this.element.find("div.output").append(toinsert); |
|
197 | this.element.find("div.output").append(toinsert); | |
199 | // If we just output latex, typeset it. |
|
198 | // If we just output latex, typeset it. | |
200 | if (json.latex !== undefined) { |
|
199 | if (json.latex !== undefined) { | |
201 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
200 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
202 | }; |
|
201 | }; | |
203 | }; |
|
202 | }; | |
204 |
|
203 | |||
205 |
|
204 | |||
206 | CodeCell.prototype.append_pyerr = function (json) { |
|
205 | CodeCell.prototype.append_pyerr = function (json) { | |
207 | var tb = json.traceback; |
|
206 | var tb = json.traceback; | |
208 | if (tb !== undefined) { |
|
207 | if (tb !== undefined) { | |
209 | var s = ''; |
|
208 | var s = ''; | |
210 | var len = tb.length; |
|
209 | var len = tb.length; | |
211 | for (var i=0; i<len; i++) { |
|
210 | for (var i=0; i<len; i++) { | |
212 | s = s + tb[i] + '\n'; |
|
211 | s = s + tb[i] + '\n'; | |
213 | } |
|
212 | } | |
214 | s = s + '\n'; |
|
213 | s = s + '\n'; | |
215 | this.append_text(s); |
|
214 | this.append_text(s); | |
216 | }; |
|
215 | }; | |
217 | }; |
|
216 | }; | |
218 |
|
217 | |||
219 |
|
218 | |||
220 | CodeCell.prototype.append_stream = function (json) { |
|
219 | CodeCell.prototype.append_stream = function (json) { | |
221 | this.append_text(json.text); |
|
220 | this.append_text(json.text); | |
222 | }; |
|
221 | }; | |
223 |
|
222 | |||
224 |
|
223 | |||
225 | CodeCell.prototype.append_display_data = function (json) { |
|
224 | CodeCell.prototype.append_display_data = function (json) { | |
226 | this.append_mime_type(json); |
|
225 | this.append_mime_type(json); | |
227 | }; |
|
226 | }; | |
228 |
|
227 | |||
229 |
|
228 | |||
230 | CodeCell.prototype.append_mime_type = function (json, element) { |
|
229 | CodeCell.prototype.append_mime_type = function (json, element) { | |
231 | if (json.html !== undefined) { |
|
230 | if (json.html !== undefined) { | |
232 | this.append_html(json.html, element); |
|
231 | this.append_html(json.html, element); | |
233 | } else if (json.latex !== undefined) { |
|
232 | } else if (json.latex !== undefined) { | |
234 | this.append_latex(json.latex, element); |
|
233 | this.append_latex(json.latex, element); | |
235 | // If it is undefined, then we just appended to div.output, which |
|
234 | // If it is undefined, then we just appended to div.output, which | |
236 | // makes the latex visible and we can typeset it. The typesetting |
|
235 | // makes the latex visible and we can typeset it. The typesetting | |
237 | // has to be done after the latex is on the page. |
|
236 | // has to be done after the latex is on the page. | |
238 | if (element === undefined) { |
|
237 | if (element === undefined) { | |
239 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
238 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
240 | }; |
|
239 | }; | |
241 | } else if (json.svg !== undefined) { |
|
240 | } else if (json.svg !== undefined) { | |
242 | this.append_svg(json.svg, element); |
|
241 | this.append_svg(json.svg, element); | |
243 | } else if (json.png !== undefined) { |
|
242 | } else if (json.png !== undefined) { | |
244 | this.append_png(json.png, element); |
|
243 | this.append_png(json.png, element); | |
245 | } else if (json.jpeg !== undefined) { |
|
244 | } else if (json.jpeg !== undefined) { | |
246 | this.append_jpeg(json.jpeg, element); |
|
245 | this.append_jpeg(json.jpeg, element); | |
247 | } else if (json.text !== undefined) { |
|
246 | } else if (json.text !== undefined) { | |
248 | this.append_text(json.text, element); |
|
247 | this.append_text(json.text, element); | |
249 | }; |
|
248 | }; | |
250 | return element; |
|
249 | return element; | |
251 | }; |
|
250 | }; | |
252 |
|
251 | |||
253 |
|
252 | |||
254 | CodeCell.prototype.append_html = function (html, element) { |
|
253 | CodeCell.prototype.append_html = function (html, element) { | |
255 | element = element || this.element.find("div.output"); |
|
254 | element = element || this.element.find("div.output"); | |
256 | var toinsert = $("<div/>").addClass("output_area output_html"); |
|
255 | var toinsert = $("<div/>").addClass("output_area output_html"); | |
257 | toinsert.append(html); |
|
256 | toinsert.append(html); | |
258 | element.append(toinsert); |
|
257 | element.append(toinsert); | |
259 | return element; |
|
258 | return element; | |
260 | } |
|
259 | } | |
261 |
|
260 | |||
262 |
|
261 | |||
263 | CodeCell.prototype.append_text = function (data, element) { |
|
262 | CodeCell.prototype.append_text = function (data, element) { | |
264 | element = element || this.element.find("div.output"); |
|
263 | element = element || this.element.find("div.output"); | |
265 | var toinsert = $("<div/>").addClass("output_area output_stream"); |
|
264 | var toinsert = $("<div/>").addClass("output_area output_stream"); | |
266 | toinsert.append($("<pre/>").html(utils.fixConsole(data))); |
|
265 | toinsert.append($("<pre/>").html(utils.fixConsole(data))); | |
267 | element.append(toinsert); |
|
266 | element.append(toinsert); | |
268 | return element; |
|
267 | return element; | |
269 | }; |
|
268 | }; | |
270 |
|
269 | |||
271 |
|
270 | |||
272 | CodeCell.prototype.append_svg = function (svg, element) { |
|
271 | CodeCell.prototype.append_svg = function (svg, element) { | |
273 | element = element || this.element.find("div.output"); |
|
272 | element = element || this.element.find("div.output"); | |
274 | var toinsert = $("<div/>").addClass("output_area output_svg"); |
|
273 | var toinsert = $("<div/>").addClass("output_area output_svg"); | |
275 | toinsert.append(svg); |
|
274 | toinsert.append(svg); | |
276 | element.append(toinsert); |
|
275 | element.append(toinsert); | |
277 | return element; |
|
276 | return element; | |
278 | }; |
|
277 | }; | |
279 |
|
278 | |||
280 |
|
279 | |||
281 | CodeCell.prototype.append_png = function (png, element) { |
|
280 | CodeCell.prototype.append_png = function (png, element) { | |
282 | element = element || this.element.find("div.output"); |
|
281 | element = element || this.element.find("div.output"); | |
283 | var toinsert = $("<div/>").addClass("output_area output_png"); |
|
282 | var toinsert = $("<div/>").addClass("output_area output_png"); | |
284 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); |
|
283 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); | |
285 | element.append(toinsert); |
|
284 | element.append(toinsert); | |
286 | return element; |
|
285 | return element; | |
287 | }; |
|
286 | }; | |
288 |
|
287 | |||
289 |
|
288 | |||
290 | CodeCell.prototype.append_jpeg = function (jpeg, element) { |
|
289 | CodeCell.prototype.append_jpeg = function (jpeg, element) { | |
291 | element = element || this.element.find("div.output"); |
|
290 | element = element || this.element.find("div.output"); | |
292 | var toinsert = $("<div/>").addClass("output_area output_jpeg"); |
|
291 | var toinsert = $("<div/>").addClass("output_area output_jpeg"); | |
293 | toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg)); |
|
292 | toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg)); | |
294 | element.append(toinsert); |
|
293 | element.append(toinsert); | |
295 | return element; |
|
294 | return element; | |
296 | }; |
|
295 | }; | |
297 |
|
296 | |||
298 |
|
297 | |||
299 | CodeCell.prototype.append_latex = function (latex, element) { |
|
298 | CodeCell.prototype.append_latex = function (latex, element) { | |
300 | // This method cannot do the typesetting because the latex first has to |
|
299 | // This method cannot do the typesetting because the latex first has to | |
301 | // be on the page. |
|
300 | // be on the page. | |
302 | element = element || this.element.find("div.output"); |
|
301 | element = element || this.element.find("div.output"); | |
303 | var toinsert = $("<div/>").addClass("output_area output_latex"); |
|
302 | var toinsert = $("<div/>").addClass("output_area output_latex"); | |
304 | toinsert.append(latex); |
|
303 | toinsert.append(latex); | |
305 | element.append(toinsert); |
|
304 | element.append(toinsert); | |
306 | return element; |
|
305 | return element; | |
307 | } |
|
306 | } | |
308 |
|
307 | |||
309 |
|
308 | |||
310 | CodeCell.prototype.clear_output = function () { |
|
309 | CodeCell.prototype.clear_output = function () { | |
311 | this.element.find("div.output").html(""); |
|
310 | this.element.find("div.output").html(""); | |
312 | this.outputs = []; |
|
311 | this.outputs = []; | |
313 | }; |
|
312 | }; | |
314 |
|
313 | |||
315 |
|
314 | |||
316 | CodeCell.prototype.clear_input = function () { |
|
315 | CodeCell.prototype.clear_input = function () { | |
317 | this.code_mirror.setValue(''); |
|
316 | this.code_mirror.setValue(''); | |
318 | }; |
|
317 | }; | |
319 |
|
318 | |||
320 |
|
319 | |||
321 | CodeCell.prototype.collapse = function () { |
|
320 | CodeCell.prototype.collapse = function () { | |
322 | this.element.find('div.output').hide(); |
|
321 | this.element.find('div.output').hide(); | |
323 | }; |
|
322 | }; | |
324 |
|
323 | |||
325 |
|
324 | |||
326 | CodeCell.prototype.expand = function () { |
|
325 | CodeCell.prototype.expand = function () { | |
327 | this.element.find('div.output').show(); |
|
326 | this.element.find('div.output').show(); | |
328 | }; |
|
327 | }; | |
329 |
|
328 | |||
330 |
|
329 | |||
331 | CodeCell.prototype.set_input_prompt = function (number) { |
|
330 | CodeCell.prototype.set_input_prompt = function (number) { | |
332 | var n = number || ' '; |
|
331 | var n = number || ' '; | |
333 | this.input_prompt_number = n |
|
332 | this.input_prompt_number = n | |
334 | this.element.find('div.input_prompt').html('In [' + n + ']:'); |
|
333 | this.element.find('div.input_prompt').html('In [' + n + ']:'); | |
335 | }; |
|
334 | }; | |
336 |
|
335 | |||
337 |
|
336 | |||
338 | CodeCell.prototype.get_code = function () { |
|
337 | CodeCell.prototype.get_code = function () { | |
339 | return this.code_mirror.getValue(); |
|
338 | return this.code_mirror.getValue(); | |
340 | }; |
|
339 | }; | |
341 |
|
340 | |||
342 |
|
341 | |||
343 | CodeCell.prototype.set_code = function (code) { |
|
342 | CodeCell.prototype.set_code = function (code) { | |
344 | return this.code_mirror.setValue(code); |
|
343 | return this.code_mirror.setValue(code); | |
345 | }; |
|
344 | }; | |
346 |
|
345 | |||
347 |
|
346 | |||
348 | CodeCell.prototype.at_top = function () { |
|
347 | CodeCell.prototype.at_top = function () { | |
349 | var cursor = this.code_mirror.getCursor(); |
|
348 | var cursor = this.code_mirror.getCursor(); | |
350 | if (cursor.line === 0) { |
|
349 | if (cursor.line === 0) { | |
351 | return true; |
|
350 | return true; | |
352 | } else { |
|
351 | } else { | |
353 | return false; |
|
352 | return false; | |
354 | } |
|
353 | } | |
355 | }; |
|
354 | }; | |
356 |
|
355 | |||
357 |
|
356 | |||
358 | CodeCell.prototype.at_bottom = function () { |
|
357 | CodeCell.prototype.at_bottom = function () { | |
359 | var cursor = this.code_mirror.getCursor(); |
|
358 | var cursor = this.code_mirror.getCursor(); | |
360 | if (cursor.line === (this.code_mirror.lineCount()-1)) { |
|
359 | if (cursor.line === (this.code_mirror.lineCount()-1)) { | |
361 | return true; |
|
360 | return true; | |
362 | } else { |
|
361 | } else { | |
363 | return false; |
|
362 | return false; | |
364 | } |
|
363 | } | |
365 | }; |
|
364 | }; | |
366 |
|
365 | |||
367 |
|
366 | |||
368 | CodeCell.prototype.fromJSON = function (data) { |
|
367 | CodeCell.prototype.fromJSON = function (data) { | |
369 | // console.log('Import from JSON:', data); |
|
368 | // console.log('Import from JSON:', data); | |
370 | if (data.cell_type === 'code') { |
|
369 | if (data.cell_type === 'code') { | |
371 | if (data.input !== undefined) { |
|
370 | if (data.input !== undefined) { | |
372 | this.set_code(data.input); |
|
371 | this.set_code(data.input); | |
373 | } |
|
372 | } | |
374 | if (data.prompt_number !== undefined) { |
|
373 | if (data.prompt_number !== undefined) { | |
375 | this.set_input_prompt(data.prompt_number); |
|
374 | this.set_input_prompt(data.prompt_number); | |
376 | } else { |
|
375 | } else { | |
377 | this.set_input_prompt(); |
|
376 | this.set_input_prompt(); | |
378 | }; |
|
377 | }; | |
379 | var len = data.outputs.length; |
|
378 | var len = data.outputs.length; | |
380 | for (var i=0; i<len; i++) { |
|
379 | for (var i=0; i<len; i++) { | |
381 | this.append_output(data.outputs[i]); |
|
380 | this.append_output(data.outputs[i]); | |
382 | }; |
|
381 | }; | |
383 | }; |
|
382 | }; | |
384 | }; |
|
383 | }; | |
385 |
|
384 | |||
386 |
|
385 | |||
387 | CodeCell.prototype.toJSON = function () { |
|
386 | CodeCell.prototype.toJSON = function () { | |
388 | var data = {}; |
|
387 | var data = {}; | |
389 | data.input = this.get_code(); |
|
388 | data.input = this.get_code(); | |
390 | data.cell_type = 'code'; |
|
389 | data.cell_type = 'code'; | |
391 | if (this.input_prompt_number !== ' ') { |
|
390 | if (this.input_prompt_number !== ' ') { | |
392 | data.prompt_number = this.input_prompt_number |
|
391 | data.prompt_number = this.input_prompt_number | |
393 | }; |
|
392 | }; | |
394 | var outputs = []; |
|
393 | var outputs = []; | |
395 | var len = this.outputs.length; |
|
394 | var len = this.outputs.length; | |
396 | for (var i=0; i<len; i++) { |
|
395 | for (var i=0; i<len; i++) { | |
397 | outputs[i] = this.outputs[i]; |
|
396 | outputs[i] = this.outputs[i]; | |
398 | }; |
|
397 | }; | |
399 | data.outputs = outputs; |
|
398 | data.outputs = outputs; | |
400 | data.language = 'python'; |
|
399 | data.language = 'python'; | |
401 | // console.log('Export to JSON:',data); |
|
400 | // console.log('Export to JSON:',data); | |
402 | return data; |
|
401 | return data; | |
403 | }; |
|
402 | }; | |
404 |
|
403 | |||
405 |
|
404 | |||
406 | IPython.CodeCell = CodeCell; |
|
405 | IPython.CodeCell = CodeCell; | |
407 |
|
406 | |||
408 | return IPython; |
|
407 | return IPython; | |
409 | }(IPython)); |
|
408 | }(IPython)); | |
410 |
|
409 |
@@ -1,252 +1,250 b'' | |||||
1 |
|
1 | |||
2 | //============================================================================ |
|
2 | //============================================================================ | |
3 | // TextCell |
|
3 | // TextCell | |
4 | //============================================================================ |
|
4 | //============================================================================ | |
5 |
|
5 | |||
6 | var IPython = (function (IPython) { |
|
6 | var IPython = (function (IPython) { | |
7 |
|
7 | |||
8 | // TextCell base class |
|
8 | // TextCell base class | |
9 |
|
9 | |||
10 | var TextCell = function (notebook) { |
|
10 | var TextCell = function (notebook) { | |
11 | this.code_mirror_mode = this.code_mirror_mode || 'htmlmixed'; |
|
11 | this.code_mirror_mode = this.code_mirror_mode || 'htmlmixed'; | |
12 | this.placeholder = this.placeholder || ''; |
|
12 | this.placeholder = this.placeholder || ''; | |
13 | IPython.Cell.apply(this, arguments); |
|
13 | IPython.Cell.apply(this, arguments); | |
14 | this.rendered = false; |
|
14 | this.rendered = false; | |
15 | this.cell_type = this.cell_type || 'text'; |
|
15 | this.cell_type = this.cell_type || 'text'; | |
16 | }; |
|
16 | }; | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | TextCell.prototype = new IPython.Cell(); |
|
19 | TextCell.prototype = new IPython.Cell(); | |
20 |
|
20 | |||
21 |
|
21 | |||
22 | TextCell.prototype.create_element = function () { |
|
22 | TextCell.prototype.create_element = function () { | |
23 | var cell = $("<div>").addClass('cell text_cell border-box-sizing'); |
|
23 | var cell = $("<div>").addClass('cell text_cell border-box-sizing'); | |
24 | var input_area = $('<div/>').addClass('text_cell_input'); |
|
24 | var input_area = $('<div/>').addClass('text_cell_input'); | |
25 | this.code_mirror = CodeMirror(input_area.get(0), { |
|
25 | this.code_mirror = CodeMirror(input_area.get(0), { | |
26 | indentUnit : 4, |
|
26 | indentUnit : 4, | |
27 | enterMode : 'flat', |
|
|||
28 | tabMode: 'shift', |
|
|||
29 | mode: this.code_mirror_mode, |
|
27 | mode: this.code_mirror_mode, | |
30 | theme: 'default', |
|
28 | theme: 'default', | |
31 | value: this.placeholder |
|
29 | value: this.placeholder | |
32 | }); |
|
30 | }); | |
33 | // The tabindex=-1 makes this div focusable. |
|
31 | // The tabindex=-1 makes this div focusable. | |
34 | var render_area = $('<div/>').addClass('text_cell_render'). |
|
32 | var render_area = $('<div/>').addClass('text_cell_render'). | |
35 | addClass('rendered_html').attr('tabindex','-1'); |
|
33 | addClass('rendered_html').attr('tabindex','-1'); | |
36 | cell.append(input_area).append(render_area); |
|
34 | cell.append(input_area).append(render_area); | |
37 | this.element = cell; |
|
35 | this.element = cell; | |
38 | }; |
|
36 | }; | |
39 |
|
37 | |||
40 |
|
38 | |||
41 | TextCell.prototype.bind_events = function () { |
|
39 | TextCell.prototype.bind_events = function () { | |
42 | IPython.Cell.prototype.bind_events.apply(this); |
|
40 | IPython.Cell.prototype.bind_events.apply(this); | |
43 | var that = this; |
|
41 | var that = this; | |
44 | this.element.keydown(function (event) { |
|
42 | this.element.keydown(function (event) { | |
45 | if (event.which === 13) { |
|
43 | if (event.which === 13) { | |
46 | if (that.rendered) { |
|
44 | if (that.rendered) { | |
47 | that.edit(); |
|
45 | that.edit(); | |
48 | event.preventDefault(); |
|
46 | event.preventDefault(); | |
49 | }; |
|
47 | }; | |
50 | }; |
|
48 | }; | |
51 | }); |
|
49 | }); | |
52 | }; |
|
50 | }; | |
53 |
|
51 | |||
54 |
|
52 | |||
55 | TextCell.prototype.select = function () { |
|
53 | TextCell.prototype.select = function () { | |
56 | IPython.Cell.prototype.select.apply(this); |
|
54 | IPython.Cell.prototype.select.apply(this); | |
57 | var output = this.element.find("div.text_cell_render"); |
|
55 | var output = this.element.find("div.text_cell_render"); | |
58 | output.trigger('focus'); |
|
56 | output.trigger('focus'); | |
59 | }; |
|
57 | }; | |
60 |
|
58 | |||
61 |
|
59 | |||
62 | TextCell.prototype.edit = function () { |
|
60 | TextCell.prototype.edit = function () { | |
63 | if (this.rendered === true) { |
|
61 | if (this.rendered === true) { | |
64 | var text_cell = this.element; |
|
62 | var text_cell = this.element; | |
65 | var output = text_cell.find("div.text_cell_render"); |
|
63 | var output = text_cell.find("div.text_cell_render"); | |
66 | output.hide(); |
|
64 | output.hide(); | |
67 | text_cell.find('div.text_cell_input').show(); |
|
65 | text_cell.find('div.text_cell_input').show(); | |
68 | this.code_mirror.focus(); |
|
66 | this.code_mirror.focus(); | |
69 | this.code_mirror.refresh(); |
|
67 | this.code_mirror.refresh(); | |
70 | this.rendered = false; |
|
68 | this.rendered = false; | |
71 | }; |
|
69 | }; | |
72 | }; |
|
70 | }; | |
73 |
|
71 | |||
74 |
|
72 | |||
75 | // Subclasses must define render. |
|
73 | // Subclasses must define render. | |
76 | TextCell.prototype.render = function () {}; |
|
74 | TextCell.prototype.render = function () {}; | |
77 |
|
75 | |||
78 |
|
76 | |||
79 | TextCell.prototype.config_mathjax = function () { |
|
77 | TextCell.prototype.config_mathjax = function () { | |
80 | var text_cell = this.element; |
|
78 | var text_cell = this.element; | |
81 | var that = this; |
|
79 | var that = this; | |
82 | text_cell.click(function () { |
|
80 | text_cell.click(function () { | |
83 | that.edit(); |
|
81 | that.edit(); | |
84 | }).focusout(function () { |
|
82 | }).focusout(function () { | |
85 | that.render(); |
|
83 | that.render(); | |
86 | }); |
|
84 | }); | |
87 |
|
85 | |||
88 | text_cell.trigger("focusout"); |
|
86 | text_cell.trigger("focusout"); | |
89 | }; |
|
87 | }; | |
90 |
|
88 | |||
91 |
|
89 | |||
92 | TextCell.prototype.get_source = function() { |
|
90 | TextCell.prototype.get_source = function() { | |
93 | return this.code_mirror.getValue(); |
|
91 | return this.code_mirror.getValue(); | |
94 | }; |
|
92 | }; | |
95 |
|
93 | |||
96 |
|
94 | |||
97 | TextCell.prototype.set_source = function(text) { |
|
95 | TextCell.prototype.set_source = function(text) { | |
98 | this.code_mirror.setValue(text); |
|
96 | this.code_mirror.setValue(text); | |
99 | this.code_mirror.refresh(); |
|
97 | this.code_mirror.refresh(); | |
100 | }; |
|
98 | }; | |
101 |
|
99 | |||
102 |
|
100 | |||
103 | TextCell.prototype.get_rendered = function() { |
|
101 | TextCell.prototype.get_rendered = function() { | |
104 | return this.element.find('div.text_cell_render').html(); |
|
102 | return this.element.find('div.text_cell_render').html(); | |
105 | }; |
|
103 | }; | |
106 |
|
104 | |||
107 |
|
105 | |||
108 | TextCell.prototype.set_rendered = function(text) { |
|
106 | TextCell.prototype.set_rendered = function(text) { | |
109 | this.element.find('div.text_cell_render').html(text); |
|
107 | this.element.find('div.text_cell_render').html(text); | |
110 | }; |
|
108 | }; | |
111 |
|
109 | |||
112 |
|
110 | |||
113 | TextCell.prototype.at_top = function () { |
|
111 | TextCell.prototype.at_top = function () { | |
114 | if (this.rendered) { |
|
112 | if (this.rendered) { | |
115 | return true; |
|
113 | return true; | |
116 | } else { |
|
114 | } else { | |
117 | return false; |
|
115 | return false; | |
118 | } |
|
116 | } | |
119 | }; |
|
117 | }; | |
120 |
|
118 | |||
121 |
|
119 | |||
122 | TextCell.prototype.at_bottom = function () { |
|
120 | TextCell.prototype.at_bottom = function () { | |
123 | if (this.rendered) { |
|
121 | if (this.rendered) { | |
124 | return true; |
|
122 | return true; | |
125 | } else { |
|
123 | } else { | |
126 | return false; |
|
124 | return false; | |
127 | } |
|
125 | } | |
128 | }; |
|
126 | }; | |
129 |
|
127 | |||
130 |
|
128 | |||
131 | TextCell.prototype.fromJSON = function (data) { |
|
129 | TextCell.prototype.fromJSON = function (data) { | |
132 | console.log(data); |
|
130 | console.log(data); | |
133 | if (data.cell_type === this.cell_type) { |
|
131 | if (data.cell_type === this.cell_type) { | |
134 | if (data.source !== undefined) { |
|
132 | if (data.source !== undefined) { | |
135 | this.set_source(data.source); |
|
133 | this.set_source(data.source); | |
136 | this.set_rendered(data.rendered || ''); |
|
134 | this.set_rendered(data.rendered || ''); | |
137 | this.rendered = false; |
|
135 | this.rendered = false; | |
138 | this.render(); |
|
136 | this.render(); | |
139 | }; |
|
137 | }; | |
140 | }; |
|
138 | }; | |
141 | }; |
|
139 | }; | |
142 |
|
140 | |||
143 |
|
141 | |||
144 | TextCell.prototype.toJSON = function () { |
|
142 | TextCell.prototype.toJSON = function () { | |
145 | var data = {} |
|
143 | var data = {} | |
146 | data.cell_type = this.cell_type; |
|
144 | data.cell_type = this.cell_type; | |
147 | data.source = this.get_source(); |
|
145 | data.source = this.get_source(); | |
148 | data.rendered = this.get_rendered(); |
|
146 | data.rendered = this.get_rendered(); | |
149 | return data; |
|
147 | return data; | |
150 | }; |
|
148 | }; | |
151 |
|
149 | |||
152 |
|
150 | |||
153 | // HTMLCell |
|
151 | // HTMLCell | |
154 |
|
152 | |||
155 | var HTMLCell = function (notebook) { |
|
153 | var HTMLCell = function (notebook) { | |
156 | this.placeholder = "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$"; |
|
154 | this.placeholder = "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$"; | |
157 | IPython.TextCell.apply(this, arguments); |
|
155 | IPython.TextCell.apply(this, arguments); | |
158 | this.cell_type = 'html'; |
|
156 | this.cell_type = 'html'; | |
159 | }; |
|
157 | }; | |
160 |
|
158 | |||
161 |
|
159 | |||
162 | HTMLCell.prototype = new TextCell(); |
|
160 | HTMLCell.prototype = new TextCell(); | |
163 |
|
161 | |||
164 |
|
162 | |||
165 | HTMLCell.prototype.render = function () { |
|
163 | HTMLCell.prototype.render = function () { | |
166 | if (this.rendered === false) { |
|
164 | if (this.rendered === false) { | |
167 | var text = this.get_source(); |
|
165 | var text = this.get_source(); | |
168 | if (text === "") {text = this.placeholder;}; |
|
166 | if (text === "") {text = this.placeholder;}; | |
169 | this.set_rendered(text); |
|
167 | this.set_rendered(text); | |
170 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
168 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
171 | this.element.find('div.text_cell_input').hide(); |
|
169 | this.element.find('div.text_cell_input').hide(); | |
172 | this.element.find("div.text_cell_render").show(); |
|
170 | this.element.find("div.text_cell_render").show(); | |
173 | this.rendered = true; |
|
171 | this.rendered = true; | |
174 | }; |
|
172 | }; | |
175 | }; |
|
173 | }; | |
176 |
|
174 | |||
177 |
|
175 | |||
178 | // MarkdownCell |
|
176 | // MarkdownCell | |
179 |
|
177 | |||
180 | var MarkdownCell = function (notebook) { |
|
178 | var MarkdownCell = function (notebook) { | |
181 | this.placeholder = "Type *Markdown* and LaTeX: $\\alpha^2$"; |
|
179 | this.placeholder = "Type *Markdown* and LaTeX: $\\alpha^2$"; | |
182 | IPython.TextCell.apply(this, arguments); |
|
180 | IPython.TextCell.apply(this, arguments); | |
183 | this.cell_type = 'markdown'; |
|
181 | this.cell_type = 'markdown'; | |
184 | }; |
|
182 | }; | |
185 |
|
183 | |||
186 |
|
184 | |||
187 | MarkdownCell.prototype = new TextCell(); |
|
185 | MarkdownCell.prototype = new TextCell(); | |
188 |
|
186 | |||
189 |
|
187 | |||
190 | MarkdownCell.prototype.render = function () { |
|
188 | MarkdownCell.prototype.render = function () { | |
191 | if (this.rendered === false) { |
|
189 | if (this.rendered === false) { | |
192 | var text = this.get_source(); |
|
190 | var text = this.get_source(); | |
193 | if (text === "") {text = this.placeholder;}; |
|
191 | if (text === "") {text = this.placeholder;}; | |
194 | var html = IPython.markdown_converter.makeHtml(text); |
|
192 | var html = IPython.markdown_converter.makeHtml(text); | |
195 | this.set_rendered(html); |
|
193 | this.set_rendered(html); | |
196 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
194 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
197 | this.element.find('div.text_cell_input').hide(); |
|
195 | this.element.find('div.text_cell_input').hide(); | |
198 | this.element.find("div.text_cell_render").show(); |
|
196 | this.element.find("div.text_cell_render").show(); | |
199 | this.rendered = true; |
|
197 | this.rendered = true; | |
200 | }; |
|
198 | }; | |
201 | }; |
|
199 | }; | |
202 |
|
200 | |||
203 |
|
201 | |||
204 | // RSTCell |
|
202 | // RSTCell | |
205 |
|
203 | |||
206 | var RSTCell = function (notebook) { |
|
204 | var RSTCell = function (notebook) { | |
207 | this.placeholder = "Type *ReStructured Text* and LaTeX: $\\alpha^2$"; |
|
205 | this.placeholder = "Type *ReStructured Text* and LaTeX: $\\alpha^2$"; | |
208 | IPython.TextCell.apply(this, arguments); |
|
206 | IPython.TextCell.apply(this, arguments); | |
209 | this.cell_type = 'rst'; |
|
207 | this.cell_type = 'rst'; | |
210 | }; |
|
208 | }; | |
211 |
|
209 | |||
212 |
|
210 | |||
213 | RSTCell.prototype = new TextCell(); |
|
211 | RSTCell.prototype = new TextCell(); | |
214 |
|
212 | |||
215 |
|
213 | |||
216 | RSTCell.prototype.render = function () { |
|
214 | RSTCell.prototype.render = function () { | |
217 | if (this.rendered === false) { |
|
215 | if (this.rendered === false) { | |
218 | var text = this.get_source(); |
|
216 | var text = this.get_source(); | |
219 | if (text === "") {text = this.placeholder;}; |
|
217 | if (text === "") {text = this.placeholder;}; | |
220 | var settings = { |
|
218 | var settings = { | |
221 | processData : false, |
|
219 | processData : false, | |
222 | cache : false, |
|
220 | cache : false, | |
223 | type : "POST", |
|
221 | type : "POST", | |
224 | data : text, |
|
222 | data : text, | |
225 | headers : {'Content-Type': 'application/x-rst'}, |
|
223 | headers : {'Content-Type': 'application/x-rst'}, | |
226 | success : $.proxy(this.handle_render,this) |
|
224 | success : $.proxy(this.handle_render,this) | |
227 | }; |
|
225 | }; | |
228 | $.ajax("/rstservice/render", settings); |
|
226 | $.ajax("/rstservice/render", settings); | |
229 | this.element.find('div.text_cell_input').hide(); |
|
227 | this.element.find('div.text_cell_input').hide(); | |
230 | this.element.find("div.text_cell_render").show(); |
|
228 | this.element.find("div.text_cell_render").show(); | |
231 | this.set_rendered("Rendering..."); |
|
229 | this.set_rendered("Rendering..."); | |
232 | }; |
|
230 | }; | |
233 | }; |
|
231 | }; | |
234 |
|
232 | |||
235 |
|
233 | |||
236 | RSTCell.prototype.handle_render = function (data, status, xhr) { |
|
234 | RSTCell.prototype.handle_render = function (data, status, xhr) { | |
237 | this.set_rendered(data); |
|
235 | this.set_rendered(data); | |
238 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
236 | MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | |
239 | this.rendered = true; |
|
237 | this.rendered = true; | |
240 | }; |
|
238 | }; | |
241 |
|
239 | |||
242 |
|
240 | |||
243 | IPython.TextCell = TextCell; |
|
241 | IPython.TextCell = TextCell; | |
244 | IPython.HTMLCell = HTMLCell; |
|
242 | IPython.HTMLCell = HTMLCell; | |
245 | IPython.MarkdownCell = MarkdownCell; |
|
243 | IPython.MarkdownCell = MarkdownCell; | |
246 | IPython.RSTCell = RSTCell; |
|
244 | IPython.RSTCell = RSTCell; | |
247 |
|
245 | |||
248 |
|
246 | |||
249 | return IPython; |
|
247 | return IPython; | |
250 |
|
248 | |||
251 | }(IPython)); |
|
249 | }(IPython)); | |
252 |
|
250 |
@@ -1,223 +1,223 b'' | |||||
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 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> |
|
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> | |
10 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> --> |
|
10 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> --> | |
11 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.14.custom.css" type="text/css" />--> |
|
11 | <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.14.custom.css" type="text/css" />--> | |
12 |
|
12 | |||
13 | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> |
|
13 | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> | |
14 | <!-- <script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script> --> |
|
14 | <!-- <script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script> --> | |
15 | <script type="text/javascript"> |
|
15 | <script type="text/javascript"> | |
16 | if (typeof MathJax == 'undefined') { |
|
16 | if (typeof MathJax == 'undefined') { | |
17 | console.log("Trying to load local copy of MathJax"); |
|
17 | console.log("Trying to load local copy of MathJax"); | |
18 | document.write(unescape("%3Cscript type='text/javascript' src='static/mathjax/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E")); |
|
18 | document.write(unescape("%3Cscript type='text/javascript' src='static/mathjax/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E")); | |
19 | } |
|
19 | } | |
20 | </script> |
|
20 | </script> | |
21 |
|
21 | |||
22 | <link rel="stylesheet" href="static/codemirror-2.12/lib/codemirror.css"> |
|
22 | <link rel="stylesheet" href="static/codemirror-2.12/lib/codemirror.css"> | |
23 | <link rel="stylesheet" href="static/codemirror-2.12/mode/rst/rst.css"> |
|
23 | <link rel="stylesheet" href="static/codemirror-2.12/mode/rst/rst.css"> | |
24 | <link rel="stylesheet" href="static/codemirror-2.12/theme/ipython.css"> |
|
24 | <link rel="stylesheet" href="static/codemirror-2.12/theme/ipython.css"> | |
25 | <link rel="stylesheet" href="static/codemirror-2.12/theme/default.css"> |
|
25 | <link rel="stylesheet" href="static/codemirror-2.12/theme/default.css"> | |
26 |
|
26 | |||
27 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> |
|
27 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> | |
28 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> |
|
28 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> | |
29 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> |
|
29 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> | |
30 | <link rel="stylesheet" href="static/css/notebook.css" type="text/css" /> |
|
30 | <link rel="stylesheet" href="static/css/notebook.css" type="text/css" /> | |
31 | <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" /> |
|
31 | <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" /> | |
32 |
|
32 | |||
33 |
|
33 | |||
34 | </head> |
|
34 | </head> | |
35 |
|
35 | |||
36 | <body> |
|
36 | <body> | |
37 |
|
37 | |||
38 | <div id="header"> |
|
38 | <div id="header"> | |
39 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
39 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> | |
40 | <span id="save_widget"> |
|
40 | <span id="save_widget"> | |
41 | <input type="text" id="notebook_name" size="20"></textarea> |
|
41 | <input type="text" id="notebook_name" size="20"></textarea> | |
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> |
|
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> | |
43 | <button id="save_notebook">Save</button> |
|
43 | <button id="save_notebook">Save</button> | |
44 | </span> |
|
44 | </span> | |
45 | <span id="kernel_status">Idle</span> |
|
45 | <span id="kernel_status">Idle</span> | |
46 | </div> |
|
46 | </div> | |
47 |
|
47 | |||
48 | <div id="main_app"> |
|
48 | <div id="main_app"> | |
49 |
|
49 | |||
50 | <div id="left_panel"> |
|
50 | <div id="left_panel"> | |
51 |
|
51 | |||
52 | <div id="notebook_section"> |
|
52 | <div id="notebook_section"> | |
53 | <h3 class="section_header">Notebook</h3> |
|
53 | <h3 class="section_header">Notebook</h3> | |
54 | <div class="section_content"> |
|
54 | <div class="section_content"> | |
55 | <div class="section_row"> |
|
55 | <div class="section_row"> | |
56 | <span id="new_open" class="section_row_buttons"> |
|
56 | <span id="new_open" class="section_row_buttons"> | |
57 | <button id="new_notebook">New</button> |
|
57 | <button id="new_notebook">New</button> | |
58 | <button id="open_notebook">Open</button> |
|
58 | <button id="open_notebook">Open</button> | |
59 | </span> |
|
59 | </span> | |
60 | <span class="section_row_header">Actions</span> |
|
60 | <span class="section_row_header">Actions</span> | |
61 | </div> |
|
61 | </div> | |
62 | <div class="section_row"> |
|
62 | <div class="section_row"> | |
63 | <span> |
|
63 | <span> | |
64 | <select id="download_format"> |
|
64 | <select id="download_format"> | |
65 | <option value="xml">xml</option> |
|
65 | <option value="xml">xml</option> | |
66 | <option value="json">json</option> |
|
66 | <option value="json">json</option> | |
67 | <option value="py">py</option> |
|
67 | <option value="py">py</option> | |
68 | </select> |
|
68 | </select> | |
69 | </span> |
|
69 | </span> | |
70 | <span class="section_row_buttons"> |
|
70 | <span class="section_row_buttons"> | |
71 | <button id="download_notebook">Export As</button> |
|
71 | <button id="download_notebook">Export As</button> | |
72 | </span> |
|
72 | </span> | |
73 | </div> |
|
73 | </div> | |
74 | </div> |
|
74 | </div> | |
75 | </div> |
|
75 | </div> | |
76 |
|
76 | |||
77 | <div id="cell_section"> |
|
77 | <div id="cell_section"> | |
78 | <h3 class="section_header">Cell</h3> |
|
78 | <h3 class="section_header">Cell</h3> | |
79 | <div class="section_content"> |
|
79 | <div class="section_content"> | |
80 | <div class="section_row"> |
|
80 | <div class="section_row"> | |
81 | <span class="section_row_buttons"> |
|
81 | <span class="section_row_buttons"> | |
82 | <button id="delete_cell">Delete</button> |
|
82 | <button id="delete_cell">Delete</button> | |
83 | </span> |
|
83 | </span> | |
84 | <span class="section_row_header">Actions</span> |
|
84 | <span class="section_row_header">Actions</span> | |
85 | </div> |
|
85 | </div> | |
86 | <div class="section_row"> |
|
86 | <div class="section_row"> | |
87 | <span id="cell_type" class="section_row_buttons"> |
|
87 | <span id="cell_type" class="section_row_buttons"> | |
88 | <button id="to_code">Code</button> |
|
88 | <button id="to_code">Code</button> | |
89 | <button id="to_html">HTML</button> |
|
89 | <button id="to_html">HTML</button> | |
90 | <button id="to_markdown">Markdown</button> |
|
90 | <button id="to_markdown">Markdown</button> | |
91 | </span> |
|
91 | </span> | |
92 | <!-- <span class="button_label">Format</span> --> |
|
92 | <!-- <span class="button_label">Format</span> --> | |
93 | </div> |
|
93 | </div> | |
94 | <div class="section_row"> |
|
94 | <div class="section_row"> | |
95 | <span id="insert" class="section_row_buttons"> |
|
95 | <span id="insert" class="section_row_buttons"> | |
96 | <button id="insert_cell_above">Above</button> |
|
96 | <button id="insert_cell_above">Above</button> | |
97 | <button id="insert_cell_below">Below</button> |
|
97 | <button id="insert_cell_below">Below</button> | |
98 | </span> |
|
98 | </span> | |
99 | <span class="button_label">Insert</span> |
|
99 | <span class="button_label">Insert</span> | |
100 | </div> |
|
100 | </div> | |
101 | <div class="section_row"> |
|
101 | <div class="section_row"> | |
102 | <span id="move" class="section_row_buttons"> |
|
102 | <span id="move" class="section_row_buttons"> | |
103 | <button id="move_cell_up">Up</button> |
|
103 | <button id="move_cell_up">Up</button> | |
104 | <button id="move_cell_down">Down</button> |
|
104 | <button id="move_cell_down">Down</button> | |
105 | </span> |
|
105 | </span> | |
106 | <span class="button_label">Move</span> |
|
106 | <span class="button_label">Move</span> | |
107 | </div> |
|
107 | </div> | |
108 | <div class="section_row"> |
|
108 | <div class="section_row"> | |
109 | <span id="toggle_output" class="section_row_buttons"> |
|
109 | <span id="toggle_output" class="section_row_buttons"> | |
110 | <button id="collapse_cell">Collapse</button> |
|
110 | <button id="collapse_cell">Collapse</button> | |
111 | <button id="expand_cell">Expand</button> |
|
111 | <button id="expand_cell">Expand</button> | |
112 | </span> |
|
112 | </span> | |
113 | <span class="button_label">Output</span> |
|
113 | <span class="button_label">Output</span> | |
114 | </div> |
|
114 | </div> | |
115 | <div class="section_row"> |
|
115 | <div class="section_row"> | |
116 | <span id="run_cells" class="section_row_buttons"> |
|
116 | <span id="run_cells" class="section_row_buttons"> | |
117 | <button id="run_selected_cell">Selected</button> |
|
117 | <button id="run_selected_cell">Selected</button> | |
118 | <button id="run_all_cells">All</button> |
|
118 | <button id="run_all_cells">All</button> | |
119 | </span> |
|
119 | </span> | |
120 | <span class="button_label">Run</span> |
|
120 | <span class="button_label">Run</span> | |
121 | </div> |
|
121 | </div> | |
122 | <div class="section_row"> |
|
122 | <div class="section_row"> | |
123 | <span id="autoindent_span"> |
|
123 | <span id="autoindent_span"> | |
124 | <input type="checkbox" id="autoindent"></input> |
|
124 | <input type="checkbox" id="autoindent" checked="true"></input> | |
125 | </span> |
|
125 | </span> | |
126 | <span class="checkbox_label">Autoindent:</span> |
|
126 | <span class="checkbox_label">Autoindent:</span> | |
127 | </div> |
|
127 | </div> | |
128 | </div> |
|
128 | </div> | |
129 | </div> |
|
129 | </div> | |
130 |
|
130 | |||
131 | <div id="kernel_section"> |
|
131 | <div id="kernel_section"> | |
132 | <h3 class="section_header">Kernel</h3> |
|
132 | <h3 class="section_header">Kernel</h3> | |
133 | <div class="section_content"> |
|
133 | <div class="section_content"> | |
134 | <div class="section_row"> |
|
134 | <div class="section_row"> | |
135 | <span id="int_restart" class="section_row_buttons"> |
|
135 | <span id="int_restart" class="section_row_buttons"> | |
136 | <button id="int_kernel">Interrupt</button> |
|
136 | <button id="int_kernel">Interrupt</button> | |
137 | <button id="restart_kernel">Restart</button> |
|
137 | <button id="restart_kernel">Restart</button> | |
138 | </span> |
|
138 | </span> | |
139 | <span class="section_row_header">Actions</span> |
|
139 | <span class="section_row_header">Actions</span> | |
140 | </div> |
|
140 | </div> | |
141 | <div class="section_row"> |
|
141 | <div class="section_row"> | |
142 | <span id="kernel_persist"> |
|
142 | <span id="kernel_persist"> | |
143 | <input type="checkbox" id="kill_kernel"></input> |
|
143 | <input type="checkbox" id="kill_kernel"></input> | |
144 | </span> |
|
144 | </span> | |
145 | <span class="checkbox_label">Kill kernel upon exit:</span> |
|
145 | <span class="checkbox_label">Kill kernel upon exit:</span> | |
146 | </div> |
|
146 | </div> | |
147 | </div> |
|
147 | </div> | |
148 | </div> |
|
148 | </div> | |
149 |
|
149 | |||
150 | <div id="help_section"> |
|
150 | <div id="help_section"> | |
151 | <h3 class="section_header">Help</h3> |
|
151 | <h3 class="section_header">Help</h3> | |
152 | <div class="section_content"> |
|
152 | <div class="section_content"> | |
153 | <div class="section_row"> |
|
153 | <div class="section_row"> | |
154 | <span id="help_buttons0" class="section_row_buttons"> |
|
154 | <span id="help_buttons0" class="section_row_buttons"> | |
155 | <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button> |
|
155 | <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button> | |
156 | <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button> |
|
156 | <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button> | |
157 | <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button> |
|
157 | <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button> | |
158 | </span> |
|
158 | </span> | |
159 | <span class="section_row_header">Links</span> |
|
159 | <span class="section_row_header">Links</span> | |
160 | </div> |
|
160 | </div> | |
161 | <div class="section_row"> |
|
161 | <div class="section_row"> | |
162 | <span id="help_buttons1" class="section_row_buttons"> |
|
162 | <span id="help_buttons1" class="section_row_buttons"> | |
163 | <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button> |
|
163 | <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button> | |
164 | <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button> |
|
164 | <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button> | |
165 | <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button> |
|
165 | <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button> | |
166 | </span> |
|
166 | </span> | |
167 | </div> |
|
167 | </div> | |
168 | <div class="section_row"> |
|
168 | <div class="section_row"> | |
169 | <span class="help_string">run selected cell</span> |
|
169 | <span class="help_string">run selected cell</span> | |
170 | <span class="help_string_label">Shift-Enter |</span> |
|
170 | <span class="help_string_label">Shift-Enter |</span> | |
171 | </div> |
|
171 | </div> | |
172 | <div class="section_row"> |
|
172 | <div class="section_row"> | |
173 | <span class="help_string">run in terminal mode</span> |
|
173 | <span class="help_string">run in terminal mode</span> | |
174 | <span class="help_string_label">Ctrl-Enter |</span> |
|
174 | <span class="help_string_label">Ctrl-Enter |</span> | |
175 | </div> |
|
175 | </div> | |
176 | </div> |
|
176 | </div> | |
177 | </div> |
|
177 | </div> | |
178 |
|
178 | |||
179 | </div> |
|
179 | </div> | |
180 | <div id="left_panel_splitter"></div> |
|
180 | <div id="left_panel_splitter"></div> | |
181 | <div id="notebook_panel"> |
|
181 | <div id="notebook_panel"> | |
182 | <div id="notebook"></div> |
|
182 | <div id="notebook"></div> | |
183 | <div id="pager_splitter"></div> |
|
183 | <div id="pager_splitter"></div> | |
184 | <div id="pager"></div> |
|
184 | <div id="pager"></div> | |
185 | </div> |
|
185 | </div> | |
186 |
|
186 | |||
187 | </div> |
|
187 | </div> | |
188 |
|
188 | |||
189 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> |
|
189 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> | |
190 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> |
|
190 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> | |
191 | <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script> |
|
191 | <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script> | |
192 |
|
192 | |||
193 | <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script> |
|
193 | <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script> | |
194 | <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script> |
|
194 | <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script> | |
195 | <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> |
|
195 | <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> | |
196 | <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script> |
|
196 | <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script> | |
197 | <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script> |
|
197 | <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script> | |
198 | <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script> |
|
198 | <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script> | |
199 | <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script> |
|
199 | <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script> | |
200 |
|
200 | |||
201 | <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script> |
|
201 | <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script> | |
202 |
|
202 | |||
203 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
203 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> | |
204 | <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script> |
|
204 | <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script> | |
205 | <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script> |
|
205 | <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script> | |
206 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
206 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> | |
207 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
207 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> | |
208 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
208 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> | |
209 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> |
|
209 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> | |
210 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
210 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> | |
211 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
211 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
212 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
212 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
213 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> |
|
213 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> | |
214 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> |
|
214 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> | |
215 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
215 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
216 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
|
216 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> | |
217 |
|
217 | |||
218 |
|
218 | |||
219 | </body> |
|
219 | </body> | |
220 |
|
220 | |||
221 | </html> |
|
221 | </html> | |
222 |
|
222 | |||
223 |
|
223 |
General Comments 0
You need to be logged in to leave comments.
Login now