Projekt

Obecné

Profil

Stáhnout (17.9 KB) Statistiky
| Větev: | Revize:
1
<div id="detail-modal" class="modal fade" role="dialog">
2
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
3
        <div class="modal-content">
4
            <div class="modal-header">
5
                <h4 class="modal-title">Detail záznamu</h4>
6
                <button type="button" class="close" data-dismiss="modal">&times;</button>
7
            </div>
8
            <div class="modal-body">
9
                <div class="container">
10
                    <div class="row">
11
                        <div class="col-xs-12 col-sm-4">
12
                            <label>Lemma:</label>
13
                        </div>
14
                        <div class="col-xs-12 col-sm-8">
15
                            <i id="lemma"></i>
16
                        </div>
17
                    </div>
18
                    <div class="row">
19
                        <div class="col-xs-12 col-sm-4">
20
                            <label>Slovní tvar:</label>
21
                        </div>
22
                        <div class="col-xs-12 col-sm-8">
23
                            <i id="word"></i>
24
                        </div>
25
                    </div>
26
                    <div class="row">
27
                        <div class="col-xs-12 col-sm-4">
28
                            <label>Datum přídání:</label>
29
                        </div>
30
                        <div class="col-xs-12 col-sm-8">
31
                            <i id="date"></i>
32
                        </div>
33
                    </div>
34
                    <div class="row">
35
                        <div class="col-xs-12 col-sm-4">
36
                            <label>Poznámka 1:</label>
37
                        </div>
38
                        <div class="col-xs-12 col-sm-8">
39
                            <i id="description"></i>
40
                        </div>
41
                    </div>
42
                    <div class="row">
43
                        <div class="col-xs-12 col-sm-4">
44
                            <label>Poznámka 2:</label>
45
                        </div>
46
                        <div class="col-xs-12 col-sm-8">
47
                            <i id="description2"></i>
48
                        </div>
49
                    </div>
50
                    <div class="row">
51
                        <div class="col-xs-12 col-sm-4">
52
                            <label>Poznámka 3:</label>
53
                        </div>
54
                        <div class="col-xs-12 col-sm-8">
55
                            <i id="description3"></i>
56
                        </div>
57
                    </div>
58
                    <div class="row">
59
                        <div class="col-xs-12 col-sm-4">
60
                            <label>Rukopisy:</label>
61
                        </div>
62
                        <div class="col-xs-12 col-sm-8">
63
                            <i id="manuscript"></i>
64
                        </div>
65
                    </div>
66
                    <div class="row">
67
                        <div class="col-xs-12 col-sm-4">
68
                            <label>Pozice:</label>
69
                        </div>
70
                        <div class="col-xs-12 col-sm-8">
71
                            <i id="position"></i>
72
                        </div>
73
                    </div>
74
                    <div class="row">
75
                        <div class="col-xs-12 col-sm-4">
76
                            <label>Vlastní jméno:</label>
77
                        </div>
78
                        <div class="col-xs-12 col-sm-8">
79
                            <i id="namedentity"></i>
80
                        </div>
81
                    </div>
82
                    <div class="row">
83
                        <div class="col-xs-12 col-sm-4">
84
                            <label>Kontext:</label>
85
                        </div>
86
                        <div class="col-xs-12 col-sm-8">
87
                            <i id="context"></i>
88
                        </div>
89
                    </div>
90
                    <div class="row">
91
                        <div class="col-xs-12 col-sm-4">
92
                            <label>Slovní druh:</label>
93
                        </div>
94
                        <div class="col-xs-12 col-sm-8">
95
                            <i id="wordclass"></i>
96
                        </div>
97
                    </div>
98

    
99
                    <!-- conditional render -->
100
                    <div class="row" id="person-wrapper">
101
                        <div class="col-xs-12 col-sm-4">
102
                            <label>Osoba:</label>
103
                        </div>
104
                        <div class="col-xs-12 col-sm-8">
105
                            <i id="person"></i>
106
                        </div>
107
                    </div>
108
                    <div class="row" id="case-wrapper">
109
                        <div class="col-xs-12 col-sm-4">
110
                            <label>Pád:</label>
111
                        </div>
112
                        <div class="col-xs-12 col-sm-8">
113
                            <i id="case"></i>
114
                        </div>
115
                    </div>
116
                    <div class="row" id="countability-wrapper">
117
                        <div class="col-xs-12 col-sm-4">
118
                            <label>Číslo:</label>
119
                        </div>
120
                        <div class="col-xs-12 col-sm-8">
121
                            <i id="countability"></i>
122
                        </div>
123
                    </div>
124
                    <div class="row" id="mood-wrapper">
125
                        <div class="col-xs-12 col-sm-4">
