Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
MathPrettyPrinter
Commits
c7c65071
Commit
c7c65071
authored
Jul 12, 2018
by
0xJMR
Browse files
Added functionality to change mode.
parent
0d025439
Pipeline
#62363
passed with stages
in 2 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/resources/templates/script.ftl
View file @
c7c65071
...
...
@@ -180,11 +180,52 @@
<script>
var
radios
=
document
.
querySelectorAll
(
"
input[name='View']
"
);
var
card
=
document
.
querySelector
(
"
.card
"
);
var
front
=
document
.
querySelectorAll
(
"
.card-face-front tr
"
);
var
back
=
document
.
querySelectorAll
(
"
.card-face-back tr
"
);
function
clickButton
(
index
)
{
radios
[
index
].
click
();
}
function
selectRange
(
start
,
end
)
{
for
(
var
i
=
start
-
1
;
i
<
(
end
||
start
);
i
++
)
{
front
[
i
].
classList
.
add
(
"
marked
"
);
back
[
i
].
classList
.
add
(
"
marked
"
);
}
}
function
scroll
(
index
,
start
)
{
start
=
start
-
1
;
window
.
scrollTo
(
0
,
index
===
0
?
front
[
start
].
offsetTop
:
back
[
start
].
offsetTop
);
}
function
onChange
(
event
)
{
card
.
classList
.
toggle
(
"
flipped
"
);
}
function
onHashChange
()
{
window
.
setTimeout
(
function
()
{
var
hash
=
window
.
location
.
hash
;
var
parts
=
hash
.
substring
(
1
).
split
(
'
:
'
);
var
index
=
parts
[
0
];
var
start
=
parts
[
1
];
var
end
=
parts
[
2
];
if
(
index
)
{
clickButton
(
index
);
if
(
start
)
{
scroll
(
index
,
start
);
selectRange
(
start
,
end
);
}
}
},
0
);
}
radios
.
forEach
(
function
(
element
)
{
element
.
addEventListener
(
"
change
"
,
onChange
)
});
onHashChange
();
window
.
addEventListener
(
"
hashchange
"
,
onHashChange
);
</script>
</html>
\ No newline at end of file
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