Show More
@@ -41,7 +41,85 b' var IPython = (function (IPython) {' | |||||
41 | this.style(); |
|
41 | this.style(); | |
42 | this.bind_events(); |
|
42 | this.bind_events(); | |
43 | }; |
|
43 | }; | |
44 |
|
44 | |||
|
45 | /** | |||
|
46 | * Class properties | |||
|
47 | **/ | |||
|
48 | ||||
|
49 | /** | |||
|
50 | * Threshold to trigger autoscroll when the OutputArea is resized, | |||
|
51 | * typically when new outputs are added. | |||
|
52 | * | |||
|
53 | * Behavior is undefined if autoscroll is lower than minimum_scroll_threshold, | |||
|
54 | * unless it is < 0, in which case autoscroll will never be triggered | |||
|
55 | * | |||
|
56 | * @property auto_scroll_threshold | |||
|
57 | * @type Number | |||
|
58 | * @default 100 | |||
|
59 | * | |||
|
60 | **/ | |||
|
61 | OutputArea.auto_scroll_threshold = 100; | |||
|
62 | ||||
|
63 | /** | |||
|
64 | * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas | |||
|
65 | * shorter than this are never scrolled. | |||
|
66 | * | |||
|
67 | * @property minimum_scroll_threshold | |||
|
68 | * @type Number | |||
|
69 | * @default 20 | |||
|
70 | * | |||
|
71 | **/ | |||
|
72 | OutputArea.minimum_scroll_threshold = 20; | |||
|
73 | ||||
|
74 | ||||
|
75 | ||||
|
76 | OutputArea.mime_map = { | |||
|
77 | "text/plain" : "text", | |||
|
78 | "text/html" : "html", | |||
|
79 | "image/svg+xml" : "svg", | |||
|
80 | "image/png" : "png", | |||
|
81 | "image/jpeg" : "jpeg", | |||
|
82 | "text/latex" : "latex", | |||
|
83 | "application/json" : "json", | |||
|
84 | "application/javascript" : "javascript", | |||
|
85 | }; | |||
|
86 | ||||
|
87 | OutputArea.mime_map_r = { | |||
|
88 | "text" : "text/plain", | |||
|
89 | "html" : "text/html", | |||
|
90 | "svg" : "image/svg+xml", | |||
|
91 | "png" : "image/png", | |||
|
92 | "jpeg" : "image/jpeg", | |||
|
93 | "latex" : "text/latex", | |||
|
94 | "json" : "application/json", | |||
|
95 | "javascript" : "application/javascript", | |||
|
96 | }; | |||
|
97 | ||||
|
98 | OutputArea.display_order = [ | |||
|
99 | 'application/javascript', | |||
|
100 | 'text/html', | |||
|
101 | 'text/latex', | |||
|
102 | 'image/svg+xml', | |||
|
103 | 'image/png', | |||
|
104 | 'image/jpeg', | |||
|
105 | 'text/plain' | |||
|
106 | ]; | |||
|
107 | ||||
|
108 | OutputArea.append_map = { | |||
|
109 | "text/plain" : OutputArea.prototype.append_text, | |||
|
110 | "text/html" : OutputArea.prototype.append_html, | |||
|
111 | "image/svg+xml" : OutputArea.prototype.append_svg, | |||
|
112 | "image/png" : OutputArea.prototype.append_png, | |||
|
113 | "image/jpeg" : OutputArea.prototype.append_jpeg, | |||
|
114 | "text/latex" : OutputArea.prototype.append_latex, | |||
|
115 | "application/json" : OutputArea.prototype.append_json, | |||
|
116 | "application/javascript" : OutputArea.prototype.append_javascript, | |||
|
117 | }; | |||
|
118 | ||||
|
119 | /** | |||
|
120 | * Class prototypes | |||
|
121 | **/ | |||
|
122 | ||||
45 | OutputArea.prototype.create_elements = function () { |
|
123 | OutputArea.prototype.create_elements = function () { | |
46 | this.element = $("<div/>"); |
|
124 | this.element = $("<div/>"); | |
47 | this.collapse_button = $("<div/>"); |
|
125 | this.collapse_button = $("<div/>"); | |
@@ -159,33 +237,6 b' var IPython = (function (IPython) {' | |||||
159 | }; |
|
237 | }; | |
160 |
|
238 | |||
161 | /** |
|
239 | /** | |
162 | * Threshold to trigger autoscroll when the OutputArea is resized, |
|
|||
163 | * typically when new outputs are added. |
|
|||
164 | * |
|
|||
165 | * Behavior is undefined if autoscroll is lower than minimum_scroll_threshold, |
|
|||
166 | * unless it is < 0, in which case autoscroll will never be triggered |
|
|||
167 | * |
|
|||
168 | * @property auto_scroll_threshold |
|
|||
169 | * @type Number |
|
|||
170 | * @default 100 |
|
|||
171 | * |
|
|||
172 | **/ |
|
|||
173 | OutputArea.auto_scroll_threshold = 100; |
|
|||
174 |
|
||||
175 |
|
||||
176 | /** |
|
|||
177 | * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas |
|
|||
178 | * shorter than this are never scrolled. |
|
|||
179 | * |
|
|||
180 | * @property minimum_scroll_threshold |
|
|||
181 | * @type Number |
|
|||
182 | * @default 20 |
|
|||
183 | * |
|
|||
184 | **/ |
|
|||
185 | OutputArea.minimum_scroll_threshold = 20; |
|
|||
186 |
|
||||
187 |
|
||||
188 | /** |
|
|||
189 | * |
|
240 | * | |
190 | * Scroll OutputArea if height supperior than a threshold (in lines). |
|
241 | * Scroll OutputArea if height supperior than a threshold (in lines). | |
191 | * |
|
242 | * | |
@@ -254,28 +305,7 b' var IPython = (function (IPython) {' | |||||
254 | } |
|
305 | } | |
255 | this.append_output(json); |
|
306 | this.append_output(json); | |
256 | }; |
|
307 | }; | |
257 |
|
||||
258 | OutputArea.mime_map = { |
|
|||
259 | "text/plain" : "text", |
|
|||
260 | "text/html" : "html", |
|
|||
261 | "image/svg+xml" : "svg", |
|
|||
262 | "image/png" : "png", |
|
|||
263 | "image/jpeg" : "jpeg", |
|
|||
264 | "text/latex" : "latex", |
|
|||
265 | "application/json" : "json", |
|
|||
266 | "application/javascript" : "javascript", |
|
|||
267 | }; |
|
|||
268 |
|
308 | |||
269 | OutputArea.mime_map_r = { |
|
|||
270 | "text" : "text/plain", |
|
|||
271 | "html" : "text/html", |
|
|||
272 | "svg" : "image/svg+xml", |
|
|||
273 | "png" : "image/png", |
|
|||
274 | "jpeg" : "image/jpeg", |
|
|||
275 | "latex" : "text/latex", |
|
|||
276 | "json" : "application/json", |
|
|||
277 | "javascript" : "application/javascript", |
|
|||
278 | }; |
|
|||
279 |
|
309 | |||
280 | OutputArea.prototype.rename_keys = function (data, key_map) { |
|
310 | OutputArea.prototype.rename_keys = function (data, key_map) { | |
281 | var remapped = {}; |
|
311 | var remapped = {}; | |
@@ -516,15 +546,6 b' var IPython = (function (IPython) {' | |||||
516 | } |
|
546 | } | |
517 | }; |
|
547 | }; | |
518 |
|
548 | |||
519 | OutputArea.display_order = [ |
|
|||
520 | 'application/javascript', |
|
|||
521 | 'text/html', |
|
|||
522 | 'text/latex', |
|
|||
523 | 'image/svg+xml', |
|
|||
524 | 'image/png', |
|
|||
525 | 'image/jpeg', |
|
|||
526 | 'text/plain' |
|
|||
527 | ]; |
|
|||
528 |
|
549 | |||
529 | OutputArea.prototype.append_mime_type = function (json, element) { |
|
550 | OutputArea.prototype.append_mime_type = function (json, element) { | |
530 |
|
551 | |||
@@ -670,16 +691,6 b' var IPython = (function (IPython) {' | |||||
670 | return toinsert; |
|
691 | return toinsert; | |
671 | }; |
|
692 | }; | |
672 |
|
693 | |||
673 | OutputArea.append_map = { |
|
|||
674 | "text/plain" : OutputArea.prototype.append_text, |
|
|||
675 | "text/html" : OutputArea.prototype.append_html, |
|
|||
676 | "image/svg+xml" : OutputArea.prototype.append_svg, |
|
|||
677 | "image/png" : OutputArea.prototype.append_png, |
|
|||
678 | "image/jpeg" : OutputArea.prototype.append_jpeg, |
|
|||
679 | "text/latex" : OutputArea.prototype.append_latex, |
|
|||
680 | "application/json" : OutputArea.prototype.append_json, |
|
|||
681 | "application/javascript" : OutputArea.prototype.append_javascript, |
|
|||
682 | }; |
|
|||
683 |
|
694 | |||
684 | OutputArea.prototype.append_raw_input = function (msg) { |
|
695 | OutputArea.prototype.append_raw_input = function (msg) { | |
685 | var that = this; |
|
696 | var that = this; |
General Comments 0
You need to be logged in to leave comments.
Login now