Projekt

Obecné

Profil

Stáhnout (26.1 KB) Statistiky
| Větev: | Revize:
1 e278dcbf Ondřej Anděl
<script>
2 31a2bb94 Anděl Ondřej
    let pageIndex = 0;
3
    let itemPerPage = 50;
4
    let itemCount = 0;
5
    let pageCount = 0;
6
7
    //what to do when page renders
8 e278dcbf Ondřej Anděl
    window.onload = function() {
9 a908ef13 Anděl Ondřej
        let sourceSelect = new vanillaSelectBox("#source");
10 e278dcbf Ondřej Anděl
        filtersChange();
11 fb32f0e8 Anděl Ondřej
        fetchData(false);
12 31a2bb94 Anděl Ondřej
13
        //page-label listener
14
        document.getElementById('page-label').addEventListener('keyup',function(e){
15
            if (e.key === 'Enter' || e.keyCode === 13) {
16
                this.blur();
17
            }
18
        });
19 e278dcbf Ondřej Anděl
    };
20
</script>
21
22
<div class="search-filters container" onload="filtersChange()">
23 9a7b1f4c Ondřej Anděl
    <div class="row">
24
        <div class="mr-3">
25 a908ef13 Anděl Ondřej
            <label for="wordshape" class="mr-2">Slovo</label>
26 9a7b1f4c Ondřej Anděl
            <input type="text" id="wordshape">
27
        </div>
28 fb32f0e8 Anděl Ondřej
        <div class="mr-3">
29
            <label for="lemma" class="mr-2">Lemma</label>
30
            <input type="text" id="lemma">
31
        </div>
32 9a7b1f4c Ondřej Anděl
        <div class="mr-3">
33
            <label for="source" class="mr-2">Rukopisný pramen</label>
34 a908ef13 Anděl Ondřej
            <select id="source" multiple>
35 fb32f0e8 Anděl Ondřej
                <option value = "0">rukopis Vídeňský</option>
36
                <option value = "1">zlomky Hanušovy</option>
37
                <option value = "2">zlomky Hradecké</option>
38
                <option value = "3">rukopis Cambridžský</option>
39
                <option value = "4">rukopis Františkánský</option>
40
                <option value = "5">zlomek Olomoucký</option>
41
                <option value = "6">fragment Strahovský</option>
42
                <option value = "7">zlomky Klementinsko-Křižovnické</option>
43
                <option value = "8">zlomky Mnichovské</option>
44
                <option value = "9">rukopis Lobkovický</option>
45
                <option value = "10">rukopis Pelclův</option>
46
                <option value = "11">rukopis Cerronský</option>
47
                <option value = "12">rukopis Fürstenberský</option>
48
                <option value = "13">rukopis Zebererův</option>
49
                <option value = "14">vydání Pavla Ješína z Bezdězi, Praha 1620</option>
50
                <option value = "15">básně připsané při Pulkavově kronice v rukopisu Litoměřickém</option>
51 a908ef13 Anděl Ondřej
            </select>
52 9a7b1f4c Ondřej Anděl
        </div>
53
        <div class="mr-3">
54 a908ef13 Anděl Ondřej
            <label for="location" class="mr-2">Pozice</label>
55 9a7b1f4c Ondřej Anděl
            <input type="text" id="location">
56
        </div>
57 e278dcbf Ondřej Anděl
58
59
        <div class="mr-3">
60
            <label for="wordclass" class="mr-2">Slovní druh</label>
61
            <select onchange="filtersChange()"  id="wordclass">
62
                <option selected="selected" value = "">Nevybráno</option>
63 fb32f0e8 Anděl Ondřej
                <option value = "N">Substantiva</option>
64
                <option value = "A">Adjektiva</option>
65
                <option value = "P">Pronomina</option>
66
                <option value = "C">Numeralia</option>
67
                <option value = "V">Verba</option>
68
                <option value = "D">Adverbia</option>
69
                <option value = "R">Prepozice</option>
