Projekt

Obecné

Profil

Stáhnout (16.6 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>Slovo:</label>
13
                        </div>
14
                        <div class="col-xs-12 col-sm-8">
15
                            <i id="word"></i>
16
                        </div>
17
                    </div>
18
                    <div class="row">
19
                        <div class="col-xs-12 col-sm-4">
20
                            <label>Lemma:</label>
21
                        </div>
22
                        <div class="col-xs-12 col-sm-8">
23
                            <i id="lemma"></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>Rukopisy:</label>
37
                        </div>
38
                        <div class="col-xs-12 col-sm-8">
39
                            <i id="manuscript"></i>
40
                        </div>
41
                    </div>
42
                    <div class="row">
43
                        <div class="col-xs-12 col-sm-4">
44
                            <label>Pozice:</label>
45
                        </div>
46
                        <div class="col-xs-12 col-sm-8">
47
                            <i id="position"></i>
48
                        </div>
49
                    </div>
50
                    <div class="row">
51
                        <div class="col-xs-12 col-sm-4">
52
                            <label>Vlastní jméno:</label>
53
                        </div>
54
                        <div class="col-xs-12 col-sm-8">
55
                            <i id="namedentity"></i>
56
                        </div>
57
                    </div>
58
                    <div class="row">
59
                        <div class="col-xs-12 col-sm-4">
60
                            <label>Kontext:</label>
61
                        </div>
62
                        <div class="col-xs-12 col-sm-8">
63
                            <i id="context"></i>
64
                        </div>
65
                    </div>
66
                    <div class="row">
67
                        <div class="col-xs-12 col-sm-4">
68
                            <label>Slovní druh:</label>
69
                        </div>
70
                        <div class="col-xs-12 col-sm-8">
71
                            <i id="wordclass"></i>
72
                        </div>
73
                    </div>
74

    
75
                    <!-- conditional render -->
76
                    <div class="row" id="person-wrapper">
77
                        <div class="col-xs-12 col-sm-4">
78
                            <label>Osoba:</label>
79
                        </div>
80
                        <div class="col-xs-12 col-sm-8">
81
                            <i id="person"></i>
82
                        </div>
83
                    </div>
84
                    <div class="row" id="case-wrapper">
85
                        <div class="col-xs-12 col-sm-4">
86
                            <label>Pád:</label>
87
                        </div>
88
                        <div class="col-xs-12 col-sm-8">
89
                            <i id="case"></i>
90
                        </div>
91
                    </div>
92
                    <div class="row" id="countability-wrapper">
93
                        <div class="col-xs-12 col-sm-4">
94
                            <label>Číslo:</label>
95
                        </div>
96
                        <div class="col-xs-12 col-sm-8">
97
                            <i id="countability"></i>
98
                        </div>
99
                    </div>
100
                    <div class="row" id="gender-wrapper">
101
                        <div class="col-xs-12 col-sm-4">
102
                            <label>Rod:</label>
103
                        </div>
104
                        <div class="col-xs-12 col-sm-8">
105
                            <i id="gender"></i>
106
                        </div>
107
                    </div>
108
                    <div class="row" id="shape-wrapper">
109
                        <div class="col-xs-12 col-sm-4">
110
                            <label>Tvar:</label>
111
                        </div>
112
                        <div class="col-xs-12 col-sm-8">
113
                            <i id="shape"></i>
114
                        </div>
115
                    </div>
116
                    <div class="row" id="grade-wrapper">
117
                        <div class="col-xs-12 col-sm-4">
118
                            <label>Stupeň:</label>
119
                        </div>
120
                        <div class="col-xs-12 col-sm-8">
121
                            <i id="grade"></i>
122
                        </div>
123
                    </div>
124
                    <div class="row" id="type-wrapper">
125
                        <div class="col-xs-12 col-sm-4">
126
                            <label>Druh:</label>
127
                        </div>
128
                        <div class="col-xs-12 col-sm-8">
129
                            <i id="type"></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="mood-wrapper">
141
                        <div class="col-xs-12 col-sm-4">
142
                            <label>Způsob:</label>
143
                        </div>
144
                        <div class="col-xs-12 col-sm-8">
145
                            <i id="mood"></i>
146
                        </div>
147
                    </div>
148
                    <div class="row" id="irregular-wrapper">
149
                        <div class="col-xs-12 col-sm-4">
150
                            <label>Neurčitý slovesný tvar:</label>
151
                        </div>
152
                        <div class="col-xs-12 col-sm-8">
153
                            <i id="irregular"></i>
154
                        </div>
155
                    </div>
156
                    <div class="row" id="v-type-wrapper">
157
                        <div class="col-xs-12 col-sm-4">
158
                            <label>Slovesný rod:</label>
159
                        </div>
160
                        <div class="col-xs-12 col-sm-8">
161
                            <i id="v-type"></i>
162
                        </div>
163
                    </div>
164
                    <div class="row" id="vid-wrapper">
165
                        <div class="col-xs-12 col-sm-4">
166
                            <label>Slovesný vid:</label>
167
                        </div>
168
                        <div class="col-xs-12 col-sm-8">
169
                            <i id="vid"></i>
170
                        </div>
171
                    </div>
172
                    <div class="row" id="k-type-wrapper">
173
                        <div class="col-xs-12 col-sm-4">
174
                            <label>Typ:</label>
175
                        </div>
176
                        <div class="col-xs-12 col-sm-8">
177
                            <i id="k-type"></i>
178
                        </div>
179
                    </div>
180
                </div>
181
            </div>
182
            <div class="modal-footer">
183
                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
184
            </div>
185
        </div>
186
    </div>
187
</div>
188

    
189
<script>
190
    $('#detail-modal').on('show.bs.modal', function (event) {
191
        const button = $(event.relatedTarget);
192
        const pseudo_id = button.data('pseudo-id') ;// Extract info from data-* attributes
193

    
194
        const data_obj = data[pseudo_id];
195
        let modal = $(this);
196

    
197
        modal.find('#word').text(data_obj.word);
198
        modal.find('#lemma').text(data_obj.lemma.lemma);
199
        modal.find('#date').text(convertDate(data_obj.date));
200
        modal.find('#manuscript').text(renderManuscript(data_obj.manuscript, false));
201
        modal.find('#position').text(data_obj.position1 + (data_obj.position2 ? ("/" + data_obj.position2 + (data_obj.positiondetail ? "/"  + data_obj.positiondetail :  "")) : ""));
202
        modal.find('#namedentity').text(data_obj.namedentity === 1? "Ano" :  "Ne");
203
        modal.find('#context').text(data_obj.context === ""? "-" :  data_obj.context);
204

    
205
        const morphem = data_obj.tag.tag;
206
        analyzeMorphem(modal, morphem);
207
    });
208

    
209
    function analyzeMorphem(modal, morphem) {
210
        modal.find('#wordclass').text(codeToWordclass[morphem.charAt(0)]);
211

    
212
        let movedNode;
213
        let beforeNode;
214
        if(morphem.charAt(0) === 'V') {
215
            movedNode = document.getElementById("case-wrapper");
216
            beforeNode = document.getElementById(null);
217
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
218
        } else {
219
            movedNode = document.getElementById("case-wrapper");
220
            beforeNode = document.getElementById("countability-wrapper");
221
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
222
        }
223

    
224
        (morphem.charAt(1) === '-') ? modal.find('#case-wrapper').hide() :
225
            modal.find('#case-wrapper').show();
226
        modal.find('#case').text(codeToCase[morphem.charAt(1)]);
227

    
228
        (morphem.charAt(2) === '-') ? modal.find('#countability-wrapper').hide() :
229
            modal.find('#countability-wrapper').show();
230
        modal.find('#countability').text(codeToCountability[morphem.charAt(2)]);
231

    
232
        (morphem.charAt(3) === '-') ? modal.find('#gender-wrapper').hide() :
233
            modal.find('#gender-wrapper').show();
234
        modal.find('#gender').text(codeToGender[morphem.charAt(3)]);
235

    
236
        (morphem.charAt(4) === '-') ? modal.find('#grade-wrapper').hide() :
237
            modal.find('#grade-wrapper').show();
238
        modal.find('#grade').text(codeToGrade[morphem.charAt(4)]);
239

    
240
        (morphem.charAt(5) === '-') ? modal.find('#shape-wrapper').hide() :
241
            modal.find('#shape-wrapper').show();
242
        modal.find('#shape').text(codeToShape[morphem.charAt(5)]);
243

    
244
        if(morphem.charAt(7) === '-'){
245
            modal.find('#k-type-wrapper').hide();
246
            modal.find('#type-wrapper').hide();
247
            modal.find('#mood-wrapper').hide();
248
            modal.find('#irregular-wrapper').hide();
249
        } else {
250
            if(morphem.charAt(0) === 'J') {
251
                modal.find('#mood-wrapper').hide();
252
                modal.find('#type-wrapper').hide();
253
                modal.find('#irregular-wrapper').hide();
254

    
255
                modal.find('#k-type-wrapper').show();
256
                modal.find('#k-type').text(codeToKType[morphem.charAt(7)]);
257
            } else if(morphem.charAt(0) === 'P') {
258
                modal.find('#k-type-wrapper').hide();
259
                modal.find('#mood-wrapper').hide();
260
                modal.find('#irregular-wrapper').hide();
261

    
262
                modal.find('#type-wrapper').show();
263
                modal.find('#type').text(codeToType[morphem.charAt(7)]);
264
            } else if(morphem.charAt(0) === 'V') {
265
                modal.find('#k-type-wrapper').hide();
266
                modal.find('#type-wrapper').hide();
267

    
268
                if(codeToMood[morphem.charAt(7)] !== undefined){
269
                    modal.find('#irregular-wrapper').hide();
270
                    modal.find('#mood-wrapper').show();
271
                    modal.find('#mood').text(codeToMood[morphem.charAt(7)]);
272
                } else {
273
                    modal.find('#mood-wrapper').hide();
274
                    modal.find('#irregular-wrapper').show();
275
                    modal.find('#irregular').text(codeToIrregular[morphem.charAt(7)]);
276
                }
277
            } else {
278
                modal.find('#k-type-wrapper').hide();
279
                modal.find('#type-wrapper').hide();
280
                modal.find('#mood-wrapper').hide();
281
                modal.find('#irregular-wrapper').hide();
282
            }
283
        }
284

    
285
        (morphem.charAt(8) === '-') ? modal.find('#person-wrapper').hide() :
286
            modal.find('#person-wrapper').show();
287
        modal.find('#person').text(morphem.charAt(8) + ".");
288

    
289
        (morphem.charAt(9) === '-') ? modal.find('#time-wrapper').hide() :
290
            modal.find('#time-wrapper').show();
291
        modal.find('#time').text(codeToTime[morphem.charAt(9)]);
292

    
293
        (morphem.charAt(10) === '-') ? modal.find('#v-type-wrapper').hide() :
294
            modal.find('#v-type-wrapper').show();
295
        modal.find('#v-type').text(codeToVType[morphem.charAt(10)]);
296

    
297
        (morphem.charAt(11) === '-') ? modal.find('#vid-wrapper').hide() :
298
            modal.find('#vid-wrapper').show();
299
        modal.find('#vid').text(codeToVid[morphem.charAt(11)]);
300
    }
301

    
302
    //CONVERTORS
303
    function convertDate(date) {
304
        let newDate = "";
305
        date = date.replace(" 00:00:00", "");
306
        let splitDate = date.split("-");
307

    
308
        newDate += splitDate[2] + ". " + splitDate[1] + ". " + splitDate[0];
309
        return newDate;
310
    }
311

    
312
    const codeToWordclass = {
313
        "N": "Substantivum",
314
        "A": "Adjektivum",
315
        "P": "Pronomen",
316
        "C": "Numeralie",
317
        "V": "Verbum",
318
        "D": "Adverbium",
319
        "R": "Prepozice",
320
        "J": "Konjunkce",
321
        "I": "Interjekce",
322
        "T": "Partikule"
323
    };
324

    
325
    const wordclassToNum = {
326
        "N": 0,
327
        "A": 1,
328
        "P": 2,
329
        "C": 3,
330
        "V": 4,
331
        "D": 5,
332
        "R": 6,
333
        "J": 7,
334
        "I": 8,
335
        "T": 9
336
    };
337

    
338
    const codeToManuscript = {
339
        "0":  "rukopis Vídeňský",
340
        "1":  "zlomky Hanušovy",
341
        "2":  "zlomky Hradecké",
342
        "3":  "rukopis Cambridžský",
343
        "4":  "rukopis Františkánský",
344
        "5":  "zlomek Olomoucký",
345
        "6":  "fragment Strahovský",
346
        "7":  "zlomky Klementinsko-Křižovnické",
347
        "8":  "zlomky Mnichovské",
348
        "9":  "rukopis Lobkovický",
349
        "10": "rukopis Pelclův",
350
        "11": "rukopis Cerronský",
351
        "12": "rukopis Fürstenberský",
352
        "13": "rukopis Zebererův",
353
        "14": "vydání Pavla Ješína z Bezdězi, Praha 1620",
354
        "15": "básně připsané při Pulkavově kronice v rukopisu Litoměřickém",
355
    };
356

    
357
    const codeToManuscriptShort = {
358
        "0":  "V",
359
        "1":  "H",
360
        "2":  "Hr",
361
        "3":  "C",
362
        "4":  "F",
363
        "5":  "O",
364
        "6":  "S",
365
        "7":  "K",
366
        "8":  "M",
367
        "9":  "L",
368
        "10": "P",
369
        "11": "Cr",
370
        "12": "Fs",
371
        "13": "Z",
372
        "14": "Js",
373
        "15": "Pl",
374
    };
375

    
376
    const codeToCase = {
377
        "1": "Nominativ",
378
        "2": "Genitiv",
379
        "3": "Dativ",
380
        "4": "Akuzativ",
381
        "5": "Vokativ",
382
        "6": "Lokál",
383
        "7": "Instrumentál"
384
    };
385

    
386
    const codeToCountability = {
387
            "S": "Singulár",
388
            "P": "Plurál",
389
            "D": "Duál"
390
    };
391

    
392
    const codeToGender = {
393
            "M": "Maskulinum",
394
            "F": "Femininum",
395
            "N": "Neutrum"
396
    };
397

    
398
    const codeToGrade = {
399
        "1": "Pozitiv",
400
        "2": "Komparativ",
401
        "3": "Superlativ"
402
    };
403

    
404
    const codeToKType = {
405
        "V": "Větná",
406
        "C": "Členská",
407
        "N": "Navazovací",
408
        "P": "Spojení s přechodníkem"
409
    };
410

    
411
    const codeToShape = {
412
        "C": "Složený",
413
        "N": "Jmenný"
414
    };
415

    
416
    const codeToVid = {
417
        "P": "Perfektivum",
418
        "I": "Imperfektivum",
419
    };
420

    
421
    const codeToVType = {
422
        "A": "Aktivum",
423
        "P": "Pasivum",
424
    };
425

    
426
    const codeToTime= {
427
        "P": "Prézens",
428
        "A": "Aorist",
429
        "R": "Préteritum",
430
        "I": "Imperfektum",
431
        "H": "Plusquamperfektum",
432
        "F": "Futurum"
433
    };
434

    
435
    const codeToType = {
436
        "P": "Personalia",
437
        "S": "Posesiva",
438
        "D": "Demonstrativa",
439
        "Q": "Interogativa",
440
        "J": "Relativa",
441
        "Z": "Indefinita",
442
        "L": "Limitativa",
443
        "W": "Negativa",
444
    };
445

    
446
    const codeToMood = {
447
        "d": "Indikativ",
448
        "i": "Imperativ",
449
        "c": "Kondicionál"
450
    };
451

    
452
    const codeToIrregular = {
453
        "f": "Infinitiv",
454
        "S": "Supinum",
455
        "e": "Přech. přítomný",
456
        "m": "Přech. minulý",
457
        "A": "Part. perf. akt.",
458
        "P": "Part. perf. akt."
459
    };
460
</script>
(1-1/4)