Projekt

Obecné

Profil

Stáhnout (13.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>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="case-wrapper">
77
                        <div class="col-xs-12 col-sm-4">
78
                            <label>Pád:</label>
79
                        </div>
80
                        <div class="col-xs-12 col-sm-8">
81
                            <i id="case"></i>
82
                        </div>
83
                    </div>
84
                    <div class="row" id="countability-wrapper">
85
                        <div class="col-xs-12 col-sm-4">
86
                            <label>Číslo:</label>
87
                        </div>
88
                        <div class="col-xs-12 col-sm-8">
89
                            <i id="countability"></i>
90
                        </div>
91
                    </div>
92
                    <div class="row" id="gender-wrapper">
93
                        <div class="col-xs-12 col-sm-4">
94
                            <label>Rod:</label>
95
                        </div>
96
                        <div class="col-xs-12 col-sm-8">
97
                            <i id="gender"></i>
98
                        </div>
99
                    </div>
100
                    <div class="row" id="grade-wrapper">
101
                        <div class="col-xs-12 col-sm-4">
102
                            <label>Stupeň:</label>
103
                        </div>
104
                        <div class="col-xs-12 col-sm-8">
105
                            <i id="grade"></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="k-type-wrapper">
117
                        <div class="col-xs-12 col-sm-4">
118
                            <label>Typ:</label>
119
                        </div>
120
                        <div class="col-xs-12 col-sm-8">
121
                            <i id="k-type"></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="mood-wrapper">
133
                        <div class="col-xs-12 col-sm-4">
134
                            <label>Způsob:</label>
135
                        </div>
136
                        <div class="col-xs-12 col-sm-8">
137
                            <i id="mood"></i>
138
                        </div>
139
                    </div>
140
                    <div class="row" id="person-wrapper">
141
                        <div class="col-xs-12 col-sm-4">
142
                            <label>Osoba:</label>
143
                        </div>
144
                        <div class="col-xs-12 col-sm-8">
145
                            <i id="person"></i>
146
                        </div>
147
                    </div>
148
                    <div class="row" id="time-wrapper">
149
                        <div class="col-xs-12 col-sm-4">
150
                            <label>Čas:</label>
151
                        </div>
152
                        <div class="col-xs-12 col-sm-8">
153
                            <i id="time"></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>
173
            </div>
174
            <div class="modal-footer">
175
                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
176
            </div>
177
        </div>
178
    </div>
179
</div>
180

    
181
<script>
182
    $('#detail-modal').on('show.bs.modal', function (event) {
183
        const button = $(event.relatedTarget);
184
        const pseudo_id = button.data('pseudo-id') ;// Extract info from data-* attributes
185

    
186
        const data_obj = data[pseudo_id];
187
        let modal = $(this);
188

    
189
        modal.find('#word').text(data_obj.word);
190
        modal.find('#lemma').text(data_obj.lemma.lemma);
191
        modal.find('#date').text(convertDate(data_obj.date));
192
        modal.find('#manuscript').text(renderManuscript(data_obj.manuscript, false));
193
        modal.find('#position').text(data_obj.position1 + (data_obj.position2 ? ("/" + data_obj.position2 + (data_obj.positiondetail ? "/"  + data_obj.positiondetail :  "")) : ""));
194
        modal.find('#namedentity').text(data_obj.namedentity === 1? "Ano" :  "Ne");
195
        modal.find('#context').text(data_obj.context === ""? "-" :  data_obj.context);
196

    
197
        const morphem = data_obj.tag.tag;
198
        analyzeMorphem(modal, morphem);
199
    });
200

    
201
    function analyzeMorphem(modal, morphem) {
202
        modal.find('#wordclass').text(codeToWordclass[morphem.charAt(0)]);
203

    
204
        (morphem.charAt(1) === '-') ? modal.find('#case-wrapper').hide() :
205
            modal.find('#case-wrapper').show();
206
        modal.find('#case').text(codeToCase[morphem.charAt(1)]);
207

    
208
        (morphem.charAt(2) === '-') ? modal.find('#countability-wrapper').hide() :
209
            modal.find('#countability-wrapper').show();
210
        modal.find('#countability').text(codeToCountability[morphem.charAt(2)]);
211

    
212
        (morphem.charAt(3) === '-') ? modal.find('#gender-wrapper').hide() :
213
            modal.find('#gender-wrapper').show();
214
        modal.find('#gender').text(codeToGender[morphem.charAt(3)]);
215

    
216
        (morphem.charAt(4) === '-') ? modal.find('#grade-wrapper').hide() :
217
            modal.find('#grade-wrapper').show();
218
        modal.find('#grade').text(codeToGrade[morphem.charAt(4)]);
219

    
220
        (morphem.charAt(5) === '-') ? modal.find('#shape-wrapper').hide() :
221
            modal.find('#shape-wrapper').show();
222
        modal.find('#shape').text(codeToShape[morphem.charAt(5)]);
223

    
224
        if(morphem.charAt(7) === '-'){
225
            modal.find('#k-type-wrapper').hide();
226
            modal.find('#type-wrapper').hide();
227
            modal.find('#mood-wrapper').hide();
228
        } else {
229
            if(morphem.charAt(0) === 'J') {
230
                modal.find('#mood-wrapper').hide();
231
                modal.find('#type-wrapper').hide();
232

    
233
                modal.find('#k-type-wrapper').show();
234
                modal.find('#k-type').text(codeToKType[morphem.charAt(7)]);
235
            } else if(morphem.charAt(0) === 'P') {
236
                modal.find('#k-type-wrapper').hide();
237
                modal.find('#mood-wrapper').hide();
238

    
239
                modal.find('#type-wrapper').show();
240
                modal.find('#type').text(codeToType[morphem.charAt(7)]);
241
            } else if(morphem.charAt(0) === 'V') {
242
                modal.find('#k-type-wrapper').hide();
243
                modal.find('#type-wrapper').hide();
244

    
245
                modal.find('#mood-wrapper').show();
246
                modal.find('#mood').text(codeToMood[morphem.charAt(7)]);
247
            } else {
248
                modal.find('#k-type-wrapper').hide();
249
                modal.find('#type-wrapper').hide();
250
                modal.find('#mood-wrapper').hide();
251
            }
252
        }
253

    
254
        (morphem.charAt(8) === '-') ? modal.find('#person-wrapper').hide() :
255
            modal.find('#person-wrapper').show();
256
        modal.find('#person').text(morphem.charAt(8) + ".");
257

    
258
        (morphem.charAt(9) === '-') ? modal.find('#time-wrapper').hide() :
259
            modal.find('#time-wrapper').show();
260
        modal.find('#time').text(codeToTime[morphem.charAt(9)]);
261

    
262
        (morphem.charAt(10) === '-') ? modal.find('#v-type-wrapper').hide() :
263
            modal.find('#v-type-wrapper').show();
264
        modal.find('#v-type').text(codeToVType[morphem.charAt(10)]);
265

    
266
        (morphem.charAt(11) === '-') ? modal.find('#vid-wrapper').hide() :
267
            modal.find('#vid-wrapper').show();
268
        modal.find('#vid').text(codeToVid[morphem.charAt(11)]);
269
    }
270

    
271
    //CONVERTORS
272
    function convertDate(date) {
273
        let newDate = "";
274
        date = date.replace(" 00:00:00", "");
275
        let splitDate = date.split("-");
276

    
277
        newDate += splitDate[2] + ". " + splitDate[1] + ". " + splitDate[0];
278
        return newDate;
279
    }
280

    
281
    const codeToWordclass = {
282
        "N": "Substantivum",
283
        "A": "Adjektivum",
284
        "P": "Pronomen",
285
        "C": "Numeralie",
286
        "V": "Verbum",
287
        "D": "Adverbium",
288
        "R": "Prepozice",
289
        "J": "Konjunkce",
290
        "I": "Interjekce",
291
        "T": "Partikule"
292
    };
293

    
294
    const codeToCase = {
295
        "1": "Nominativ",
296
        "2": "Genitiv",
297
        "3": "Dativ",
298
        "4": "Akuzativ",
299
        "5": "Vokativ",
300
        "6": "Lokál",
301
        "7": "Instrumentál"
302
    };
303

    
304
    const codeToCountability = {
305
            "S": "Singulár",
306
            "P": "Plurál",
307
            "D": "Duál"
308
    };
309

    
310
    const codeToGender = {
311
            "M": "Maskulinum",
312
            "F": "Femininum",
313
            "N": "Neutrum"
314
    };
315

    
316
    const codeToGrade = {
317
        "1": "Pozitiv",
318
        "2": "Komparativ",
319
        "3": "Superlativ"
320
    };
321

    
322
    const codeToKType = {
323
        "V": "Větná",
324
        "C": "Členská",
325
        "N": "Navazovací",
326
        "P": "Spojení s přechodníkem"
327
    };
328

    
329
    const codeToShape = {
330
        "C": "Složený",
331
        "N": "Jmenný"
332
    };
333

    
334
    const codeToVid = {
335
        "P": "Perfektivum",
336
        "I": "Imperfektivum",
337
    };
338

    
339
    const codeToVType = {
340
        "A": "Aktivum",
341
        "P": "Pasivum",
342
    };
343

    
344
    const codeToTime= {
345
        "P": "Prézens",
346
        "A": "Aorist",
347
        "R": "Préteritum",
348
        "I": "Imperfektum",
349
        "H": "Plusquamperfektum",
350
        "F": "Futurum"
351
    };
352

    
353
    const codeToType = {
354
        "P": "Personalia",
355
        "S": "Posesiva",
356
        "D": "Demonstrativa",
357
        "Q": "Interogativa",
358
        "J": "Relativa",
359
        "Z": "Indefinita",
360
        "L": "Limitativa",
361
        "W": "Negativa",
362
    };
363

    
364
    const codeToMood = {
365
        "f": "Infinitiv",
366
        "d": "Indikativ",
367
        "i": "Imperativ",
368
        "c": "Kondicionál",
369
        "S": "Supinum",
370
        "e": "Přech. přítomný",
371
        "m": "Přech. minulý",
372
        "A": "Part. perf. akt.",
373
        "P": "Part. perf. akt."
374
    };
375
</script>
(1-1/2)