70
                <option value = "J">Konjunkce</option>
71
                <option value = "I">Interjekce</option>
72
                <option value = "T">Partikule</option>
73 e278dcbf Ondřej Anděl
            </select>
74
        </div>
75
76
        <script>
77
            function filtersChange() {
78
                const value = document.getElementById("wordclass").value;
79
                switch (value) {
80 fb32f0e8 Anděl Ondřej
                    case "N":
81 e278dcbf Ondřej Anděl
                        setFilerVisibility([
82
                            true,
83
                            true,
84
                            true,
85
                            false,
86
                            false,
87
                            false,
88
                            false,
89
                            false,
90
                            false,
91
                            false,
92
                            false,
93 c2873e44 Anděl Ondřej
                            false,
94 e278dcbf Ondřej Anděl
                            false
95
                        ]);
96
                        break;
97 fb32f0e8 Anděl Ondřej
                    case "A":
98 e278dcbf Ondřej Anděl
                        setFilerVisibility([
99
                            true,
100
                            true,
101
                            true,
102
                            true,
103
                            true,
104
                            false,
105
                            false,
106
                            false,
107
                            false,
108
                            false,
109
                            false,
110 c2873e44 Anděl Ondřej
                            false,
111 e278dcbf Ondřej Anděl
                            false
112
                        ]);
113
                        break;
114 fb32f0e8 Anděl Ondřej
                    case "P":
115 e278dcbf Ondřej Anděl
                        setFilerVisibility([
116
                            true,
117
                            true,
118
                            true,
119
                            false,
120
                            false,
121
                            true,
122
                            false,
123
                            false,
124
                            false,
125
                            false,
126
                            false,
127 c2873e44 Anděl Ondřej
                            false,
128 e278dcbf Ondřej Anděl
                            false
129
                        ]);
130
                        break;
131 fb32f0e8 Anděl Ondřej
                    case "C":
132 e278dcbf Ondřej Anděl
                        setFilerVisibility([
133
                            true,
134
                            true,
135
                            true,
136
                            false,
137
                            false,
138
                            false,
139
                            false,
140
                            false,
141
                            false,
142
                            false,
143
                            false,
144 c2873e44 Anděl Ondřej
                            false,
145 e278dcbf Ondřej Anděl
                            false
146
                        ]);
147
                        break;
148 fb32f0e8 Anděl Ondřej
                    case "V":
149 e278dcbf Ondřej Anděl
                        setFilerVisibility([
150
                            true,
151
                            true,
152
                            true,
153
                            false,
154
                            false,
155
                            false,
156
                            true,
157
                            true,
158
                            true,
159
                            true,
160
                            true,
161 c2873e44 Anděl Ondřej
                            true,
162 e278dcbf Ondřej Anděl
                            false
163
                        ]);
164
                        break;
165 fb32f0e8 Anděl Ondřej
                    case "D":
166 e278dcbf Ondřej Anděl
                        setFilerVisibility([
167
                            false,
168
                            false,
169
                            false,
170
                            false,
171
                            true,
172
                            false,
173
                            false,
174
                            false,
175
                            false,
176
                            false,
177
                            false,
178 c2873e44 Anděl Ondřej
                            false,
179 e278dcbf Ondřej Anděl
                            false
180
                        ]);
181
                        break;
182 fb32f0e8 Anděl Ondřej
                    case "R":
183 e278dcbf Ondřej Anděl
                        setFilerVisibility([
184
                            true,
185
                            false,
186
                            false,
187
                            false,
188
                            false,
189
                            false,
190
                            false,
191
                            false,
192
                            false,
193
                            false,
194
                            false,
195 c2873e44 Anděl Ondřej
                            false,
196 e278dcbf Ondřej Anděl
                            false
197
                        ]);
198
                        break;
199 fb32f0e8 Anděl Ondřej
                    case "J":
200 e278dcbf Ondřej Anděl
                        setFilerVisibility([
201
                            false,
202
                            false,
203
                            false,
204
                            false,
205
                            false,
206
                            false,
207
                            false,
208
                            false,
209
                            false,
210
                            false,
211
                            false,
212 c2873e44 Anděl Ondřej
                            false,
213 e278dcbf Ondřej Anděl
                            true
214
                        ]);
215
                        break;
216 fb32f0e8 Anděl Ondřej
                    case "I":
217 e278dcbf Ondřej Anděl
                        setFilerVisibility([
218
                            false,
219
                            false,
220
                            false,
221
                            false,
222
                            false,
223
                            false,
224
                            false,
225
                            false,
226
                            false,
227
                            false,
228
                            false,
229 c2873e44 Anděl Ondřej
                            false,
230 e278dcbf Ondřej Anděl
                            false
231
                        ]);
232
                        break;
233 fb32f0e8 Anděl Ondřej
                    case "T":
234 e278dcbf Ondřej Anděl
                        setFilerVisibility([
235
                            false,
236
                            false,
237
                            false,
238
                            false,
239
                            false,
240
                            false,
241
                            false,
242
                            false,
243
                            false,
244
                            false,
245
                            false,
246 c2873e44 Anděl Ondřej
                            false,
247 e278dcbf Ondřej Anděl
                            false
248
                        ]);
249
                        break;
250
                    default:
251
                        setFilerVisibility([
252
                            false,
253
                            false,
254
                            false,
255
                            false,
256
                            false,
257
                            false,
258
                            false,
259
                            false,
260
                            false,
261
                            false,
262
                            false,
263 c2873e44 Anděl Ondřej
                            false,
264 e278dcbf Ondřej Anděl
                            false
265
                        ]);
266
                        break;
267
                }
268
            }
