2020-11-22 17:11:23 +01:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="la">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<title>Familia Romana – Pensum A</title>
|
2020-12-03 20:22:58 +01:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/LLPSI.css') }}">
|
2020-11-22 17:11:23 +01:00
|
|
|
|
<script type="text/javascript">
|
2020-11-23 01:41:22 +01:00
|
|
|
|
function adjust_size() {
|
2020-12-07 01:21:16 +01:00
|
|
|
|
const pensum = document.querySelector('#Pensum');
|
|
|
|
|
const inputs = pensum.querySelectorAll('input');
|
|
|
|
|
inputs.forEach((input) => {
|
2020-11-23 01:41:22 +01:00
|
|
|
|
if (input.type=="text") {
|
2020-12-07 01:21:16 +01:00
|
|
|
|
input.setAttribute("value", "");
|
|
|
|
|
input.setAttribute("style", "width: " + input.dataset.expected.length + "em");
|
2020-11-23 01:41:22 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-25 23:50:44 +01:00
|
|
|
|
function nomacron_to_macron(char) {
|
2020-11-23 02:44:15 +01:00
|
|
|
|
var mapper = { 'A': 'Ā',
|
|
|
|
|
'a': 'ā',
|
|
|
|
|
'E': 'Ē',
|
|
|
|
|
'e': 'ē',
|
|
|
|
|
'I': 'Ī',
|
|
|
|
|
'i': 'ī',
|
|
|
|
|
'O': 'Ō',
|
|
|
|
|
'o': 'ō',
|
|
|
|
|
'U': 'Ū',
|
|
|
|
|
'u': 'ū'};
|
|
|
|
|
return mapper[char[0]];
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-25 23:50:44 +01:00
|
|
|
|
function macron_to_nomacron(char) {
|
|
|
|
|
var mapper = { 'Ā': 'A',
|
|
|
|
|
'ā': 'a',
|
|
|
|
|
'Ē': 'E',
|
|
|
|
|
'ē': 'e',
|
|
|
|
|
'Ī': 'I',
|
|
|
|
|
'ī': 'i',
|
|
|
|
|
'Ō': 'O',
|
|
|
|
|
'ō': 'o',
|
|
|
|
|
'Ū': 'U',
|
|
|
|
|
'ū': 'u'};
|
|
|
|
|
return mapper[char];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function input_to_nomacron(input) {
|
|
|
|
|
return input.replace(/Ā|ā|Ē|ē|Ī|ī/, macron_to_nomacron);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-23 02:44:15 +01:00
|
|
|
|
function input_to_macron(input) {
|
2020-11-25 23:50:44 +01:00
|
|
|
|
return input.replace(/(\w)\1/, nomacron_to_macron);
|
2020-11-23 02:44:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-25 23:50:44 +01:00
|
|
|
|
|
2020-11-22 17:11:23 +01:00
|
|
|
|
function validate() {
|
2020-12-07 01:21:16 +01:00
|
|
|
|
const pensum = document.querySelector('#Pensum');
|
|
|
|
|
const inputs = pensum.querySelectorAll('input');
|
2020-11-22 17:11:23 +01:00
|
|
|
|
|
2020-12-07 01:21:16 +01:00
|
|
|
|
inputs.forEach((input) => {
|
2020-11-25 23:50:44 +01:00
|
|
|
|
if (input.type=="text" && document.getElementById('vowel_length').checked == false) {
|
|
|
|
|
is_macron_ok = (input.value == input_to_nomacron(input.dataset.expected));
|
|
|
|
|
is_double_ok = false;
|
|
|
|
|
} else {
|
|
|
|
|
is_double_ok = (input_to_macron(input.value) == input.dataset.expected);
|
|
|
|
|
is_macron_ok = (input.value == input.dataset.expected);
|
|
|
|
|
}
|
2020-11-23 02:44:15 +01:00
|
|
|
|
if (input.type=="text" && !(is_double_ok || is_macron_ok)) {
|
2020-12-03 20:22:58 +01:00
|
|
|
|
input.setAttribute("class", "incorrect");
|
2020-11-23 02:44:15 +01:00
|
|
|
|
} else if (input.type=="text") {
|
2020-12-03 20:22:58 +01:00
|
|
|
|
input.setAttribute("class", "correct");
|
2020-11-22 17:11:23 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-11-25 22:06:46 +01:00
|
|
|
|
|
|
|
|
|
function show_answers() {
|
2020-12-07 01:21:16 +01:00
|
|
|
|
const pensum = document.querySelector('#Pensum');
|
|
|
|
|
const inputs = pensum.querySelectorAll('input');
|
2020-11-25 22:06:46 +01:00
|
|
|
|
|
2020-12-07 01:21:16 +01:00
|
|
|
|
inputs.forEach((input) => {
|
2020-11-25 22:06:46 +01:00
|
|
|
|
if (input.type=="text") {
|
2020-12-07 01:28:25 +01:00
|
|
|
|
// input.setAttribute("value", input.dataset.expected);
|
|
|
|
|
input.value = input.dataset.expected;
|
2020-12-07 01:21:16 +01:00
|
|
|
|
input.removeAttribute("class");
|
2020-11-25 22:06:46 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-11-22 17:11:23 +01:00
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2020-12-07 01:21:16 +01:00
|
|
|
|
<h1><a href="/llpsi">Lingua Latina Per Se Illustrata</a></h1>
|
2020-11-25 18:16:27 +01:00
|
|
|
|
<h2>{{pensum_title}}</h2>
|
2020-11-25 23:50:44 +01:00
|
|
|
|
Quantitās: <input type="checkbox" id="vowel_length">
|
2020-12-07 01:21:16 +01:00
|
|
|
|
<div id="Pensum">
|
2020-11-23 01:15:19 +01:00
|
|
|
|
{{pensum_content|safe}}
|
|
|
|
|
<br>
|
2020-12-07 01:21:16 +01:00
|
|
|
|
<button onclick="return validate();">Mitte</button><button onclick="return show_answers();">Responsa</button>
|
|
|
|
|
</div>
|
2020-11-23 01:41:22 +01:00
|
|
|
|
<script type="text/javascript">adjust_size();</script>
|
2020-11-22 17:11:23 +01:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|