126
                            <label>Způsob:</label>
127
                        </div>
128
                        <div class="col-xs-12 col-sm-8">
129
                            <i id="mood"></i>
130
                        </div>
131
                    </div>
132
                    <div class="row" id="time-wrapper">
133
                        <div class="col-xs-12 col-sm-4">
134
                            <label>Čas:</label>
135
                        </div>
136
                        <div class="col-xs-12 col-sm-8">
137
                            <i id="time"></i>
138
                        </div>
139
                    </div>
140
                    <div class="row" id="v-type-wrapper">
141
                        <div class="col-xs-12 col-sm-4">
142
                            <label>Slovesný rod:</label>
143
                        </div>
144
                        <div class="col-xs-12 col-sm-8">
145
                            <i id="v-type"></i>
146
                        </div>
147
                    </div>
148
                    <div class="row" id="vid-wrapper">
149
                        <div class="col-xs-12 col-sm-4">
150
                            <label>Slovesný vid:</label>
151
                        </div>
152
                        <div class="col-xs-12 col-sm-8">
153
                            <i id="vid"></i>
154
                        </div>
155
                    </div>
156
                    <div class="row" id="irregular-wrapper">
157
                        <div class="col-xs-12 col-sm-4">
158
                            <label>Neurčitý slovesný tvar:</label>
159
                        </div>
160
                        <div class="col-xs-12 col-sm-8">
161
                            <i id="irregular"></i>
162
                        </div>
163
                    </div>
164
                    <div class="row" id="gender-wrapper">
165
                        <div class="col-xs-12 col-sm-4">
166
                            <label>Rod:</label>
167
                        </div>
168
                        <div class="col-xs-12 col-sm-8">
169
                            <i id="gender"></i>
170
                        </div>
171
                    </div>
172
                    <div class="row" id="shape-wrapper">
173
                        <div class="col-xs-12 col-sm-4">
174
                            <label>Tvar:</label>
175
                        </div>
176
                        <div class="col-xs-12 col-sm-8">
177
                            <i id="shape"></i>
178
                        </div>
179
                    </div>
180
                    <div class="row" id="grade-wrapper">
181
                        <div class="col-xs-12 col-sm-4">
182
                            <label>Stupeň:</label>
183
                        </div>
184
                        <div class="col-xs-12 col-sm-8">
185
                            <i id="grade"></i>
186
                        </div>
187
                    </div>
188
                    <div class="row" id="type-wrapper">
189
                        <div class="col-xs-12 col-sm-4">
190
                            <label>Druh:</label>
191
                        </div>
192
                        <div class="col-xs-12 col-sm-8">
193
                            <i id="type"></i>
194
                        </div>
195
                    </div>
196
                    <div class="row" id="k-type-wrapper">
197
                        <div class="col-xs-12 col-sm-4">
198
                            <label>Typ:</label>
199
                        </div>
200
                        <div class="col-xs-12 col-sm-8">
201
                            <i id="k-type"></i>
202
                        </div>
203
                    </div>
204
                </div>
205
            </div>
206
            <div class="modal-footer">
207
                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
208
            </div>
209
        </div>
210
    </div>
211
</div>
212

    
213
<script>
214
    $('#detail-modal').on('show.bs.modal', function (event) {
215
        const button = $(event.relatedTarget);
216
        const pseudo_id = button.data('pseudo-id') ;// Extract info from data-* attributes
217

    
218
        const data_obj = data[pseudo_id];
219
        let modal = $(this);
220

    
221
        modal.find('#word').text(data_obj.word);
222
        modal.find('#lemma').text(data_obj.lemma.lemma);
223
        modal.find('#description').text(data_obj.description === ""? "-" :  data_obj.description);
224
        modal.find('#description2').text(data_obj.description2 === ""? "-" :  data_obj.description2);
225
        modal.find('#description3').text(data_obj.description3 === ""? "-" :  data_obj.description3);
226
        modal.find('#date').text(convertDate(data_obj.date));
227
        modal.find('#manuscript').text(renderManuscript(data_obj.manuscript, false));
228
        modal.find('#position').text(data_obj.position1 + (data_obj.position2 ? ("/" + data_obj.position2 + (data_obj.positiondetail ? "/"  + data_obj.positiondetail :  "")) : ""));
229
        modal.find('#namedentity').text(data_obj.namedentity === 1? "ano" :  "ne");
230
        modal.find('#context').text(data_obj.context === ""? "-" :  data_obj.context);
231

    
232
        const morphem = data_obj.tag.tag;
233
        analyzeMorphem(modal, morphem);
234
    });