269
270
            function setFilerVisibility(visibility) {
271
                const id = [
272
                    "filter-case",
273
                    "filter-countability",
274
                    "filter-gender",
275
                    "filter-shape",
276
                    "filter-grade",
277
                    "filter-type",
278
                    "filter-mood",
279 c2873e44 Anděl Ondřej
                    "filter-irregular",
280 e278dcbf Ondřej Anděl
                    "filter-person",
281
                    "filter-time",
282
                    "filter-vid",
283
                    "filter-v-type",
284
                    "filter-k-type"
285
                ];
286
287
                for(let i = 0; i < id.length &&  i < visibility.length; i++){
288
                    document.getElementById(id[i]).style.display = visibility[i] === true ? "" : "none";
289
                    document.getElementById(id[i].replace("filter-", "")).value = "";
290
                }
291
            }
292
        </script>
293
294
        <!-- conditionaly rendered filters-->
295
        <div class="mr-3" id="filter-case">
296
            <label for="case" class="mr-2">Pád</label>
297
            <select id="case">
298
                <option selected="selected" value = "">Nevybráno</option>
299
                <option value = "1">Nominativ</option>
300
                <option value = "2">Genitiv</option>
301
                <option value = "3">Dativ</option>
302
                <option value = "4">Akuzativ</option>
303
                <option value = "5">Vokativ</option>
304
                <option value = "6">Lokál</option>
305
                <option value = "7">Instrumentál</option>
306
            </select>
307
        </div>
308
        <div class="mr-3" id="filter-countability">
309
            <label for="countability" class="mr-2">Číslo</label>
310
            <select id="countability">
311
                <option selected="selected" value = "">Nevybráno</option>
312 a908ef13 Anděl Ondřej
                <option value = "S">Singulár</option>
313
                <option value = "P">Plurál</option>
314
                <option value = "D">Duál</option>
315 e278dcbf Ondřej Anděl
            </select>
316
        </div>
317
        <div class="mr-3" id="filter-gender">
318
            <label for="gender" class="mr-2">Rod</label>
319
            <select id="gender">
320
                <option selected="selected" value = "">Nevybráno</option>
321 a908ef13 Anděl Ondřej
                <option value = "M">Maskulinum</option>
