Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
5fe58e64
Commit
5fe58e64
authored
Jun 02, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic math display - fix sequence of mathjax timing (mathml now
generated when Check is clicked)
parent
9e0e1a55
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
26 deletions
+21
-26
static/js/mathjax-MathJax-c9db6ac/unpacked/jax/input/AsciiMath/jax.js
+3
-2
templates/mathjax_include.html
+2
-3
templates/problem.js
+9
-13
templates/textinput_dynamath.html
+7
-8
No files found.
static/js/mathjax-MathJax-c9db6ac/unpacked/jax/input/AsciiMath/jax.js
View file @
5fe58e64
...
...
@@ -450,8 +450,9 @@ var AMsymbols = [
{input:"
QQ
", tag:"
mo
", output:"
\
u211A
", tex:null, ttype:CONST},
{input:"
RR
", tag:"
mo
", output:"
\
u211D
", tex:null, ttype:CONST},
{input:"
ZZ
", tag:"
mo
", output:"
\
u2124
", tex:null, ttype:CONST},
{input:"
f
", tag:"
mi
", output:"
f
", tex:null, ttype:UNARY, func:true},
{input:"
g
", tag:"
mi
", output:"
g
", tex:null, ttype:UNARY, func:true},
// not for edX (ichuang jun12)
//{input:"
f
", tag:"
mi
", output:"
f
", tex:null, ttype:UNARY, func:true},
//{input:"
g
", tag:"
mi
", output:"
g
", tex:null, ttype:UNARY, func:true},
//standard functions
{input:"
lim
", tag:"
mo
", output:"
lim
", tex:null, ttype:UNDEROVER},
...
...
templates/mathjax_include.html
View file @
5fe58e64
...
...
@@ -79,12 +79,10 @@ function DoUpdateMath(inputId) {
}
</script>
<
%
block
name=
"headextra"
/>
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates -->
<!-- TODO: move to settings -->
##
<script
type=
"text/javascript"
src=
"http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"
>
##
<
script
type
=
"text/javascript"
src
=
"/static/js/mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-AMS_HTML-full"
>
</script>
<script
type=
"text/javascript"
src=
"/static/js/mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"
></script>
</script>
</script>
\ No newline at end of file
templates/problem.js
View file @
5fe58e64
...
...
@@ -2,31 +2,27 @@ function ${ id }_content_updated() {
MathJax
.
Hub
.
Queue
([
"Typeset"
,
MathJax
.
Hub
]);
update_schematics
();
// dynamic math display: add to jaxset for automatic rendering
// for (var key in codemirror_set) {
// codemirror_set[key].refresh();
// }
$
(
'#check_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
$
(
"input.schematic"
).
each
(
function
(
index
,
element
){
element
.
schematic
.
update_value
();
});
$
(
".CodeMirror"
).
each
(
function
(
index
,
element
){
if
(
element
.
CodeMirror
.
save
)
element
.
CodeMirror
.
save
();
});
// dynamic math display: generate MathML on click
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
){
theid
=
value
.
id
.
replace
(
"input_"
,
""
);
// ID of the response
if
(
document
.
getElementById
(
"display_"
+
theid
)){
MathJax
.
Hub
.
queue
.
Push
(
function
()
{
math
=
MathJax
.
Hub
.
getAllJax
(
"display_"
+
theid
)[
0
];
if
(
math
){
jaxset
[
theid
]
=
math
;
math
.
Text
(
document
.
getElementById
(
value
.
id
).
defaultValue
);
x
=
document
.
getElementById
(
"input_"
+
theid
+
"_dynamath"
);
UpdateMathML
(
math
,
theid
);
}
});
};
});
$
(
'#check_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
$
(
"input.schematic"
).
each
(
function
(
index
,
element
){
element
.
schematic
.
update_value
();
});
$
(
".CodeMirror"
).
each
(
function
(
index
,
element
){
if
(
element
.
CodeMirror
.
save
)
element
.
CodeMirror
.
save
();
});
// for (var key in codemirror_set) {
// codemirror_set[key].refresh();
// }
var
submit_data
=
{};
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
){
if
(
value
.
type
===
"checkbox"
){
...
...
templates/textinput_dynamath.html
View file @
5fe58e64
...
...
@@ -2,7 +2,7 @@
### version of textline.html which does dynammic math
###
<section
class=
"text-input-dynamath"
>
<table><tr><td>
<table
style=
"display:inline; vertical-align:middle;"
><tr><td>
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
%
if
size:
size=
"${size}"
...
...
@@ -26,24 +26,23 @@
</td></tr><tr><td>
<span
id=
"display_${id}"
>
`{::}`
</span>
</td><td>
<textarea
style=
"display:none"
id=
"input_${id}_dynamath"
name=
"input_${id}_dynamath"
>
none
</textarea>
<textarea
style=
"display:none"
id=
"input_${id}_dynamath"
name=
"input_${id}_dynamath"
>
</textarea>
</td></tr>
</table>
##
## javascript for dynamic math: add this math element to the MathJax rendering queue
## also adds to global jaxset js array
##
<script
>
MathJax
.
Hub
.
queue
.
Push
(
function
()
{
<script
type=
"text/javascript"
>
MathJax
.
Hub
.
queue
.
Push
(
function
()
{
math
=
MathJax
.
Hub
.
getAllJax
(
"display_${id}"
)[
0
];
if
(
math
){
jaxset
[
"${id}"
]
=
math
;
math
.
Text
(
document
.
getElementById
(
"input_${id}
_dynamath"
).
defaultValue
);
// initial render
UpdateMathML
(
math
,
"${id}"
);
// initial MathML
math
.
Text
(
document
.
getElementById
(
"input_${id}
"
).
value
);
// UpdateMathML(math,"${id}");
}
});
</script>
</script>
% if msg:
<br/>
<span
class=
"debug"
>
${msg|n}
</span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment