-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
104 lines (87 loc) · 12.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html>
<head>
<title>
LT Exercise -- Noun Genitive Single
</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/ToC.css">
<link rel="stylesheet" href="css/pageStructure.css">
<script type="text/javascript" src="js/Common.js"> </script>
<script type="text/javascript">
ButtonNext_OnPageLoad();
SetupArrayFunctions();
var samplesAsJson = '[{"Chunk1": "Aš esu prie", "NounToChange": "Panevėžis", "Answer" : "Panevėžio", "Ending" : "is"},{"Chunk1": "Aš esu prie", "NounToChange": "Pasvalys", "Answer" : "Pasvalio", "Ending" : "ys"},{"Chunk1": "Aš esu prie", "NounToChange": "Švenčionys", "Answer" : "Švenčionio", "Ending" : "ys"},{"Chunk1": "Aš esu prie", "NounToChange": "Kaišiadorys", "Answer" : "Kaišiodorio", "Ending" : "ys"},{"Chunk1": "Aš esu prie", "NounToChange": "Pandelys", "Answer" : "Pandelio", "Ending" : "ys"},{"Chunk1": "Aš givenu prie", "NounToChange": "Viešbutis", "Answer" : "Viešbučio", "Ending" : "is"},{"Chunk1": "Aš givenu prie", "NounToChange": "Bendrabutis", "Answer" : "Bendrabučio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Lentvaris", "Answer" : "Lentvario", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Radviliškis", "Answer" : "Radviliškio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Rokiškis", "Answer" : "Rokiškio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Joniškis", "Answer" : "Joniškio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Gelgaudiškis", "Answer" : "Gelgaudiškio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Didžiasalis", "Answer" : "Didžiasalio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Joniškėlis", "Answer" : "Joniškėlio", "Ending" : "is"},{"Chunk1": "Aš iš", "NounToChange": "Vilnius", "Answer" : "Vilniaus", "Ending" : "us"},{"Chunk1": "Aš iš", "NounToChange": "Alytus", "Answer" : "Alytaus", "Ending" : "us"},{"Chunk1": "Aš iš", "NounToChange": "Subačius", "Answer" : "Subačiaus", "Ending" : "us"},{"Chunk1": "Aš iš", "NounToChange": "Nida", "Answer" : "Nidos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Klaipėda", "Answer" : "Klaipėdos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Ignalina", "Answer" : "Ignalinos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Jonava", "Answer" : "Jonavos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Utena", "Answer" : "Utenos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Kretinga", "Answer" : "Kretingos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Palanga", "Answer" : "Palangos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Garilava", "Answer" : "Garilavos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Kalvarija", "Answer" : "Kalvarijos", "Ending" : "a"},{"Chunk1": "Aš iš", "NounToChange": "Marijampolė", "Answer" : "Marijampolės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Tauragė", "Answer" : "Tauragės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Ukmergė", "Answer" : "Ukmergės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Plungė", "Answer" : "Plungės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Šilutė", "Answer" : "Šilutės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Kelmė", "Answer" : "Klemės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Pabradė", "Answer" : "Pabradės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Akmenė", "Answer" : "Akmenės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Žagarė", "Answer" : "Žagarės", "Ending" : "ė"},{"Chunk1": "Aš iš", "NounToChange": "Priekulė", "Answer" : "Priekulės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "auditorija", "Answer" : "auditorijos", "Ending" : "a"},{"Chunk1": "Aš prie", "NounToChange": "ambasada", "Answer" : "ambasados", "Ending" : "a"},{"Chunk1": "Aš prie", "NounToChange": "jūra", "Answer" : "jūros", "Ending" : "a"},{"Chunk1": "Aš prie", "NounToChange": "mokykla", "Answer" : "mokyklos", "Ending" : "a"},{"Chunk1": "Aš prie", "NounToChange": "aikštė", "Answer" : "aikštės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "kavinė", "Answer" : "kavinės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "ligoninė", "Answer" : "ligoninės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "parduotuvė", "Answer" : "parduotuvės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "rotušė", "Answer" : "rotušės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "stotelė", "Answer" : "stotelės", "Ending" : "ė"},{"Chunk1": "Aš prie", "NounToChange": "bankas", "Answer" : "banko", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "baras", "Answer" : "baro", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "centras", "Answer" : "centro", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "fontanas", "Answer" : "fontano", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "paminklas", "Answer" : "paminklo", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "parkas", "Answer" : "parko", "Ending" : "as"},{"Chunk1": "Aš prie", "NounToChange": "tiltas", "Answer" : "tilto", "Ending" : "as"},{"Chunk1": "Aš už", "NounToChange": "katedra", "Answer" : "katedros", "Ending" : "a"},{"Chunk1": "Aš už", "NounToChange": "sankryža", "Answer" : "sankryžos", "Ending" : "a"},{"Chunk1": "Aš už", "NounToChange": "upė", "Answer" : "upės", "Ending" : "ė"},{"Chunk1": "Aš už", "NounToChange": "namas", "Answer" : "namo", "Ending" : "as"},{"Chunk1": "Aš už", "NounToChange": "teatras", "Answer" : "teatro", "Ending" : "as"},{"Chunk1": "Aš už", "NounToChange": "klubas", "Answer" : "klubo", "Ending" : "as"},{"Chunk1": "Be", "NounToChange": "arbata", "Answer" : "arbatos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "citrina", "Answer" : "citrinos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "dešra", "Answer" : "dešros", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "druska", "Answer" : "druskos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "duona", "Answer" : "duonos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "jautena", "Answer" : "jautenos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "kalakutiena", "Answer" : "kalakutienos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "kava", "Answer" : "kavos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "kiauliena", "Answer" : "kiaulienos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "mėsa", "Answer" : "mėsos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "morka", "Answer" : "morkos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "paprika", "Answer" : "paprikos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "salota", "Answer" : "salotos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "slyva", "Answer" : "slyvos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "sriuba", "Answer" : "sriubos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "uoga", "Answer" : "uogos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "vyšnia", "Answer" : "vyšnios", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "vištiena", "Answer" : "vištienos", "Ending" : "a"},{"Chunk1": "Be", "NounToChange": "bandelė", "Answer" : "bandelės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "braškė", "Answer" : "braškės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "bulvė", "Answer" : "bulvės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "daržovė", "Answer" : "daržovės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "grietinė", "Answer" : "grietinės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "grietinėlė", "Answer" : "grietinėlės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "kriaušė", "Answer" : "kriaušės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "pupelė", "Answer" : "pupelės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "uogienė", "Answer" : "uogienės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "varškė", "Answer" : "varškės", "Ending" : "ė"},{"Chunk1": "Be", "NounToChange": "vynuogė", "Answer" : "vynuogės", "Ending" : "ė"},{"Chunk1": "Čia nėra", "NounToChange": "kepsnis", "Answer" : "kepsnio", "Ending" : "is"},{"Chunk1": "Čia nėra", "NounToChange": "obuolys", "Answer" : "obuolio", "Ending" : "ys"},{"Chunk1": "Geros", "NounToChange": "diena", "Answer" : "dienos", "Ending" : "a"},{"Chunk1": "Jos prie", "NounToChange": "muziejus", "Answer" : "muziejaus", "Ending" : "us"},{"Chunk1": "Jos prie", "NounToChange": "turgus", "Answer" : "turgaus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "skaičius", "Answer" : "skaičiaus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "popierius", "Answer" : "popieriaus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "karalius", "Answer" : "karaliaus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "lietus", "Answer" : "lietaus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "cukrus", "Answer" : "cukraus", "Ending" : "us"},{"Chunk1": "Nėra", "NounToChange": "mergina", "Answer" : "merginos", "Ending" : "a"},{"Chunk1": "Nėra", "NounToChange": "ekskursija", "Answer" : "ekskursijos", "Ending" : "a"},{"Chunk1": "Nėra", "NounToChange": "studentė", "Answer" : "studentės", "Ending" : "ė"},{"Chunk1": "Nėra", "NounToChange": "cigaretė", "Answer" : "cigaretės", "Ending" : "ė"},{"Chunk1": "Nėra", "NounToChange": "klientė", "Answer" : "klientės", "Ending" : "ė"},{"Chunk1": "Nėra", "NounToChange": "kortelė", "Answer" : "kortelės", "Ending" : "ė"},{"Chunk1": "Nėra", "NounToChange": "adresas", "Answer" : "adreso", "Ending" : "as"},{"Chunk1": "Nėra", "NounToChange": "draugas", "Answer" : "draugo", "Ending" : "as"},{"Chunk1": "Nėra", "NounToChange": "pasas", "Answer" : "paso", "Ending" : "as"},{"Chunk1": "Nėra", "NounToChange": "telefonas", "Answer" : "telefono", "Ending" : "as"},{"Chunk1": "Peronas yra už", "NounToChange": "traukinys", "Answer" : "traukinio", "Ending" : "ys"},{"Chunk1": "Prie", "NounToChange": "paviršius", "Answer" : "paviršiaus", "Ending" : "us"},{"Chunk1": "Prie", "NounToChange": "žmogus", "Answer" : "žmogaus", "Ending" : "us"},{"Chunk1": "Už", "NounToChange": "dangus", "Answer" : "dangaus", "Ending" : "us"},{"Chunk1": "Visaginas yra prie", "NounToChange": "Ignalina", "Answer" : "Ignalinos", "Ending" : "a"}]';
// Get array of objects {Ending, [{Chunk1, NounToChange, Answer, Ending}]}
var result = JSON
.parse(samplesAsJson)
.GroupBy((elem) => (elem.Ending), "Ending");
var currentSample = result.random().values.random();
var notification = {};
function onNextActionButtonClick(){
// Check if it's answer request or next sample request
var isAnswerRequest = false;
var button = document.getElementById('NextActionButton');
if(button.innerText == 'Check answer') {isAnswerRequest = true;}
else {isAnswerRequest = false;}
// Call the respective function based on the request type
if(isAnswerRequest){
onAnswerRequest();
}
else { onNextSampleRequest(); }
// Temp - output ToC
// GetArrayOfUrls();
}
function onAnswerRequest(){
// Show answer
var answerDiv = document.getElementById('Answer');
answerDiv.innerHTML = currentSample.Chunk1 + ' ' + currentSample.Answer;
// Amend button text
var button = document.getElementById('NextActionButton');
button.innerText = 'Next';
// Amend notification
notification.Answer = answerDiv.innerHTML;
}
function onNextSampleRequest(){
// Clean up answer
var answerDiv = document.getElementById('Answer');
answerDiv.innerHTML = '';
// Amend button text
var button = document.getElementById('NextActionButton');
button.innerText = 'Check answer';
// Setup new sample
var randomSample = result.notRepeatingRandom(currentSample.Ending, (group) => (group.Ending)).values.random();
currentSample = randomSample;
// Setup question div
var divToAmend = document.getElementById('Question');
divToAmend.innerHTML = currentSample.Chunk1 + ' ' + currentSample.NounToChange;
// Amend notification
notification.Question = divToAmend.innerHTML;
notification.Answer = null;
}
</script>
</head>
<body>
<div id='pageStructure' class="pageStructure">
<div id='ToC' class='ToC'></div>
<script type="text/javascript" src="js/ToC.js"> </script>
<script> uploadToC(); </script>
<div id='table' class='content'>
<div id='Question'> Aš iš Vilnius </div>
<div id='Answer'> Aš iš Vilniaus </div>
<div id='Button'>
<button id='NextActionButton'
onclick="onNextActionButtonClick()">
Next
</button>
</div>
<div class="issueNotificationDiv">
<button id='notifyButton'
onclick="notify(notification.Question, notification.Answer)">
Tell about an error
</button>
</div>
</div>
</div>
</body>
</html>