322
                <option value = "F">Femininum</option>
323
                <option value = "N">Neutrum</option>
324 e278dcbf Ondřej Anděl
            </select>
325
        </div>
326
        <div class="mr-3" id="filter-shape">
327
            <label for="shape" class="mr-2">Tvar</label>
328
            <select id="shape">
329
                <option selected="selected" value = "">Nevybráno</option>
330 a908ef13 Anděl Ondřej
                <option value = "C">Složený</option>
331
                <option value = "N">Jmenný</option>
332 e278dcbf Ondřej Anděl
            </select>
333
        </div>
334
        <div class="mr-3" id="filter-grade">
335
            <label for="grade" class="mr-2">Stupeň</label>
336
            <select id="grade">
337
                <option selected="selected" value = "">Nevybráno</option>
338
                <option value = "1">Pozitiv</option>
339
                <option value = "2">Komparativ</option>
340
                <option value = "3">Superlativ</option>
341
            </select>
342
        </div>
343
        <div class="mr-3" id="filter-type">
344
            <label for="type" class="mr-2">Druh</label>
345
            <select id="type">
346
                <option selected="selected" value = "">Nevybráno</option>
347 a908ef13 Anděl Ondřej
                <option value = "P">Personalia</option>
348
                <option value = "S">Posesiva</option>
349
                <option value = "D">Demonstrativa</option>
350
                <option value = "Q">Interogativa</option>
351
                <option value = "J">Relativa</option>
352
                <option value = "Z">Indefinita</option>
353
                <option value = "L">Limitativa</option>
354
                <option value = "W">Negativa</option>
355 e278dcbf Ondřej Anděl
            </select>
356
        </div>
357
        <div class="mr-3" id="filter-mood">
358 a908ef13 Anděl Ondřej
            <label for="mood" class="mr-2">Způsob</label>
359 d7f65101 Anděl Ondřej
            <select id="mood" onchange="moodChange()">
360 e278dcbf Ondřej Anděl
                <option selected="selected" value = "">Nevybráno</option>
361 a908ef13 Anděl Ondřej
                <option value = "d">Indikativ</option>
362
                <option value = "i">Imperativ</option>
363
                <option value = "c">Kondicionál</option>
364 c2873e44 Anděl Ondřej
            </select>
365
        </div>
366
        <div class="mr-3" id="filter-irregular">
367
            <label for="irregular" class="mr-2">Neurčitý slovesný tvar</label>
368 d7f65101 Anděl Ondřej
            <select id="irregular" onchange="irregularChange()">
369 c2873e44 Anděl Ondřej
                <option selected="selected" value = "">Nevybráno</option>
370
                <option value = "f">Infinitiv</option>
371 a908ef13 Anděl Ondřej
                <option value = "S">Supinum</option>
372
                <option value = "e">Přech. přítomný</option>
373
                <option value = "m">Přech. minulý</option>
374
                <option value = "A">Part. perf. akt.</option>
375
                <option value = "P">Part. perf. pas.</option>
376 e278dcbf Ondřej Anděl
            </select>
377
        </div>
378
        <div class="mr-3" id="filter-person">
379
            <label for="person" class="mr-2">Osoba</label>
380
            <select id="person">
381
                <option selected="selected" value = "">Nevybráno</option>
382
                <option value = "1">1.</option>
383
                <option value = "2">2.</option>
384
                <option value = "3">3.</option>
385
            </select>
386
        </div>
387
        <div class="mr-3" id="filter-time">
388
            <label for="time" class="mr-2">Čas</label>
389
            <select id="time">
390
                <option selected="selected" value = "">Nevybráno</option>
391 a908ef13 Anděl Ondřej
                <option value = "P">Prézens</option>
392
                <option value = "A">Aorist</option>
393
                <option value = "R">Préteritum</option>
394
                <option value = "I">Imperfektum</option>
395
                <option value = "H">Plusquamperfektum</option>
