##// END OF EJS Templates
Fixing main toolbar area and cleaning up jquery themes.
Brian Granger -
Show More
@@ -1,826 +1,830 b''
1 var IPYTHON = {};
1 var IPYTHON = {};
2
2
3
3
4
4
5 // $.get("/notebooks/number2.nb",function (data, status, xhr) {console.log(data);});
5 // $.get("/notebooks/number2.nb",function (data, status, xhr) {console.log(data);});
6 //
6 //
7 // settings = {
7 // settings = {
8 // processData : false,
8 // processData : false,
9 // cache : false,
9 // cache : false,
10 // type : "DELETE",
10 // type : "DELETE",
11 // success : function (data, status, xhr) {console.log(data);}
11 // success : function (data, status, xhr) {console.log(data);}
12 // }
12 // }
13 // $.ajax("/notebooks/number2.nb",settings)
13 // $.ajax("/notebooks/number2.nb",settings)
14 //
14 //
15 // settings = {
15 // settings = {
16 // processData : false,
16 // processData : false,
17 // cache : false,
17 // cache : false,
18 // type : "PUT",
18 // type : "PUT",
19 // success : function (data, status, xhr) {console.log(data);}
19 // success : function (data, status, xhr) {console.log(data);}
20 // }
20 // }
21 // $.ajax("/notebooks/number2.nb",settings)
21 // $.ajax("/notebooks/number2.nb",settings)
22
22
23
23
24 //============================================================================
24 //============================================================================
25 // Utilities
25 // Utilities
26 //============================================================================
26 //============================================================================
27
27
28
28
29 var uuid = function () {
29 var uuid = function () {
30 // http://www.ietf.org/rfc/rfc4122.txt
30 // http://www.ietf.org/rfc/rfc4122.txt
31 var s = [];
31 var s = [];
32 var hexDigits = "0123456789ABCDEF";
32 var hexDigits = "0123456789ABCDEF";
33 for (var i = 0; i < 32; i++) {
33 for (var i = 0; i < 32; i++) {
34 s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
34 s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
35 }
35 }
36 s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
36 s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
37 s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
37 s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
38
38
39 var uuid = s.join("");
39 var uuid = s.join("");
40 return uuid;
40 return uuid;
41 };
41 };
42
42
43
43
44 //Fix raw text to parse correctly in crazy XML
44 //Fix raw text to parse correctly in crazy XML
45 function xmlencode(string) {
45 function xmlencode(string) {
46 return string.replace(/\&/g,'&'+'amp;')
46 return string.replace(/\&/g,'&'+'amp;')
47 .replace(/</g,'&'+'lt;')
47 .replace(/</g,'&'+'lt;')
48 .replace(/>/g,'&'+'gt;')
48 .replace(/>/g,'&'+'gt;')
49 .replace(/\'/g,'&'+'apos;')
49 .replace(/\'/g,'&'+'apos;')
50 .replace(/\"/g,'&'+'quot;')
50 .replace(/\"/g,'&'+'quot;')
51 .replace(/`/g,'&'+'#96;')
51 .replace(/`/g,'&'+'#96;')
52 }
52 }
53
53
54 //Map from terminal commands to CSS classes
54 //Map from terminal commands to CSS classes
55 attrib = {
55 attrib = {
56 "30":"cblack", "31":"cred",
56 "30":"cblack", "31":"cred",
57 "32":"cgreen", "33":"cyellow",
57 "32":"cgreen", "33":"cyellow",
58 "34":"cblue", "36":"ccyan",
58 "34":"cblue", "36":"ccyan",
59 "37":"cwhite", "01":"cbold"}
59 "37":"cwhite", "01":"cbold"}
60
60
61 //Fixes escaped console commands, IE colors. Turns them into HTML
61 //Fixes escaped console commands, IE colors. Turns them into HTML
62 function fixConsole(txt) {
62 function fixConsole(txt) {
63 txt = xmlencode(txt)
63 txt = xmlencode(txt)
64 var re = /\033\[([\d;]*?)m/
64 var re = /\033\[([\d;]*?)m/
65 var opened = false
65 var opened = false
66 var cmds = []
66 var cmds = []
67 var opener = ""
67 var opener = ""
68 var closer = ""
68 var closer = ""
69
69
70 while (re.test(txt)) {
70 while (re.test(txt)) {
71 var cmds = txt.match(re)[1].split(";")
71 var cmds = txt.match(re)[1].split(";")
72 closer = opened?"</span>":""
72 closer = opened?"</span>":""
73 opened = cmds.length > 1 || cmds[0] != 0
73 opened = cmds.length > 1 || cmds[0] != 0
74 var rep = []
74 var rep = []
75 for (var i in cmds)
75 for (var i in cmds)
76 if (typeof(attrib[cmds[i]]) != "undefined")
76 if (typeof(attrib[cmds[i]]) != "undefined")
77 rep.push(attrib[cmds[i]])
77 rep.push(attrib[cmds[i]])
78 opener = rep.length > 0?"<span class=\""+rep.join(" ")+"\">":""
78 opener = rep.length > 0?"<span class=\""+rep.join(" ")+"\">":""
79 txt = txt.replace(re, closer + opener)
79 txt = txt.replace(re, closer + opener)
80 }
80 }
81 if (opened) txt += "</span>"
81 if (opened) txt += "</span>"
82 return txt.trim()
82 return txt.trim()
83 }
83 }
84
84
85 //============================================================================
85 //============================================================================
86 // Notebook
86 // Notebook
87 //============================================================================
87 //============================================================================
88
88
89
89
90 var Notebook = function (selector) {
90 var Notebook = function (selector) {
91 this.element = $(selector);
91 this.element = $(selector);
92 this.element.scroll();
92 this.element.scroll();
93 this.element.data("notebook", this);
93 this.element.data("notebook", this);
94 this.next_prompt_number = 1;
94 this.next_prompt_number = 1;
95 this.next_kernel_number = 0;
95 this.next_kernel_number = 0;
96 this.kernel = null;
96 this.kernel = null;
97 this.msg_cell_map = {};
97 this.msg_cell_map = {};
98 this.bind_events();
98 this.bind_events();
99 this.start_kernel();
99 this.start_kernel();
100 };
100 };
101
101
102
102
103 Notebook.prototype.bind_events = function () {
103 Notebook.prototype.bind_events = function () {
104 var that = this;
104 var that = this;
105 $(document).keydown(function (event) {
105 $(document).keydown(function (event) {
106 // console.log(event);
106 // console.log(event);
107 if (event.which == 38 && event.shiftKey) {
107 if (event.which == 38 && event.shiftKey) {
108 event.preventDefault();
108 event.preventDefault();
109 that.select_prev();
109 that.select_prev();
110 } else if (event.which == 40 && event.shiftKey) {
110 } else if (event.which == 40 && event.shiftKey) {
111 event.preventDefault();
111 event.preventDefault();
112 that.select_next();
112 that.select_next();
113 } else if (event.which == 13 && event.shiftKey) {
113 } else if (event.which == 13 && event.shiftKey) {
114 // The focus is not quite working here.
114 // The focus is not quite working here.
115 var cell = that.selected_cell();
115 var cell = that.selected_cell();
116 var cell_index = that.find_cell_index(cell);
116 var cell_index = that.find_cell_index(cell);
117 if (cell instanceof CodeCell) {
117 if (cell instanceof CodeCell) {
118 event.preventDefault();
118 event.preventDefault();
119 cell.clear_output();
119 cell.clear_output();
120 var msg_id = that.kernel.execute(cell.get_code());
120 var msg_id = that.kernel.execute(cell.get_code());
121 that.msg_cell_map[msg_id] = cell.cell_id;
121 that.msg_cell_map[msg_id] = cell.cell_id;
122 if (cell_index === (that.ncells()-1)) {
122 if (cell_index === (that.ncells()-1)) {
123 that.insert_code_cell_after();
123 that.insert_code_cell_after();
124 } else {
124 } else {
125 that.select(cell_index+1);
125 that.select(cell_index+1);
126 };
126 };
127 }
127 }
128 } else if (event.which == 9) {
128 } else if (event.which == 9) {
129 event.preventDefault();
129 event.preventDefault();
130 var cell = that.selected_cell();
130 var cell = that.selected_cell();
131 if (cell instanceof CodeCell) {
131 if (cell instanceof CodeCell) {
132 var ta = cell.element.find("textarea.input_area");
132 var ta = cell.element.find("textarea.input_area");
133 ta.val(ta.val() + " ");
133 ta.val(ta.val() + " ");
134 };
134 };
135 };
135 };
136 });
136 });
137 };
137 };
138
138
139
139
140 // Cell indexing, retrieval, etc.
140 // Cell indexing, retrieval, etc.
141
141
142
142
143 Notebook.prototype.cell_elements = function () {
143 Notebook.prototype.cell_elements = function () {
144 return this.element.children("div.cell");
144 return this.element.children("div.cell");
145 }
145 }
146
146
147
147
148 Notebook.prototype.ncells = function (cell) {
148 Notebook.prototype.ncells = function (cell) {
149 return this.cell_elements().length;
149 return this.cell_elements().length;
150 }
150 }
151
151
152
152
153 // TODO: we are often calling cells as cells()[i], which we should optimize
153 // TODO: we are often calling cells as cells()[i], which we should optimize
154 // to cells(i) or a new method.
154 // to cells(i) or a new method.
155 Notebook.prototype.cells = function () {
155 Notebook.prototype.cells = function () {
156 return this.cell_elements().toArray().map(function (e) {
156 return this.cell_elements().toArray().map(function (e) {
157 return $(e).data("cell");
157 return $(e).data("cell");
158 });
158 });
159 }
159 }
160
160
161
161
162 Notebook.prototype.find_cell_index = function (cell) {
162 Notebook.prototype.find_cell_index = function (cell) {
163 var result = null;
163 var result = null;
164 this.cell_elements().filter(function (index) {
164 this.cell_elements().filter(function (index) {
165 if ($(this).data("cell") === cell) {
165 if ($(this).data("cell") === cell) {
166 result = index;
166 result = index;
167 };
167 };
168 });
168 });
169 return result;
169 return result;
170 };
170 };
171
171
172
172
173 Notebook.prototype.index_or_selected = function (index) {
173 Notebook.prototype.index_or_selected = function (index) {
174 return index || this.selected_index() || 0;
174 return index || this.selected_index() || 0;
175 }
175 }
176
176
177
177
178 Notebook.prototype.select = function (index) {
178 Notebook.prototype.select = function (index) {
179 if (index !== undefined && index >= 0 && index < this.ncells()) {
179 if (index !== undefined && index >= 0 && index < this.ncells()) {
180 if (this.selected_index() !== null) {
180 if (this.selected_index() !== null) {
181 this.selected_cell().unselect();
181 this.selected_cell().unselect();
182 };
182 };
183 this.cells()[index].select();
183 this.cells()[index].select();
184 };
184 };
185 return this;
185 return this;
186 };
186 };
187
187
188
188
189 Notebook.prototype.select_next = function () {
189 Notebook.prototype.select_next = function () {
190 var index = this.selected_index();
190 var index = this.selected_index();
191 if (index !== null && index >= 0 && (index+1) < this.ncells()) {
191 if (index !== null && index >= 0 && (index+1) < this.ncells()) {
192 this.select(index+1);
192 this.select(index+1);
193 };
193 };
194 return this;
194 return this;
195 };
195 };
196
196
197
197
198 Notebook.prototype.select_prev = function () {
198 Notebook.prototype.select_prev = function () {
199 var index = this.selected_index();
199 var index = this.selected_index();
200 if (index !== null && index >= 0 && (index-1) < this.ncells()) {
200 if (index !== null && index >= 0 && (index-1) < this.ncells()) {
201 this.select(index-1);
201 this.select(index-1);
202 };
202 };
203 return this;
203 return this;
204 };
204 };
205
205
206
206
207 Notebook.prototype.selected_index = function () {
207 Notebook.prototype.selected_index = function () {
208 var result = null;
208 var result = null;
209 this.cell_elements().filter(function (index) {
209 this.cell_elements().filter(function (index) {
210 if ($(this).data("cell").selected === true) {
210 if ($(this).data("cell").selected === true) {
211 result = index;
211 result = index;
212 };
212 };
213 });
213 });
214 return result;
214 return result;
215 };
215 };
216
216
217
217
218 Notebook.prototype.cell_for_msg = function (msg_id) {
218 Notebook.prototype.cell_for_msg = function (msg_id) {
219 var cell_id = this.msg_cell_map[msg_id];
219 var cell_id = this.msg_cell_map[msg_id];
220 var result = null;
220 var result = null;
221 this.cell_elements().filter(function (index) {
221 this.cell_elements().filter(function (index) {
222 cell = $(this).data("cell");
222 cell = $(this).data("cell");
223 if (cell.cell_id === cell_id) {
223 if (cell.cell_id === cell_id) {
224 result = cell;
224 result = cell;
225 };
225 };
226 });
226 });
227 return result;
227 return result;
228 };
228 };
229
229
230
230
231 Notebook.prototype.selected_cell = function () {
231 Notebook.prototype.selected_cell = function () {
232 return this.cell_elements().eq(this.selected_index()).data("cell");
232 return this.cell_elements().eq(this.selected_index()).data("cell");
233 }
233 }
234
234
235
235
236 // Cell insertion, deletion and moving.
236 // Cell insertion, deletion and moving.
237
237
238
238
239 Notebook.prototype.delete_cell = function (index) {
239 Notebook.prototype.delete_cell = function (index) {
240 var i = index || this.selected_index();
240 var i = index || this.selected_index();
241 if (i !== null && i >= 0 && i < this.ncells()) {
241 if (i !== null && i >= 0 && i < this.ncells()) {
242 this.cell_elements().eq(i).remove();
242 this.cell_elements().eq(i).remove();
243 if (i === (this.ncells())) {
243 if (i === (this.ncells())) {
244 this.select(i-1);
244 this.select(i-1);
245 } else {
245 } else {
246 this.select(i);
246 this.select(i);
247 };
247 };
248 };
248 };
249 return this;
249 return this;
250 };
250 };
251
251
252
252
253 Notebook.prototype.append_cell = function (cell) {
253 Notebook.prototype.append_cell = function (cell) {
254 this.element.append(cell.element);
254 this.element.append(cell.element);
255 return this;
255 return this;
256 };
256 };
257
257
258
258
259 Notebook.prototype.insert_cell_after = function (cell, index) {
259 Notebook.prototype.insert_cell_after = function (cell, index) {
260 var ncells = this.ncells();
260 var ncells = this.ncells();
261 if (ncells === 0) {
261 if (ncells === 0) {
262 this.append_cell(cell);
262 this.append_cell(cell);
263 return this;
263 return this;
264 };
264 };
265 if (index >= 0 && index < ncells) {
265 if (index >= 0 && index < ncells) {
266 this.cell_elements().eq(index).after(cell.element);
266 this.cell_elements().eq(index).after(cell.element);
267 };
267 };
268 return this
268 return this
269 };
269 };
270
270
271
271
272 Notebook.prototype.insert_cell_before = function (cell, index) {
272 Notebook.prototype.insert_cell_before = function (cell, index) {
273 var ncells = this.ncells();
273 var ncells = this.ncells();
274 if (ncells === 0) {
274 if (ncells === 0) {
275 this.append_cell(cell);
275 this.append_cell(cell);
276 return this;
276 return this;
277 };
277 };
278 if (index >= 0 && index < ncells) {
278 if (index >= 0 && index < ncells) {
279 this.cell_elements().eq(index).before(cell.element);
279 this.cell_elements().eq(index).before(cell.element);
280 };
280 };
281 return this;
281 return this;
282 };
282 };
283
283
284
284
285 Notebook.prototype.move_cell_up = function (index) {
285 Notebook.prototype.move_cell_up = function (index) {
286 var i = index || this.selected_index();
286 var i = index || this.selected_index();
287 if (i !== null && i < this.ncells() && i > 0) {
287 if (i !== null && i < this.ncells() && i > 0) {
288 var pivot = this.cell_elements().eq(i-1);
288 var pivot = this.cell_elements().eq(i-1);
289 var tomove = this.cell_elements().eq(i);
289 var tomove = this.cell_elements().eq(i);
290 if (pivot !== null && tomove !== null) {
290 if (pivot !== null && tomove !== null) {
291 tomove.detach();
291 tomove.detach();
292 pivot.before(tomove);
292 pivot.before(tomove);
293 this.select(i-1);
293 this.select(i-1);
294 };
294 };
295 };
295 };
296 return this;
296 return this;
297 }
297 }
298
298
299
299
300 Notebook.prototype.move_cell_down = function (index) {
300 Notebook.prototype.move_cell_down = function (index) {
301 var i = index || this.selected_index();
301 var i = index || this.selected_index();
302 if (i !== null && i < (this.ncells()-1) && i >= 0) {
302 if (i !== null && i < (this.ncells()-1) && i >= 0) {
303 var pivot = this.cell_elements().eq(i+1)
303 var pivot = this.cell_elements().eq(i+1)
304 var tomove = this.cell_elements().eq(i)
304 var tomove = this.cell_elements().eq(i)
305 if (pivot !== null && tomove !== null) {
305 if (pivot !== null && tomove !== null) {
306 tomove.detach();
306 tomove.detach();
307 pivot.after(tomove);
307 pivot.after(tomove);
308 this.select(i+1);
308 this.select(i+1);
309 };
309 };
310 };
310 };
311 return this;
311 return this;
312 }
312 }
313
313
314
314
315 Notebook.prototype.sort_cells = function () {
315 Notebook.prototype.sort_cells = function () {
316 var ncells = this.ncells();
316 var ncells = this.ncells();
317 var sindex = this.selected_index();
317 var sindex = this.selected_index();
318 var swapped;
318 var swapped;
319 do {
319 do {
320 swapped = false
320 swapped = false
321 for (var i=1; i<ncells; i++) {
321 for (var i=1; i<ncells; i++) {
322 current = this.cell_elements().eq(i).data("cell");
322 current = this.cell_elements().eq(i).data("cell");
323 previous = this.cell_elements().eq(i-1).data("cell");
323 previous = this.cell_elements().eq(i-1).data("cell");
324 if (previous.input_prompt_number > current.input_prompt_number) {
324 if (previous.input_prompt_number > current.input_prompt_number) {
325 this.move_cell_up(i);
325 this.move_cell_up(i);
326 swapped = true;
326 swapped = true;
327 };
327 };
328 };
328 };
329 } while (swapped);
329 } while (swapped);
330 this.select(sindex);
330 this.select(sindex);
331 return this;
331 return this;
332 };
332 };
333
333
334
334
335 Notebook.prototype.insert_code_cell_before = function (index) {
335 Notebook.prototype.insert_code_cell_before = function (index) {
336 // TODO: Bounds check for i
336 // TODO: Bounds check for i
337 var i = this.index_or_selected(index);
337 var i = this.index_or_selected(index);
338 var cell = new CodeCell(this);
338 var cell = new CodeCell(this);
339 cell.set_input_prompt(this.next_prompt_number);
339 cell.set_input_prompt(this.next_prompt_number);
340 this.next_prompt_number = this.next_prompt_number + 1;
340 this.next_prompt_number = this.next_prompt_number + 1;
341 this.insert_cell_before(cell, i);
341 this.insert_cell_before(cell, i);
342 this.select(this.find_cell_index(cell));
342 this.select(this.find_cell_index(cell));
343 return this;
343 return this;
344 }
344 }
345
345
346
346
347 Notebook.prototype.insert_code_cell_after = function (index) {
347 Notebook.prototype.insert_code_cell_after = function (index) {
348 // TODO: Bounds check for i
348 // TODO: Bounds check for i
349 var i = this.index_or_selected(index);
349 var i = this.index_or_selected(index);
350 var cell = new CodeCell(this);
350 var cell = new CodeCell(this);
351 cell.set_input_prompt(this.next_prompt_number);
351 cell.set_input_prompt(this.next_prompt_number);
352 this.next_prompt_number = this.next_prompt_number + 1;
352 this.next_prompt_number = this.next_prompt_number + 1;
353 this.insert_cell_after(cell, i);
353 this.insert_cell_after(cell, i);
354 this.select(this.find_cell_index(cell));
354 this.select(this.find_cell_index(cell));
355 return this;
355 return this;
356 }
356 }
357
357
358
358
359 Notebook.prototype.insert_text_cell_before = function (index) {
359 Notebook.prototype.insert_text_cell_before = function (index) {
360 // TODO: Bounds check for i
360 // TODO: Bounds check for i
361 var i = this.index_or_selected(index);
361 var i = this.index_or_selected(index);
362 var cell = new TextCell(this);
362 var cell = new TextCell(this);
363 cell.config_mathjax();
363 cell.config_mathjax();
364 this.insert_cell_before(cell, i);
364 this.insert_cell_before(cell, i);
365 this.select(this.find_cell_index(cell));
365 this.select(this.find_cell_index(cell));
366 return this;
366 return this;
367 }
367 }
368
368
369
369
370 Notebook.prototype.insert_text_cell_after = function (index) {
370 Notebook.prototype.insert_text_cell_after = function (index) {
371 // TODO: Bounds check for i
371 // TODO: Bounds check for i
372 var i = this.index_or_selected(index);
372 var i = this.index_or_selected(index);
373 var cell = new TextCell(this);
373 var cell = new TextCell(this);
374 cell.config_mathjax();
374 cell.config_mathjax();
375 this.insert_cell_after(cell, i);
375 this.insert_cell_after(cell, i);
376 this.select(this.find_cell_index(cell));
376 this.select(this.find_cell_index(cell));
377 return this;
377 return this;
378 }
378 }
379
379
380
380
381 Notebook.prototype.text_to_code = function (index) {
381 Notebook.prototype.text_to_code = function (index) {
382 // TODO: Bounds check for i
382 // TODO: Bounds check for i
383 var i = this.index_or_selected(index);
383 var i = this.index_or_selected(index);
384 var source_element = this.cell_elements().eq(i);
384 var source_element = this.cell_elements().eq(i);
385 var source_cell = source_element.data("cell");
385 var source_cell = source_element.data("cell");
386 if (source_cell instanceof TextCell) {
386 if (source_cell instanceof TextCell) {
387 this.insert_code_cell_after(i);
387 this.insert_code_cell_after(i);
388 var target_cell = this.cells()[i+1];
388 var target_cell = this.cells()[i+1];
389 var text = source_element.find("textarea.text_cell_input").val();
389 var text = source_element.find("textarea.text_cell_input").val();
390 target_cell.element.find("textarea.input_area").val(text);
390 target_cell.element.find("textarea.input_area").val(text);
391 source_element.remove();
391 source_element.remove();
392 };
392 };
393 };
393 };
394
394
395
395
396 Notebook.prototype.code_to_text = function (index) {
396 Notebook.prototype.code_to_text = function (index) {
397 // TODO: Bounds check for i
397 // TODO: Bounds check for i
398 var i = this.index_or_selected(index);
398 var i = this.index_or_selected(index);
399 var source_element = this.cell_elements().eq(i);
399 var source_element = this.cell_elements().eq(i);
400 var source_cell = source_element.data("cell");
400 var source_cell = source_element.data("cell");
401 if (source_cell instanceof CodeCell) {
401 if (source_cell instanceof CodeCell) {
402 this.insert_text_cell_after(i);
402 this.insert_text_cell_after(i);
403 var target_cell = this.cells()[i+1];
403 var target_cell = this.cells()[i+1];
404 var text = source_element.find("textarea.input_area").val();
404 var text = source_element.find("textarea.input_area").val();
405 if (text === "") {text = target_cell.placeholder;};
405 if (text === "") {text = target_cell.placeholder;};
406 target_cell.element.find("textarea.text_cell_input").val(text);
406 target_cell.element.find("textarea.text_cell_input").val(text);
407 target_cell.element.find("textarea.text_cell_input").html(text);
407 target_cell.element.find("textarea.text_cell_input").html(text);
408 target_cell.element.find("div.text_cell_render").html(text);
408 target_cell.element.find("div.text_cell_render").html(text);
409
409
410 source_element.remove();
410 source_element.remove();
411 };
411 };
412 };
412 };
413
413
414
414
415 // Cell collapsing
415 // Cell collapsing
416
416
417 Notebook.prototype.collapse = function (index) {
417 Notebook.prototype.collapse = function (index) {
418 var i = this.index_or_selected(index);
418 var i = this.index_or_selected(index);
419 this.cells()[i].collapse();
419 this.cells()[i].collapse();
420 };
420 };
421
421
422
422
423 Notebook.prototype.expand = function (index) {
423 Notebook.prototype.expand = function (index) {
424 var i = this.index_or_selected(index);
424 var i = this.index_or_selected(index);
425 this.cells()[i].expand();
425 this.cells()[i].expand();
426 };
426 };
427
427
428
428
429 // Kernel related things
429 // Kernel related things
430
430
431 Notebook.prototype.start_kernel = function () {
431 Notebook.prototype.start_kernel = function () {
432 this.kernel = new Kernel("kernel" + this.next_kernel_number);
432 this.kernel = new Kernel("kernel" + this.next_kernel_number);
433 this.next_kernel_number = this.next_kernel_number + 1;
433 this.next_kernel_number = this.next_kernel_number + 1;
434 this.kernel.start_kernel(this._kernel_started, this);
434 this.kernel.start_kernel(this._kernel_started, this);
435 };
435 };
436
436
437
437
438 Notebook.prototype._kernel_started = function () {
438 Notebook.prototype._kernel_started = function () {
439 console.log("Kernel started: ", this.kernel.kernel_id);
439 console.log("Kernel started: ", this.kernel.kernel_id);
440 this.kernel.start_session(this._session_started, this);
440 this.kernel.start_session(this._session_started, this);
441 };
441 };
442
442
443
443
444 Notebook.prototype._session_started = function () {
444 Notebook.prototype._session_started = function () {
445 console.log("Session started: ", this.kernel.session_id);
445 console.log("Session started: ", this.kernel.session_id);
446 var that = this;
446 var that = this;
447
447
448 this.kernel.shell_channel.onmessage = function (e) {
448 this.kernel.shell_channel.onmessage = function (e) {
449 reply = $.parseJSON(e.data);
449 reply = $.parseJSON(e.data);
450 console.log(reply);
450 console.log(reply);
451 var msg_type = reply.msg_type;
451 var msg_type = reply.msg_type;
452 var cell = that.cell_for_msg(reply.parent_header.msg_id);
452 var cell = that.cell_for_msg(reply.parent_header.msg_id);
453 if (msg_type === "execute_reply") {
453 if (msg_type === "execute_reply") {
454 cell.set_prompt(reply.content.execution_count);
454 cell.set_prompt(reply.content.execution_count);
455 };
455 };
456 };
456 };
457
457
458 this.kernel.iopub_channel.onmessage = function (e) {
458 this.kernel.iopub_channel.onmessage = function (e) {
459 reply = $.parseJSON(e.data);
459 reply = $.parseJSON(e.data);
460 console.log(reply);
460 console.log(reply);
461 var msg_type = reply.msg_type;
461 var msg_type = reply.msg_type;
462 var cell = that.cell_for_msg(reply.parent_header.msg_id);
462 var cell = that.cell_for_msg(reply.parent_header.msg_id);
463 if (msg_type === "stream") {
463 if (msg_type === "stream") {
464 cell.expand();
464 cell.expand();
465 cell.append_stream(reply.content.data + "\n");
465 cell.append_stream(reply.content.data + "\n");
466 } else if (msg_type === "pyout" || msg_type === "display_data") {
466 } else if (msg_type === "pyout" || msg_type === "display_data") {
467 cell.expand();
467 cell.expand();
468 cell.append_display_data(reply.content.data);
468 cell.append_display_data(reply.content.data);
469 };
469 };
470 };
470 };
471 };
471 };
472
472
473
473
474 Notebook.prototype._handle_execute_reply = function (reply, cell) {
474 Notebook.prototype._handle_execute_reply = function (reply, cell) {
475 cell.set_prompt(reply.content.execution_count);
475 cell.set_prompt(reply.content.execution_count);
476 };
476 };
477
477
478
478
479 //============================================================================
479 //============================================================================
480 // Cell
480 // Cell
481 //============================================================================
481 //============================================================================
482
482
483
483
484 var Cell = function (notebook) {
484 var Cell = function (notebook) {
485 this.notebook = notebook;
485 this.notebook = notebook;
486 this.selected = false;
486 this.selected = false;
487 this.element;
487 this.element;
488 this.create_element();
488 this.create_element();
489 if (this.element !== undefined) {
489 if (this.element !== undefined) {
490 this.element.data("cell", this);
490 this.element.data("cell", this);
491 this.bind_events();
491 this.bind_events();
492 }
492 }
493 this.cell_id = uuid();
493 this.cell_id = uuid();
494 };
494 };
495
495
496
496
497 Cell.prototype.select = function () {
497 Cell.prototype.select = function () {
498 this.element.addClass('ui-widget-content ui-corner-all');
498 this.element.addClass('ui-widget-content ui-corner-all');
499 this.selected = true;
499 this.selected = true;
500 // TODO: we need t test across browsers to see if both of these are needed.
500 // TODO: we need t test across browsers to see if both of these are needed.
501 // In the meantime, there should not be any harm in having them both.
501 // In the meantime, there should not be any harm in having them both.
502 this.element.find('textarea').trigger('focusin');
502 this.element.find('textarea').trigger('focusin');
503 this.element.find('textarea').trigger('focus');
503 this.element.find('textarea').trigger('focus');
504 };
504 };
505
505
506
506
507 Cell.prototype.unselect = function () {
507 Cell.prototype.unselect = function () {
508 this.element.removeClass('ui-widget-content ui-corner-all');
508 this.element.removeClass('ui-widget-content ui-corner-all');
509 this.selected = false;
509 this.selected = false;
510 };
510 };
511
511
512
512
513 Cell.prototype.bind_events = function () {
513 Cell.prototype.bind_events = function () {
514 var that = this;
514 var that = this;
515 var nb = that.notebook
515 var nb = that.notebook
516 that.element.click(function (event) {
516 that.element.click(function (event) {
517 if (that.selected === false) {
517 if (that.selected === false) {
518 nb.select(nb.find_cell_index(that));
518 nb.select(nb.find_cell_index(that));
519 };
519 };
520 });
520 });
521 that.element.focusin(function (event) {
521 that.element.focusin(function (event) {
522 if (that.selected === false) {
522 if (that.selected === false) {
523 nb.select(nb.find_cell_index(that));
523 nb.select(nb.find_cell_index(that));
524 };
524 };
525 });
525 });
526 };
526 };
527
527
528
528
529 // Subclasses must implement create_element.
529 // Subclasses must implement create_element.
530 Cell.prototype.create_element = function () {};
530 Cell.prototype.create_element = function () {};
531
531
532
532
533 //============================================================================
533 //============================================================================
534 // CodeCell
534 // CodeCell
535 //============================================================================
535 //============================================================================
536
536
537
537
538 var CodeCell = function (notebook) {
538 var CodeCell = function (notebook) {
539 Cell.apply(this, arguments);
539 Cell.apply(this, arguments);
540 this.input_prompt_number = ' ';
540 this.input_prompt_number = ' ';
541 this.output_prompt_number = ' ';
541 this.output_prompt_number = ' ';
542 };
542 };
543
543
544
544
545 CodeCell.prototype = new Cell();
545 CodeCell.prototype = new Cell();
546
546
547
547
548 CodeCell.prototype.create_element = function () {
548 CodeCell.prototype.create_element = function () {
549 var cell = $('<div></div>').addClass('cell code_cell')
549 var cell = $('<div></div>').addClass('cell code_cell')
550 var input = $('<div></div>').addClass('input').append(
550 var input = $('<div></div>').addClass('input').append(
551 $('<div/>').addClass('prompt input_prompt')
551 $('<div/>').addClass('prompt input_prompt')
552 ).append(
552 ).append(
553 $('<textarea/>').addClass('input_area').
553 $('<textarea/>').addClass('input_area').
554 attr('rows',1).
554 attr('rows',1).
555 attr('cols',80).
555 attr('cols',80).
556 attr('wrap','hard').
556 attr('wrap','hard').
557 autoGrow()
557 autoGrow()
558 );
558 );
559 var output = $('<div></div>').addClass('output').append(
559 var output = $('<div></div>').addClass('output').append(
560 $('<div/>').addClass('prompt output_prompt')
560 $('<div/>').addClass('prompt output_prompt')
561 ).append(
561 ).append(
562 $('<div/>').addClass('output_area')
562 $('<div/>').addClass('output_area')
563 );
563 );
564 cell.append(input).append(output);
564 cell.append(input).append(output);
565 this.element = cell;
565 this.element = cell;
566 this.collapse()
566 this.collapse()
567 };
567 };
568
568
569
569
570 CodeCell.prototype.append_stream = function (data) {
570 CodeCell.prototype.append_stream = function (data) {
571 var data_list = data.split("\n");
571 var data_list = data.split("\n");
572 console.log(data_list);
572 console.log(data_list);
573 if (data_list.length > 0) {
573 if (data_list.length > 0) {
574 for (var i=0; i<data_list.length; i++) {
574 for (var i=0; i<data_list.length; i++) {
575 console.log(i, data_list[i]);
575 console.log(i, data_list[i]);
576 var toinsert = fixConsole(data_list[i]);
576 var toinsert = fixConsole(data_list[i]);
577 this.element.find("div.output_area").append($("<p>").append(toinsert));
577 this.element.find("div.output_area").append($("<p>").append(toinsert));
578 };
578 };
579 }
579 }
580 };
580 };
581
581
582
582
583 CodeCell.prototype.append_display_data = function (data) {
583 CodeCell.prototype.append_display_data = function (data) {
584 if (data["image/svg+xml"] !== undefined) {
584 if (data["image/svg+xml"] !== undefined) {
585 this.append_svg(data["image/svg+xml"]);
585 this.append_svg(data["image/svg+xml"]);
586 } else if (data["text/plain"] !== undefined) {
586 } else if (data["text/plain"] !== undefined) {
587 console.log(data["text/plain"]);
587 console.log(data["text/plain"]);
588 this.append_stream(data["text/plain"]);
588 this.append_stream(data["text/plain"]);
589 };
589 };
590 };
590 };
591
591
592 CodeCell.prototype.append_svg = function (svg) {
592 CodeCell.prototype.append_svg = function (svg) {
593 this.element.find("div.output_area").append(svg);
593 this.element.find("div.output_area").append(svg);
594 };
594 };
595
595
596
596
597 CodeCell.prototype.clear_output = function () {
597 CodeCell.prototype.clear_output = function () {
598 this.element.find("div.output_area").html("");
598 this.element.find("div.output_area").html("");
599 };
599 };
600
600
601
601
602 CodeCell.prototype.collapse = function () {
602 CodeCell.prototype.collapse = function () {
603 this.element.find('div.output').hide();
603 this.element.find('div.output').hide();
604 };
604 };
605
605
606
606
607 CodeCell.prototype.expand = function () {
607 CodeCell.prototype.expand = function () {
608 this.element.find('div.output').show();
608 this.element.find('div.output').show();
609 };
609 };
610
610
611
611
612 CodeCell.prototype.set_prompt = function (number) {
612 CodeCell.prototype.set_prompt = function (number) {
613 this.set_input_prompt(number);
613 this.set_input_prompt(number);
614 this.set_output_prompt(number);
614 this.set_output_prompt(number);
615 };
615 };
616
616
617 CodeCell.prototype.set_input_prompt = function (number) {
617 CodeCell.prototype.set_input_prompt = function (number) {
618 var n = number || ' ';
618 var n = number || ' ';
619 this.input_prompt_number = n
619 this.input_prompt_number = n
620 this.element.find('div.input_prompt').html('In&nbsp;[' + n + ']:');
620 this.element.find('div.input_prompt').html('In&nbsp;[' + n + ']:');
621 };
621 };
622
622
623
623
624 CodeCell.prototype.set_output_prompt = function (number) {
624 CodeCell.prototype.set_output_prompt = function (number) {
625 var n = number || ' ';
625 var n = number || ' ';
626 this.output_prompt_number = n
626 this.output_prompt_number = n
627 this.element.find('div.output_prompt').html('Out[' + n + ']:');
627 this.element.find('div.output_prompt').html('Out[' + n + ']:');
628 };
628 };
629
629
630
630
631 CodeCell.prototype.get_code = function () {
631 CodeCell.prototype.get_code = function () {
632 return this.element.find("textarea.input_area").val();
632 return this.element.find("textarea.input_area").val();
633 };
633 };
634
634
635 //============================================================================
635 //============================================================================
636 // TextCell
636 // TextCell
637 //============================================================================
637 //============================================================================
638
638
639
639
640 var TextCell = function (notebook) {
640 var TextCell = function (notebook) {
641 Cell.apply(this, arguments);
641 Cell.apply(this, arguments);
642 this.placeholder = "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$"
642 this.placeholder = "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$"
643 };
643 };
644
644
645
645
646 TextCell.prototype = new Cell();
646 TextCell.prototype = new Cell();
647
647
648
648
649 TextCell.prototype.create_element = function () {
649 TextCell.prototype.create_element = function () {
650 var cell = $("<div>").addClass('cell text_cell').
650 var cell = $("<div>").addClass('cell text_cell').
651 append(
651 append(
652 $("<textarea>" + this.placeholder + "</textarea>").
652 $("<textarea>" + this.placeholder + "</textarea>").
653 addClass('text_cell_input').
653 addClass('text_cell_input').
654 attr('rows',1).
654 attr('rows',1).
655 attr('cols',80).
655 attr('cols',80).
656 autoGrow()
656 autoGrow()
657 ).append(
657 ).append(
658 $('<div></div>').addClass('text_cell_render')
658 $('<div></div>').addClass('text_cell_render')
659 )
659 )
660 this.element = cell;
660 this.element = cell;
661 };
661 };
662
662
663
663
664 TextCell.prototype.select = function () {
664 TextCell.prototype.select = function () {
665 this.edit();
665 this.edit();
666 Cell.prototype.select.apply(this);
666 Cell.prototype.select.apply(this);
667 };
667 };
668
668
669
669
670 TextCell.prototype.edit = function () {
670 TextCell.prototype.edit = function () {
671 var text_cell = this.element;
671 var text_cell = this.element;
672 var input = text_cell.find("textarea.text_cell_input");
672 var input = text_cell.find("textarea.text_cell_input");
673 var output = text_cell.find("div.text_cell_render");
673 var output = text_cell.find("div.text_cell_render");
674 output.hide();
674 output.hide();
675 input.show().trigger('focus');
675 input.show().trigger('focus');
676 };
676 };
677
677
678
678
679 TextCell.prototype.render = function () {
679 TextCell.prototype.render = function () {
680 var text_cell = this.element;
680 var text_cell = this.element;
681 var input = text_cell.find("textarea.text_cell_input");
681 var input = text_cell.find("textarea.text_cell_input");
682 var output = text_cell.find("div.text_cell_render");
682 var output = text_cell.find("div.text_cell_render");
683 var text = input.val();
683 var text = input.val();
684 if (text === "") {
684 if (text === "") {
685 text = this.placeholder;
685 text = this.placeholder;
686 input.val(text);
686 input.val(text);
687 };
687 };
688 output.html(text)
688 output.html(text)
689 input.html(text);
689 input.html(text);
690 MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
690 MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
691 input.hide();
691 input.hide();
692 output.show();
692 output.show();
693 };
693 };
694
694
695
695
696 TextCell.prototype.config_mathjax = function () {
696 TextCell.prototype.config_mathjax = function () {
697 var text_cell = this.element;
697 var text_cell = this.element;
698 var that = this;
698 var that = this;
699 text_cell.click(function () {
699 text_cell.click(function () {
700 that.edit();
700 that.edit();
701 }).focusout(function () {
701 }).focusout(function () {
702 that.render();
702 that.render();
703 });
703 });
704
704
705 text_cell.trigger("focusout");
705 text_cell.trigger("focusout");
706 };
706 };
707
707
708
708
709 //============================================================================
709 //============================================================================
710 // On document ready
710 // On document ready
711 //============================================================================
711 //============================================================================
712
712
713
713
714 var Kernel = function (kernel_id) {
714 var Kernel = function (kernel_id) {
715 this.kernel_id = kernel_id;
715 this.kernel_id = kernel_id;
716 this.base_url = "/kernels";
716 this.base_url = "/kernels";
717 this.kernel_url = this.base_url + "/" + this.kernel_id
717 this.kernel_url = this.base_url + "/" + this.kernel_id
718 this.session_id = null;
718 this.session_id = null;
719 };
719 };
720
720
721
721
722 Kernel.prototype.get_msg = function (msg_type, content) {
722 Kernel.prototype.get_msg = function (msg_type, content) {
723 var msg = {
723 var msg = {
724 header : {
724 header : {
725 msg_id : uuid(),
725 msg_id : uuid(),
726 username : "bgranger",
726 username : "bgranger",
727 session: this.session_id
727 session: this.session_id
728 },
728 },
729 msg_type : msg_type,
729 msg_type : msg_type,
730 content : content,
730 content : content,
731 parent_header : {}
731 parent_header : {}
732 };
732 };
733 return msg;
733 return msg;
734 }
734 }
735
735
736 Kernel.prototype.start_kernel = function (callback, context) {
736 Kernel.prototype.start_kernel = function (callback, context) {
737 $.post(this.kernel_url, function () {
737 $.post(this.kernel_url, function () {
738 callback.call(context);
738 callback.call(context);
739 });
739 });
740 };
740 };
741
741
742
742
743 Kernel.prototype.start_session = function (callback, context) {
743 Kernel.prototype.start_session = function (callback, context) {
744 var that = this;
744 var that = this;
745 $.post(this.kernel_url + "/sessions",
745 $.post(this.kernel_url + "/sessions",
746 function (session_id) {
746 function (session_id) {
747 that._handle_start_session(session_id, callback, context);
747 that._handle_start_session(session_id, callback, context);
748 },
748 },
749 'json');
749 'json');
750 }
750 }
751
751
752
752
753 Kernel.prototype._handle_start_session = function (session_id, callback, context) {
753 Kernel.prototype._handle_start_session = function (session_id, callback, context) {
754 this.session_id = session_id;
754 this.session_id = session_id;
755 this.session_url = this.kernel_url + "/sessions/" + this.session_id;
755 this.session_url = this.kernel_url + "/sessions/" + this.session_id;
756 this._start_channels();
756 this._start_channels();
757 callback.call(context);
757 callback.call(context);
758 };
758 };
759
759
760
760
761 Kernel.prototype._start_channels = function () {
761 Kernel.prototype._start_channels = function () {
762 var ws_url = "ws://127.0.0.1:8888" + this.session_url;
762 var ws_url = "ws://127.0.0.1:8888" + this.session_url;
763 this.shell_channel = new WebSocket(ws_url + "/shell");
763 this.shell_channel = new WebSocket(ws_url + "/shell");
764 this.iopub_channel = new WebSocket(ws_url + "/iopub");
764 this.iopub_channel = new WebSocket(ws_url + "/iopub");
765 }
765 }
766
766
767
767
768 Kernel.prototype.execute = function (code) {
768 Kernel.prototype.execute = function (code) {
769 var content = {
769 var content = {
770 code : code,
770 code : code,
771 silent : false,
771 silent : false,
772 user_variables : [],
772 user_variables : [],
773 user_expressions : {}
773 user_expressions : {}
774 };
774 };
775 var msg = this.get_msg("execute_request", content);
775 var msg = this.get_msg("execute_request", content);
776
776
777 this.shell_channel.send(JSON.stringify(msg));
777 this.shell_channel.send(JSON.stringify(msg));
778 return msg.header.msg_id;
778 return msg.header.msg_id;
779 }
779 }
780
780
781
781
782 //============================================================================
782 //============================================================================
783 // On document ready
783 // On document ready
784 //============================================================================
784 //============================================================================
785
785
786
786
787 $(document).ready(function () {
787 $(document).ready(function () {
788
788
789 MathJax.Hub.Config({
789 MathJax.Hub.Config({
790 tex2jax: {
790 tex2jax: {
791 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
791 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
792 displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
792 displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
793 }
793 }
794 });
794 });
795
795
796 $("ul#main_menu").wijmenu({animation:{animated: "slide", duration: 100, easing: null}});
797 IPYTHON.notebook = new Notebook('div.notebook');
796 IPYTHON.notebook = new Notebook('div.notebook');
798 IPYTHON.notebook.insert_code_cell_after();
797 IPYTHON.notebook.insert_code_cell_after();
799
798
799 $("#menu_tabs").tabs();
800
801 $("#help_toolbar").buttonset();
802 $("#kernel_toolbar").buttonset();
803
800 $("#move_cell").buttonset();
804 $("#move_cell").buttonset();
801 $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"});
805 $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"});
802 $("#move_up").button("option", "text", false);
806 $("#move_up").button("option", "text", false);
803 $("#move_up").click(function () {IPYTHON.notebook.move_cell_up();});
807 $("#move_up").click(function () {IPYTHON.notebook.move_cell_up();});
804 $("#move_down").button("option", "icons", {primary:"ui-icon-arrowthick-1-s"});
808 $("#move_down").button("option", "icons", {primary:"ui-icon-arrowthick-1-s"});
805 $("#move_down").button("option", "text", false);
809 $("#move_down").button("option", "text", false);
806 $("#move_down").click(function () {IPYTHON.notebook.move_cell_down();});
810 $("#move_down").click(function () {IPYTHON.notebook.move_cell_down();});
807
811
808 $("#insert_delete").buttonset();
812 $("#insert_delete").buttonset();
809 $("#insert_cell_before").click(function () {IPYTHON.notebook.insert_code_cell_before();});
813 $("#insert_cell_before").click(function () {IPYTHON.notebook.insert_code_cell_before();});
810 $("#insert_cell_after").click(function () {IPYTHON.notebook.insert_code_cell_after();});
814 $("#insert_cell_after").click(function () {IPYTHON.notebook.insert_code_cell_after();});
811 $("#delete_cell").button("option", "icons", {primary:"ui-icon-closethick"});
815 $("#delete_cell").button("option", "icons", {primary:"ui-icon-closethick"});
812 $("#delete_cell").button("option", "text", false);
816 $("#delete_cell").button("option", "text", false);
813 $("#delete_cell").click(function () {IPYTHON.notebook.delete_cell();});
817 $("#delete_cell").click(function () {IPYTHON.notebook.delete_cell();});
814
818
815 $("#cell_type").buttonset();
819 $("#cell_type").buttonset();
816 $("#to_code").click(function () {IPYTHON.notebook.text_to_code();});
820 $("#to_code").click(function () {IPYTHON.notebook.text_to_code();});
817 $("#to_text").click(function () {IPYTHON.notebook.code_to_text();});
821 $("#to_text").click(function () {IPYTHON.notebook.code_to_text();});
818
822
819 $("#sort").buttonset();
823 $("#sort").buttonset();
820 $("#sort_cells").click(function () {IPYTHON.notebook.sort_cells();});
824 $("#sort_cells").click(function () {IPYTHON.notebook.sort_cells();});
821
825
822 $("#toggle").buttonset();
826 $("#toggle").buttonset();
823 $("#collapse").click(function () {IPYTHON.notebook.collapse();});
827 $("#collapse").click(function () {IPYTHON.notebook.collapse();});
824 $("#expand").click(function () {IPYTHON.notebook.expand();});
828 $("#expand").click(function () {IPYTHON.notebook.expand();});
825
829
826 }); No newline at end of file
830 });
@@ -1,88 +1,87 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 <link rel="stylesheet" href="static/css/notebook.css" type="text/css" />
9 <link rel="stylesheet" href="static/css/notebook.css" type="text/css" />
9 <link rel="stylesheet" href="static/jquery/css/jquery.wijmo-open.1.1.3.css" type="text/css" />
10
10 <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
11 <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
12 <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> -->
13 <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.11.custom.css" type="text/css" /> -->
14
11 <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" charset="utf-8"></script>
15 <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" charset="utf-8"></script>
12
16
13 </head>
17 </head>
14
18
15 <body>
19 <body>
16
20
17 <div id="header">
21 <div id="header">
18 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
22 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
19 </div>
23 </div>
20
24
25
21 <div id="tools">
26 <div id="tools">
22
27
23 <ul id="main_menu">
28 <div id="menu_tabs">
24 <li><a>Cell</a>
29 <ul>
25 <ul>
30 <li><a href="#cell_tab">Cell</a></li>
26 <li><a>Run</a></li>
31 <li><a href="#kernel_tab">Kernel</a></li>
27 <li><a>Move up</a></li>
32 <li><a href="#help_tab">Help</a></li>
28 <li><a>Move down</a></li>
33 </ul>
29 <li><a>Delete</a></li>
34 <div id="cell_tab">
30 </ul>
35 <span id="cell_toolbar">
31 </li>
36 <span id="move_cell">
32 <li><a>Kernel</a>
37 <button id="move_up">Move up</button>
33 <ul>
38 <button id="move_down">Move down</button>
34 <li><a>Interrupt</a></li>
39 </span>
35 <li><a>Restart</a></li>
40 <span id="insert_delete">
36 </ul>
41 <button id="insert_cell_before">Before</button>
37 </li>
42 <button id="insert_cell_after">After</button>
38 <li><a>Help</a>
43 <button id="delete_cell">Delete</button>
39 <ul>
44 </span>
40 <li><a>Notebook help</a></li>
45 <span id="cell_type">
41 <li></li>
46 <button id="to_code">Code</button>
42 <li><a href="http://docs.python.org" target="_blank">Python Docs</a></li>
47 <button id="to_text">Text</button>
43 <li><a href="http://ipython.github.com/ipython-doc/dev/index.html" target="_blank">IPython Docs</a></li>
48 </span>
44 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy Docs</a></li>
49 <span id="sort">
45 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy Docs</a></li>
50 <button id="sort_cells">Sort</button>
46 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy Docs</a></li>
51 </span>
47 </ul>
52 <span id="toggle">
48 </li>
53 <button id="collapse">Collapse</button>
49 </ul>
54 <button id="expand">Expand</button>
50
55 </span>
51 <div id="toolbar">
52 <span id="main_toolbar">
53 <span id="move_cell">
54 <button id="move_up">Move up</button>
55 <button id="move_down">Move down</button>
56 </span>
57 <span id="insert_delete">
58 <button id="insert_cell_before">Before</button>
59 <button id="insert_cell_after">After</button>
60 <button id="delete_cell">Delete</button>
61 </span>
62 <span id="cell_type">
63 <button id="to_code">Code</button>
64 <button id="to_text">Text</button>
65 </span>
56 </span>
66 <span id="sort">
57 </div>
67 <button id="sort_cells">Sort</button>
58 <div id="kernel_tab">
59 <span id="kernel_toolbar">
60 <button>Interrupt</button>
61 <button>Restart</button>
68 </span>
62 </span>
69 <span id="toggle">
63 </div>
70 <button id="collapse">Collapse</button>
64 <div id="help_tab">
71 <button id="expand">Expand</button>
65 <span id="help_toolbar">
66 <button><a href="http://docs.python.org" target="_blank">Python</a></button>
67 <button><a href="http://ipython.github.com/ipython-doc/dev/index.html" target="_blank">IPython</a></button>
68 <button><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></button>
69 <button><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button>
70 <button><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button>
71 <button><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button>
72 </span>
72 </span>
73 </span>
73 </div>
74 </div>
74 </div>
75
75
76 </div>
76 </div>
77
77
78 <div class="notebook"></div>
78 <div class="notebook"></div>
79
79
80 <script src="static/jquery/js/jquery-1.5.1.min.js" type="text/javascript" charset="utf-8"></script>
80 <script src="static/jquery/js/jquery-1.5.1.min.js" type="text/javascript" charset="utf-8"></script>
81 <script src="static/jquery/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript" charset="utf-8"></script>
81 <script src="static/jquery/js/jquery-ui-1.8.11.custom.min.js" type="text/javascript" charset="utf-8"></script>
82 <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script>
82 <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script>
83 <script src="static/jquery/js/jquery.wijmo-open.1.1.3.min.js" type="text/javascript" charset="utf-8"></script>
84 <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script>
83 <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script>
85
84
86 </body>
85 </body>
87
86
88 </html> No newline at end of file
87 </html>
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (574 lines changed) Show them Hide them
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now