235

    
236
    function analyzeMorphem(modal, morphem) {
237
        modal.find('#wordclass').text(codeToWordclass[morphem.charAt(0)]);
238

    
239
        let movedNode;
240
        let beforeNode;
241
        if(morphem.charAt(0) === 'V') {
242
            movedNode = document.getElementById("case-wrapper");
243
            beforeNode = document.getElementById(null);
244
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
245
        } else {
246
            movedNode = document.getElementById("case-wrapper");
247
            beforeNode = document.getElementById("countability-wrapper");
248
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
249
        }
250

    
251
        (morphem.charAt(1) === '-') ? modal.find('#case-wrapper').hide() :
252
            modal.find('#case-wrapper').show();
253
        modal.find('#case').text(codeToCase[morphem.charAt(1)]);
254

    
255
        (morphem.charAt(2) === '-') ? modal.find('#countability-wrapper').hide() :
256
            modal.find('#countability-wrapper').show();
257
        modal.find('#countability').text(codeToCountability[morphem.charAt(2)]);
258

    
259
        (morphem.charAt(3) === '-') ? modal.find('#gender-wrapper').hide() :
260
            modal.find('#gender-wrapper').show();
261
        modal.find('#gender').text(codeToGender[morphem.charAt(3)]);
262

    
263
        (morphem.charAt(4) === '-') ? modal.find('#grade-wrapper').hide() :
264
            modal.find('#grade-wrapper').show();
265
        modal.find('#grade').text(codeToGrade[morphem.charAt(4)]);
266

    
267
        (morphem.charAt(5) === '-') ? modal.find('#shape-wrapper').hide() :
268
            modal.find('#shape-wrapper').show();
269
        modal.find('#shape').text(codeToShape[morphem.charAt(5)]);
270

    
271
        if(morphem.charAt(7) === '-'){
272
            modal.find('#k-type-wrapper').hide();
273
            modal.find('#type-wrapper').hide();
274
            modal.find('#mood-wrapper').hide();
275
            modal.find('#irregular-wrapper').hide();
276
        } else {
277
            if(morphem.charAt(0) === 'J') {
278
                modal.find('#mood-wrapper').hide();
279
                modal.find('#type-wrapper').hide();
280
                modal.find('#irregular-wrapper').hide();
281

    
282
                modal.find('#k-type-wrapper').show();
283
                modal.find('#k-type').text(codeToKType[morphem.charAt(7)]);
284
            } else if(morphem.charAt(0) === 'P') {
285
                modal.find('#k-type-wrapper').hide();
286
                modal.find('#mood-wrapper').hide();
287
                modal.find('#irregular-wrapper').hide();
288

    
289
                modal.find('#type-wrapper').show();
290
                modal.find('#type').text(codeToType[morphem.charAt(7)]);
291
            } else if(morphem.charAt(0) === 'V') {
292
                modal.find('#k-type-wrapper').hide();
293
                modal.find('#type-wrapper').hide();
294

    
295
                if(codeToMood[morphem.charAt(7)] !== undefined){
296
                    modal.find('#irregular-wrapper').hide();
297
                    modal.find('#mood-wrapper').show();
298
                    modal.find('#mood').text(codeToMood[morphem.charAt(7)]);
299
                } else {
300
                    modal.find('#mood-wrapper').hide();
301
                    modal.find('#irregular-wrapper').show();
302
                    modal.find('#irregular').text(codeToIrregular[morphem.charAt(7)]);
303
                }
304
            } else {
305
                modal.find('#k-type-wrapper').hide();
306
                modal.find('#type-wrapper').hide();
307
                modal.find('#mood-wrapper').hide();
308
                modal.find('#irregular-wrapper').hide();
309
            }
310
        }
311

    
312
        (morphem.charAt(8) === '-') ? modal.find('#person-wrapper').hide() :
313
            modal.find('#person-wrapper').show();
314
        modal.find('#person').text(morphem.charAt(8) + ".");
315

    
316
        (morphem.charAt(9) === '-') ? modal.find('#time-wrapper').hide() :
317
            modal.find('#time-wrapper').show();
318
        modal.find('#time').text(codeToTime[morphem.charAt(9)]);
319

    
320
        (morphem.charAt(10) === '-') ? modal.find('#v-type-wrapper').hide() :
321
            modal.find('#v-type-wrapper').show();
322
        modal.find('#v-type').text(codeToVType[morphem.charAt(10)]);
323

    
324
        (morphem.charAt(11) === '-') ? modal.find('#vid-wrapper').hide() :
325
            modal.find('#vid-wrapper').show();
326
        modal.find('#vid').text(codeToVid[morphem.charAt(11)]);
327
    }
328

    
329
    //CONVERTORS