396
                <option value = "F">Futurum</option>
397 e278dcbf Ondřej Anděl
            </select>
398
        </div>
399
        <div class="mr-3" id="filter-vid">
400 a908ef13 Anděl Ondřej
            <label for="vid" class="mr-2">Vid</label>
401 e278dcbf Ondřej Anděl
            <select id="vid">
402
                <option selected="selected" value = "">Nevybráno</option>
403 a908ef13 Anděl Ondřej
                <option value = "P">Perfektivum</option>
404
                <option value = "I">Imperfektivum </option>
405 e278dcbf Ondřej Anděl
            </select>
406
        </div>
407
        <div class="mr-3" id="filter-v-type">
408 a908ef13 Anděl Ondřej
            <label for="v-type" class="mr-2">Slovesný rod</label>
409 e278dcbf Ondřej Anděl
            <select id="v-type">
410
                <option selected="selected" value = "">Nevybráno</option>
411 a908ef13 Anděl Ondřej
                <option value = "A">Aktivum</option>
412
                <option value = "P">Pasivum</option>
413 e278dcbf Ondřej Anděl
            </select>
414
        </div>
415
        <div class="mr-3" id="filter-k-type">
416
            <label for="k-type" class="mr-2">Typ</label>
417
            <select id="k-type">
418
                <option selected="selected" value = "">Nevybráno</option>
419 a908ef13 Anděl Ondřej
                <option value = "V">Větná</option>
420
                <option value = "C">Členská</option>
421
                <option value = "N">Navazovací</option>
422
                <option value = "P">Spojení s přechodníkem</option>
423 e278dcbf Ondřej Anděl
            </select>
424
        </div>
425 a908ef13 Anděl Ondřej
426
        <!-- send button-->
427 31a2bb94 Anděl Ondřej
        <button class="ml-auto btn" onclick="callFilter()">
428 a908ef13 Anděl Ondřej
            Filtrovat
429
        </button>
430 9a7b1f4c Ondřej Anděl
    </div>
431
</div>
432
433
<div class="search-results my-4">
434
    <table class="table table-striped">
435
        <thead>
436
        <tr>
437 a908ef13 Anděl Ondřej
            <th scope="col">Slovo</th>
438 9a7b1f4c Ondřej Anděl
            <th scope="col">Lemma</th>
439 e278dcbf Ondřej Anděl
            <th scope="col">Rukopisy</th>
440
            <th scope="col">Pozice</th>
441 9a7b1f4c Ondřej Anděl
            <th scope="col"></th>
442
        </tr>
443
        </thead>
444
        <tbody id="search-table">
445
            <script>
446 d7f65101 Anděl Ondřej
                function moodChange() {
447
                    if(document.getElementById("mood").value !== ""){
448
                        document.getElementById("irregular").disabled = true;
449
                        document.getElementById("irregular").title = "Neurčitý slovesný tvar smí být nastaven pouze není-li nastaven způsob";
450
                    } else {
451
                        document.getElementById("irregular").disabled = false;
452
                        document.getElementById("irregular").title = "";
453
                    }
454
                }
455
456
                function irregularChange() {
457
                    if(document.getElementById("irregular").value !== ""){
458
                        document.getElementById("mood").disabled = true;
459
                        document.getElementById("mood").title = "Způsob smí být nastaven pouze není-li nastaven neurčitý slovesný tvar";
460
                    } else {
461
                        document.getElementById("mood").disabled = false;
462
                        document.getElementById("mood").title = "";
463
                    }
464
                }
465
466 a908ef13 Anděl Ondřej
                let data;
467 31a2bb94 Anděl Ondřej
                function callFilter() {
468
                    pageIndex = 0;
469
                    fetchData(true)
470
                }
