Projekt

Obecné

Profil

Stáhnout (16.4 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 codeToManuscript = {
326
        "0":  "rukopis Vídeňský",
327
        "1":  "zlomky Hanušovy",
328
        "2":  "zlomky Hradecké",
329
        "3":  "rukopis Cambridžský",
330
        "4":  "rukopis Františkánský",
331
        "5":  "zlomek Olomoucký",
332
        "6":  "fragment Strahovský",
333
        "7":  "zlomky Klementinsko-Křižovnické",
334
        "8":  "zlomky Mnichovské",
335
        "9":  "rukopis Lobkovický",
336
        "10": "rukopis Pelclův",
337
        "11": "rukopis Cerronský",
338
        "12": "rukopis Fürstenberský",
339
        "13": "rukopis Zebererův",
340
        "14": "vydání Pavla Ješína z Bezdězi, Praha 1620",
341
        "15": "básně připsané při Pulkavově kronice v rukopisu Litoměřickém",
342
    };
343

    
344
    const codeToManuscriptShort = {
345
        "0":  "V",
346
        "1":  "H",
347
        "2":  "Hr",
348
        "3":  "C",
349
        "4":  "F",
350
        "5":  "O",
351
        "6":  "S",
352
        "7":  "K",
353
        "8":  "M",
354
        "9":  "L",
355
        "10": "P",
356
        "11": "Cr",
357
        "12": "Fs",
358
        "13": "Z",
359
        "14": "Js",
360
        "15": "Pl",
361
    };
362

    
363
    const codeToCase = {
364
        "1": "Nominativ",
365
        "2": "Genitiv",
366
        "3": "Dativ",
367
        "4": "Akuzativ",
368
        "5": "Vokativ",
369
        "6": "Lokál",
370
        "7": "Instrumentál"
371
    };
372

    
373
    const codeToCountability = {
374
            "S": "Singulár",
375
            "P": "Plurál",
376
            "D": "Duál"
377
    };
378

    
379
    const codeToGender = {
380
            "M": "Maskulinum",
381
            "F": "Femininum",
382
            "N": "Neutrum"
383
    };
384

    
385
    const codeToGrade = {
386
        "1": "Pozitiv",
387
        "2": "Komparativ",
388
        "3": "Superlativ"
389
    };
390

    
391
    const codeToKType = {
392
        "V": "Větná",
393
        "C": "Členská",
394
        "N": "Navazovací",
395
        "P": "Spojení s přechodníkem"
396
    };
397

    
398
    const codeToShape = {
399
        "C": "Složený",
400
        "N": "Jmenný"
401
    };
402

    
403
    const codeToVid = {
404
        "P": "Perfektivum",
405
        "I": "Imperfektivum",
406
    };
407

    
408
    const codeToVType = {
409
        "A": "Aktivum",
410
        "P": "Pasivum",
411
    };
412

    
413
    const codeToTime= {
414
        "P": "Prézens",
415
        "A": "Aorist",
416
        "R": "Préteritum",
417
        "I": "Imperfektum",
418
        "H": "Plusquamperfektum",
419
        "F": "Futurum"
420
    };
421

    
422
    const codeToType = {
423
        "P": "Personalia",
424
        "S": "Posesiva",
425
        "D": "Demonstrativa",
426
        "Q": "Interogativa",
427
        "J": "Relativa",
428
        "Z": "Indefinita",
429
        "L": "Limitativa",
430
        "W": "Negativa",
431
    };
432

    
433
    const codeToMood = {
434
        "d": "Indikativ",
435
        "i": "Imperativ",
436
        "c": "Kondicionál"
437
    };
438

    
439
    const codeToIrregular = {
440
        "f": "Infinitiv",
441
        "S": "Supinum",
442
        "e": "Přech. přítomný",
443
        "m": "Přech. minulý",
444
        "A": "Part. perf. akt.",
445
        "P": "Part. perf. akt."
446
    };
447
</script>
(1-1/2)