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
04f221e3
Commit
04f221e3
authored
Sep 10, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another step towards Javascriptinput-style script loading
parent
37acade6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
common/lib/capa/capa/templates/textinput_dynamath.html
+4
-1
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+14
-5
No files found.
common/lib/capa/capa/templates/textinput_dynamath.html
View file @
04f221e3
...
...
@@ -2,6 +2,10 @@
### version of textline.html which does dynamic math
###
<section
class=
"text-input-dynamath textinputdynamath capa_inputtype"
id=
"inputtype_${id}"
>
<div
class=
"textinputdynamath_data"
data-preprocessor=
"MathjaxPreprocessorFor6002x"
/>
<div
class=
"script_placeholder"
data-src=
"/static/js/mathjax_preprocessor_for_6002x.js"
/>
% if state == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif state == 'correct':
...
...
@@ -20,7 +24,6 @@
style=
"display:none;"
%
endif
/>
<div
class=
"script_placeholder"
data-src=
"/static/js/mathjax_preprocessor_for_6002x.js"
/>
<p
class=
"status"
>
% if state == 'unsubmitted':
unanswered
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
04f221e3
...
...
@@ -297,12 +297,17 @@ class @Problem
refreshMath
:
(
event
,
element
)
=>
element
=
event
.
target
unless
element
target
=
"display_
#{
element
.
id
.
replace
(
/^input_/
,
''
)
}
"
elid
=
element
.
id
.
replace
(
/^input_/
,
''
)
target
=
"display_"
+
elid
preprocessor_tag
=
"inputtype_"
+
elid
mathjax_preprocessor
=
@
inputtypeDisplays
[
preprocessor_tag
]
if
jax
=
MathJax
.
Hub
.
getAllJax
(
target
)[
0
]
eqn
=
$
(
element
).
val
()
if
@
mathjax_preprocessor
eqn
=
@
mathjax_preprocessor
(
eqn
)
if
mathjax_preprocessor
eqn
=
mathjax_preprocessor
(
eqn
)
MathJax
.
Hub
.
Queue
[
'Text'
,
jax
,
eqn
],
[
@
updateMathML
,
jax
,
element
]
...
...
@@ -324,9 +329,13 @@ class @Problem
inputtypeSetupMethods
:
textinputdynamath
:
(
element
)
=>
preprocessorClass
=
window
[
'MathjaxPreprocessorFor6002x'
]
data
=
$
(
element
).
find
(
'.textinputdynamath_data'
)
preprocessorClassName
=
data
.
data
(
'preprocessor'
)
preprocessorClass
=
window
[
preprocessorClassName
]
preprocessor
=
new
preprocessorClass
()
alert
preprocessor
.
fn
return
preprocessor
.
fn
javascriptinput
:
(
element
)
=>
...
...
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