471
472 fb32f0e8 Anděl Ondřej
                function filterData (formData) {
473
                    //regular
474
                    formData.append("lemma", document.getElementById("lemma").value);
475
                    formData.append("word", document.getElementById("wordshape").value);
476
477
                    //positions
478
                    const positionSplit = document.getElementById("location").value.split("/");
479
                    formData.append("position1", positionSplit[0] !== undefined ? positionSplit[0] : "");
480
                    formData.append("position2", positionSplit[1] !== undefined ? positionSplit[1] : "");
481
                    formData.append("positiondetail", positionSplit[2] !== undefined ? positionSplit[2] : "");
482 a908ef13 Anděl Ondřej
483 fb32f0e8 Anděl Ondřej
                    //multiselect
484
                    formData.append("manuscript", getValues("source"));
485
486
                    const pos = document.getElementById("wordclass").value;
487
                    formData.append("tag_pos", pos);
488
                    //those upcoming are dynamic based on the previous field
489
                    formData.append("tag_case", document.getElementById("case").value);
490
                    formData.append("tag_number", document.getElementById("countability").value);
491
                    formData.append("tag_gender", document.getElementById("gender").value);
492
                    formData.append("tag_degree", document.getElementById("grade").value);
493
                    formData.append("tag_shape", document.getElementById("shape").value);
494
                    formData.append("tag_num", "");//THIS ONE IS WORTHLESS
495
496
                    if(pos === "P"){
497
                        formData.append("tag_sentence", document.getElementById("type").value);
498
                    } else if(pos === "V"){
499 c2873e44 Anděl Ondřej
                        const mood = document.getElementById("mood").value;
500
                        if(mood !== ""){
501
                            formData.append("tag_sentence", mood);
502
                        } else {
503
                            formData.append("tag_sentence", document.getElementById("irregular").value);
504
                        }
505 fb32f0e8 Anděl Ondřej
                    } else if(pos === "J"){
506
                        formData.append("tag_sentence", document.getElementById("k-type").value);
507
                    }
508
509
                    formData.append("tag_verb_person", document.getElementById("person").value);
510
                    formData.append("tag_verb_time", document.getElementById("time").value);
511
                    formData.append("tag_verb_degree", document.getElementById("vid").value);
512
                    formData.append("tag_verb_aspect", document.getElementById("v-type").value);
513
                }
514
515
                function fetchData (filter = true) {
516 a908ef13 Anděl Ondřej
                    // (A1) GET SEARCH TERM
517
                    const formData = new FormData();
518 31a2bb94 Anděl Ondřej
                    formData.append("page", ""+pageIndex);
519
                    formData.append("items_per_page", ""+itemPerPage);
520 a908ef13 Anděl Ondřej
                    formData.append("finished", "true");//TODO ADMIN
521
522 fb32f0e8 Anděl Ondřej
                    if(filter){
523
                        filterData(formData);
524
                    }
525
526 a908ef13 Anděl Ondřej
                    // (A2) AJAX - USE HTTP:// NOT FILE://
527
                    let xhr = new XMLHttpRequest();
528
                    xhr.open("POST", "./controller/TableController.php");
529
                    xhr.onload = function(){
530
                        let search = this.response;
531
                        let parsedJSON = JSON.parse(search);
532 fb32f0e8 Anděl Ondřej
                        if(parsedJSON.count === 0){
533
                            document.getElementById("no-data-label").style.display = "";
534 31a2bb94 Anděl Ondřej
                            document.getElementById("paging-control").style.display = "none";
535 fb32f0e8 Anděl Ondřej
                        } else {
536
                            document.getElementById("no-data-label").style.display = "none";
537 31a2bb94 Anděl Ondřej
                            document.getElementById("paging-control").style.display = "";
538 fb32f0e8 Anděl Ondřej
                        }
539 31a2bb94 Anděl Ondřej
                        itemCount = parsedJSON.count;
540
                        pageCount = Math.ceil(itemCount / itemPerPage);
541
                        document.getElementById("page-label").value = (pageIndex + 1) + " / " + pageCount;
542 a908ef13 Anděl Ondřej
                        data = parsedJSON.data;
543
                        renderData(parsedJSON.data);
544
                    };
545
                    xhr.send(formData);
546
                }