330
    function convertDate(date) {
331
        let newDate = "";
332
        date = date.replace(" 00:00:00", "");
333
        let splitDate = date.split("-");
334

    
335
        newDate += splitDate[2] + ". " + splitDate[1] + ". " + splitDate[0];
336
        return newDate;
337
    }
338

    
339
    const codeToWordclass = {
340
        "N": "substantivum",
341
        "A": "adjektivum",
342
        "P": "pronomen",
343
        "C": "numeralie",
344
        "V": "verbum",
345
        "D": "adverbium",
346
        "R": "prepozice",
347
        "J": "konjunkce",
348
        "I": "interjekce",
349
        "T": "partikule"
350
    };
351

    
352
    const wordclassToNum = {
353
        "N": 0,
354
        "A": 1,
355
        "P": 2,
356
        "C": 3,
357
        "V": 4,
358
        "D": 5,
359
        "R": 6,
360
        "J": 7,
361
        "I": 8,
362
        "T": 9
363
    };
364

    
365
    const codeToManuscript = {
366
        "0":  "rukopis Vídeňský",
367
        "1":  "zlomky Hanušovy",
368
        "2":  "zlomky Hradecké",
369
        "3":  "rukopis Cambridžský",
370
        "4":  "rukopis Františkánský",
371
        "5":  "zlomek Olomoucký",
372
        "6":  "fragment Strahovský",
373
        "7":  "zlomky Klementinsko-Křižovnické",
374
        "8":  "zlomky Mnichovské",
375
        "9":  "rukopis Lobkovický",
376
        "10": "rukopis Pelclův",
377
        "11": "rukopis Cerronský",
378
        "12": "rukopis Fürstenberský",
379
        "13": "rukopis Zebererův",
380
        "14": "vydání Pavla Ješína z Bezdězi, Praha 1620",
381
        "15": "básně připsané při Pulkavově kronice v rukopisu Litoměřickém",
382
    };
383

    
384
    const codeToManuscriptShort = {
385
        "0":  "V",
386
        "1":  "H",
387
        "2":  "Hr",
388
        "3":  "C",
389
        "4":  "F",
390
        "5":  "O",
391
        "6":  "S",
392
        "7":  "K",
393
        "8":  "M",
394
        "9":  "L",
395
        "10": "P",
396
        "11": "Cr",
397
        "12": "Fs",
398
        "13": "Z",
399
        "14": "Js",
400
        "15": "Pl",
401
    };
402

    
403
    const codeToCase = {
404
        "1": "nominativ",
405
        "2": "genitiv",
406
        "3": "dativ",
407
        "4": "akuzativ",
408
        "5": "vokativ",
409
        "6": "lokál",
410
        "7": "instrumentál"
411
    };
412

    
413
    const codeToCountability = {
414
        "S": "singulár",
415
        "P": "plurál",
416
        "D": "duál"
417
    };
418

    
419
    const codeToGender = {
420
            "M": "maskulinum",
421
            "F": "femininum",
422
            "N": "neutrum"
423
    };
424

    
425
    const codeToGrade = {
426
        "1": "pozitiv",
427
        "2": "komparativ",
428
        "3": "superlativ"
429
    };
430

    
431
    const codeToKType = {
432
        "V": "větná",
433
        "C": "členská",
434
        "N": "navazovací",
435
        "P": "spojení s přechodníkem"
436
    };
437

    
438
    const codeToShape = {
439
        "C": "složený",
440
        "N": "jmenný"
441
    };
442

    
443
    const codeToVid = {
444
        "P": "perfektivum",
445
        "I": "imperfektivum",
446
    };
447

    
448
    const codeToVType = {
449
        "A": "aktivum",
450
        "P": "pasivum",
451
    };
452

    
453
    const codeToTime= {
454
        "P": "prézens",
455
        "A": "aorist",
456
        "R": "préteritum",
457
        "I": "imperfektum",
458
        "H": "plusquamperfektum",
459
        "F": "futurum"
460
    };
461

    
462
    const codeToType = {
463
        "P": "posesivum",
464
        "S": "personale",
465
        "D": "demonstrativum",
466
        "Q": "interogativum",
467
        "J": "relativum",
468
        "Z": "indefinitum",
469
        "L": "limitativum",
470
        "W": "negativum",
471
    };
472

    
473
    const codeToMood = {
474
        "d": "indikativ",
475
        "i": "imperativ",
476
        "c": "kondicionál"
477
    };
478

    
479
    const codeToIrregular = {
480
        "f": "infinitiv",
481
        "S": "supinum",
482
        "e": "přech. přítomný",
483
        "m": "přech. minulý",
484
        "A": "part. perf. akt.",
485
        "P": "part. perf. akt."
486
    };
487
</script>
(1-1/4)