Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
46fe96ac
Commit
46fe96ac
authored
May 24, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix removal of outdated hint messages.
parent
6162dccc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
32 deletions
+40
-32
src/frontend/js/editor.js
src/frontend/js/editor.js
+40
-32
No files found.
src/frontend/js/editor.js
View file @
46fe96ac
...
@@ -21,8 +21,18 @@
...
@@ -21,8 +21,18 @@
var
parts
=
tex
.
split
(
'
\n
'
);
var
parts
=
tex
.
split
(
'
\n
'
);
var
math_container
=
$
(
'
#math
'
),
var
math_container
=
$
(
'
#math
'
),
math_lines
=
math_container
.
find
(
'
div.box script
'
),
math_lines
=
math_container
.
find
(
'
div.box script
'
);
mathjax_instances
=
MathJax
.
Hub
.
getAllJax
(
'
math
'
);
// Select all mathjax instances which are inside a div.box element
var
mathjax_instances
=
[];
var
all_instances
=
MathJax
.
Hub
.
getAllJax
(
'
math
'
);
for
(
var
i
=
0
;
i
<
all_instances
.
length
;
i
++
)
{
var
elem
=
all_instances
[
i
];
if
(
$
(
'
#
'
+
elem
.
inputID
).
parent
().
hasClass
(
'
box
'
))
mathjax_instances
.
push
(
elem
);
}
var
real_lines
=
0
,
var
real_lines
=
0
,
updated_line
=
-
1
;
updated_line
=
-
1
;
...
@@ -31,9 +41,8 @@
...
@@ -31,9 +41,8 @@
if
(
!
parts
[
p
])
if
(
!
parts
[
p
])
continue
;
continue
;
// TODO: Mark updated line as "pending" (e.g. remove "wrong"
// Check if we want to update an existing line or append the
// and "good" class names from element).
// line.
if
(
real_lines
<
math_lines
.
length
)
{
if
(
real_lines
<
math_lines
.
length
)
{
var
elem
=
mathjax_instances
[
real_lines
];
var
elem
=
mathjax_instances
[
real_lines
];
...
@@ -62,32 +71,33 @@
...
@@ -62,32 +71,33 @@
real_lines
++
;
real_lines
++
;
}
}
QUEUE
.
Push
(
function
()
{
// Remove out-dated mathematical lines.
for
(
var
p
=
real_lines
;
p
<
math_lines
.
length
;
p
++
)
$
(
math_lines
[
p
].
parentNode
).
remove
();
// Remove old hints, given that at least one line is updated.
// Remove old hints, given that at least one line is updated.
// Iterate over the DOM nodes until the updated line is found,
// Iterate over the DOM nodes until the updated line is found,
// and remove all following hint nodes.
// and remove all following hint nodes. Note that if there is
var
line_count
=
0
,
i
=
0
,
elems
=
$
(
'
#math div
'
);
// no line updated, all hints not directly following the last
// line are removed.
var
elems
=
$
(
'
#math div
'
);
if
(
updated_line
==
-
1
)
if
(
updated_line
==
-
1
)
updated_line
=
real_lines
+
1
;
updated_line
=
real_lines
;
for
(
;
i
<
elems
.
length
;
i
++
)
{
for
(
var
i
=
0
,
lines
=
0
,
hints
=
0
;
i
<
elems
.
length
;
i
++
)
{
var
elem
=
$
(
elems
[
i
]);
var
elem
=
$
(
elems
[
i
]);
if
(
line_count
=
=
updated_line
)
{
if
(
lines
>
updated_line
||
hints
>
=
updated_line
)
{
if
(
elem
.
hasClass
(
'
hint
'
))
if
(
elem
.
hasClass
(
'
hint
'
))
elem
.
remove
();
elem
.
remove
();
}
else
if
(
elem
.
hasClass
(
'
box
'
))
{
}
else
if
(
elem
.
hasClass
(
'
hint
'
))
line_count
++
;
hints
++
;
}
else
if
(
elem
.
hasClass
(
'
box
'
))
}
lines
++
;
QUEUE
.
Push
((
function
(
math_lines
,
real_lines
)
{
return
function
()
{
for
(
var
p
=
real_lines
;
p
<
math_lines
.
length
;
p
++
)
{
$
(
math_lines
[
p
].
parentNode
).
remove
();
}
}
};
});
})(
math_lines
,
real_lines
));
}
}
window
.
update_math
=
function
()
{
window
.
update_math
=
function
()
{
...
@@ -190,8 +200,6 @@
...
@@ -190,8 +200,6 @@
if
(
!
response
)
if
(
!
response
)
return
;
return
;
console
.
log
(
response
);
if
(
'
step
'
in
response
)
{
if
(
'
step
'
in
response
)
{
window
.
append_input
(
response
.
step
);
window
.
append_input
(
response
.
step
);
trigger_update
=
true
;
trigger_update
=
true
;
...
...
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