547
548
                function renderManuscript(manuscripts, shorten=true) {
549
                    let output = "";
550
                    for(let i = 0; i < manuscripts.length; i++){
551 36708281 Anděl Ondřej
                        if(shorten)
552
                            output += codeToManuscriptShort[manuscripts[i]];
553
                        else
554
                            output += codeToManuscript[manuscripts[i]];
555 a908ef13 Anděl Ondřej
556
                        if(i < manuscripts.length - 1){
557 36708281 Anděl Ondřej
                            if(shorten)
558
                                output += ", ";
559
                            else
560
                                output += "; ";
561 a908ef13 Anděl Ondřej
                        }
562
                    }
563
                    return output;
564
                }
565
566
                function renderData(data) {
567
                    let result = "";
568
                    data.forEach((item,id) => {
569
                        result += "<tr>";
570
                        result += "<td>" + item.word + "</td>";
571
                        result += "<td>" + item.lemma.lemma + "</td>";
572
                        result += "<td>" + renderManuscript(item.manuscript) + "</td>";
573
                        result += "<td>" + item.position1 + (item.position2 ? ("/" + item.position2 + (item.positiondetail ? "/"  + item.positiondetail :  "")) : "")  + "</td>";
574
                        result += "<td class=\"action-td\">" +
575
                            "<button class=\"btn\" title=\"Detail\"  data-toggle=\"modal\" data-target=\"#detail-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-search\"></i></button>" +
576
                            "</td>";
577
                        result += "</tr>";
578
                    });
579
                    document.getElementById("search-table").innerHTML = result;
580
                }
581 9a7b1f4c Ondřej Anděl
            </script>
582
        </tbody>
583
    </table>
584 fb32f0e8 Anděl Ondřej
585
    <h3 id="no-data-label" class="mx-auto text-center font-italic">Žádná data nebyla nalezena</h3>
586 31a2bb94 Anděl Ondřej
587
    <script>
588
        function moveToFirst(){
589
            pageIndex = 0;
590
            fetchData(true);
591
        }
592
593
        function moveToPrevious(){
594
            pageIndex = (pageIndex - 1 > 0) ? (pageIndex - 1) : (0);
595
            fetchData(true);
596
        }
597
598
        function moveToNext(){
599
            pageIndex = (pageIndex + 1 < pageCount) ? (pageIndex + 1) : (pageCount - 1);
600
            fetchData(true);
601
        }
602
603
        function moveToLast(){
604
            pageIndex = pageCount - 1;
605
            fetchData(true);
606
        }
607
608
        function onManualPageStart(element){
609
            element.value = '';
610
        }
611
612
        function onManualPageEnd(element) {
613
            const value = Number(element.value) - 1;
614
            if(Number.isInteger(value) && value >= 0 && value < pageCount){
615
                pageIndex = value;
616
                fetchData(true);
617
            } else {
618
                element.value = (pageIndex + 1) + " / " + pageCount;
619
            }
620
621
        }
622
    </script>
623
    <div id="paging-control" class="mx-auto text-center" style="display: none">
624
        <button class="border-0 shadow-none bg-transparent" onclick="moveToFirst()"><b><<</b></button>
625
        <button class="border-0 shadow-none bg-transparent"  onclick="moveToPrevious()"><b><</b></button>
626
        <input class="border-0 shadow-none bg-transparent text-center font-weight-bold"
627
               id="page-label"
628
               onfocus="onManualPageStart(this)"
629
               onblur="onManualPageEnd(this)"
630
        />
631
        <button class="border-0 shadow-none bg-transparent"  onclick="moveToNext()"><b>></b></button>
632
        <button  class="border-0 shadow-none bg-transparent" onclick="moveToLast()"><b>>></b></button>
633
    </div>
634 9a7b1f4c Ondřej Anděl
</div>
635