Show More
@@ -390,11 +390,15 b' define(["widgets/js/manager",' | |||||
390 | } |
|
390 | } | |
391 | }, |
|
391 | }, | |
392 |
|
392 | |||
393 |
typeset: function( |
|
393 | typeset: function($el, text){ | |
394 | // check if MathJax is available, and if so use it to |
|
394 | // after (optionally) updating a selection's text, check if | |
395 | // typeset some jQuery selection |
|
395 | // MathJax is available and typeset it | |
396 | $el.text(text); |
|
396 | if(arguments.length > 1){ | |
397 | if(!window.MathJax){ return; } |
|
397 | $el.text(text); | |
|
398 | } | |||
|
399 | if(!window.MathJax){ | |||
|
400 | return; | |||
|
401 | } | |||
398 | return MathJax.Hub.Queue(["Typeset", MathJax.Hub, $el.get(0)]); |
|
402 | return MathJax.Hub.Queue(["Typeset", MathJax.Hub, $el.get(0)]); | |
399 | } |
|
403 | } | |
400 | }); |
|
404 | }); |
@@ -62,7 +62,7 b' define([' | |||||
62 | if (description.trim().length === 0) { |
|
62 | if (description.trim().length === 0) { | |
63 | this.$label.hide(); |
|
63 | this.$label.hide(); | |
64 | } else { |
|
64 | } else { | |
65 |
this.typeset( |
|
65 | this.typeset(this.$label, description); | |
66 | this.$label.show(); |
|
66 | this.$label.show(); | |
67 | } |
|
67 | } | |
68 | } |
|
68 | } |
@@ -319,7 +319,7 b' define([' | |||||
319 | if (description.trim().length === 0) { |
|
319 | if (description.trim().length === 0) { | |
320 | this.$title.html(" "); // Preserve title height |
|
320 | this.$title.html(" "); // Preserve title height | |
321 | } else { |
|
321 | } else { | |
322 |
this.typeset( |
|
322 | this.typeset(this.$title, description); | |
323 | } |
|
323 | } | |
324 |
|
324 | |||
325 | var button_text = this.model.get('button_text'); |
|
325 | var button_text = this.model.get('button_text'); |
@@ -155,7 +155,7 b' define([' | |||||
155 | if (description.length === 0) { |
|
155 | if (description.length === 0) { | |
156 | this.$label.hide(); |
|
156 | this.$label.hide(); | |
157 | } else { |
|
157 | } else { | |
158 |
this.typeset( |
|
158 | this.typeset(this.$label, description); | |
159 | this.$label.show(); |
|
159 | this.$label.show(); | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
@@ -322,7 +322,7 b' define([' | |||||
322 | if (description.length === 0) { |
|
322 | if (description.length === 0) { | |
323 | this.$label.hide(); |
|
323 | this.$label.hide(); | |
324 | } else { |
|
324 | } else { | |
325 |
this.typeset( |
|
325 | this.typeset(this.$label, description); | |
326 | this.$label.show(); |
|
326 | this.$label.show(); | |
327 | } |
|
327 | } | |
328 | } |
|
328 | } | |
@@ -441,7 +441,7 b' define([' | |||||
441 | if (description.length === 0) { |
|
441 | if (description.length === 0) { | |
442 | this.$label.hide(); |
|
442 | this.$label.hide(); | |
443 | } else { |
|
443 | } else { | |
444 |
this.typeset( |
|
444 | this.typeset(this.$label, description); | |
445 | this.$label.show(); |
|
445 | this.$label.show(); | |
446 | } |
|
446 | } | |
447 | return ProgressView.__super__.update.apply(this); |
|
447 | return ProgressView.__super__.update.apply(this); |
@@ -97,7 +97,7 b' define([' | |||||
97 | if (description.length === 0) { |
|
97 | if (description.length === 0) { | |
98 | this.$label.hide(); |
|
98 | this.$label.hide(); | |
99 | } else { |
|
99 | } else { | |
100 |
this.typeset( |
|
100 | this.typeset(this.$label, description); | |
101 | this.$label.show(); |
|
101 | this.$label.show(); | |
102 | } |
|
102 | } | |
103 | } |
|
103 | } | |
@@ -230,7 +230,7 b' define([' | |||||
230 | this.$label.hide(); |
|
230 | this.$label.hide(); | |
231 | } else { |
|
231 | } else { | |
232 | this.$label.text(description); |
|
232 | this.$label.text(description); | |
233 |
this.typeset( |
|
233 | this.typeset(this.$label, description); | |
234 | this.$label.show(); |
|
234 | this.$label.show(); | |
235 | } |
|
235 | } | |
236 | } |
|
236 | } | |
@@ -345,7 +345,7 b' define([' | |||||
345 | this.$label.hide(); |
|
345 | this.$label.hide(); | |
346 | } else { |
|
346 | } else { | |
347 | this.$label.text(); |
|
347 | this.$label.text(); | |
348 |
this.typeset( |
|
348 | this.typeset(this.$label, description); | |
349 | this.$label.show(); |
|
349 | this.$label.show(); | |
350 | } |
|
350 | } | |
351 | } |
|
351 | } | |
@@ -467,7 +467,7 b' define([' | |||||
467 | if (description.length === 0) { |
|
467 | if (description.length === 0) { | |
468 | this.$label.hide(); |
|
468 | this.$label.hide(); | |
469 | } else { |
|
469 | } else { | |
470 |
this.typeset( |
|
470 | this.typeset(this.$label, description); | |
471 | this.$label.show(); |
|
471 | this.$label.show(); | |
472 | } |
|
472 | } | |
473 | } |
|
473 | } |
@@ -43,7 +43,7 b' define([' | |||||
43 | * Called when the model is changed. The model may have been |
|
43 | * Called when the model is changed. The model may have been | |
44 | * changed by another view or by a state update from the back-end. |
|
44 | * changed by another view or by a state update from the back-end. | |
45 | */ |
|
45 | */ | |
46 |
this.typeset(this.model.get('value') |
|
46 | this.typeset(this.$el, this.model.get('value')); | |
47 | return LatexView.__super__.update.apply(this); |
|
47 | return LatexView.__super__.update.apply(this); | |
48 | }, |
|
48 | }, | |
49 | }); |
|
49 | }); | |
@@ -114,7 +114,7 b' define([' | |||||
114 | if (description.length === 0) { |
|
114 | if (description.length === 0) { | |
115 | this.$label.hide(); |
|
115 | this.$label.hide(); | |
116 | } else { |
|
116 | } else { | |
117 |
this.typeset( |
|
117 | this.typeset(this.$label, description); | |
118 | this.$label.show(); |
|
118 | this.$label.show(); | |
119 | } |
|
119 | } | |
120 | } |
|
120 | } | |
@@ -197,7 +197,7 b' define([' | |||||
197 | if (description.length === 0) { |
|
197 | if (description.length === 0) { | |
198 | this.$label.hide(); |
|
198 | this.$label.hide(); | |
199 | } else { |
|
199 | } else { | |
200 |
this.typeset( |
|
200 | this.typeset(this.$label, description); | |
201 | this.$label.show(); |
|
201 | this.$label.show(); | |
202 | } |
|
202 | } | |
203 | } |
|
203 | } |
General Comments 0
You need to be logged in to leave comments.
Login now