aswi2021mr-proper-gitlab/application/view/searchContent.php @ e278dcbf
1 |
<script>
|
---|---|
2 |
window.onload = function() { |
3 |
filtersChange(); |
4 |
};
|
5 |
</script>
|
6 |
|
7 |
<div class="search-filters container" onload="filtersChange()"> |
8 |
<div class="row"> |
9 |
<div class="mr-3"> |
10 |
<label for="lemma" class="mr-2">Lemma</label> |
11 |
<input type="text" id="lemma"> |
12 |
</div>
|
13 |
<div class="mr-3"> |
14 |
<label for="wordshape" class="mr-2">Tvar slova</label> |
15 |
<input type="text" id="wordshape"> |
16 |
</div>
|
17 |
<div class="mr-3"> |
18 |
<label for="source" class="mr-2">Rukopisný pramen</label> |
19 |
<input type="text" id="source"> |
20 |
</div>
|
21 |
<div class="mr-3"> |
22 |
<label for="location" class="mr-2">Lokace</label> |
23 |
<input type="text" id="location"> |
24 |
</div>
|
25 |
|
26 |
|
27 |
<div class="mr-3"> |
28 |
<label for="wordclass" class="mr-2">Slovní druh</label> |
29 |
<select onchange="filtersChange()" id="wordclass"> |
30 |
<option selected="selected" value = "">Nevybráno</option> |
31 |
<option value = "1">Substantiva</option> |
32 |
<option value = "2">Adjektiva</option> |
33 |
<option value = "3">Pronomina</option> |
34 |
<option value = "4">Numeralia</option> |
35 |
<option value = "5">Verba</option> |
36 |
<option value = "6">Adverbia</option> |
37 |
<option value = "7">Prepozice</option> |
38 |
<option value = "8">Konjunkce</option> |
39 |
<option value = "9">Interjekce</option> |
40 |
<option value = "10">Partikule</option> |
41 |
</select>
|
42 |
</div>
|
43 |
|
44 |
<script>
|
45 |
function filtersChange() { |
46 |
const value = document.getElementById("wordclass").value; |
47 |
switch (value) { |
48 |
case "1": |
49 |
setFilerVisibility([ |
50 |
true, |
51 |
true, |
52 |
true, |
53 |
false, |
54 |
false, |
55 |
false, |
56 |
false, |
57 |
false, |
58 |
false, |
59 |
false, |
60 |
false, |
61 |
false
|
62 |
]);
|
63 |
break; |
64 |
case "2": |
65 |
setFilerVisibility([ |
66 |
true, |
67 |
true, |
68 |
true, |
69 |
true, |
70 |
true, |
71 |
false, |
72 |
false, |
73 |
false, |
74 |
false, |
75 |
false, |
76 |
false, |
77 |
false
|
78 |
]);
|
79 |
break; |
80 |
case "3": |
81 |
setFilerVisibility([ |
82 |
true, |
83 |
true, |
84 |
true, |
85 |
false, |
86 |
false, |
87 |
true, |
88 |
false, |
89 |
false, |
90 |
false, |
91 |
false, |
92 |
false, |
93 |
false
|
94 |
]);
|
95 |
break; |
96 |
case "4": |
97 |
setFilerVisibility([ |
98 |
true, |
99 |
true, |
100 |
true, |
101 |
false, |
102 |
false, |
103 |
false, |
104 |
false, |
105 |
false, |
106 |
false, |
107 |
false, |
108 |
false, |
109 |
false
|
110 |
]);
|
111 |
break; |
112 |
case "5": |
113 |
setFilerVisibility([ |
114 |
true, |
115 |
true, |
116 |
true, |
117 |
false, |
118 |
false, |
119 |
false, |
120 |
true, |
121 |
true, |
122 |
true, |
123 |
true, |
124 |
true, |
125 |
false
|
126 |
]);
|
127 |
break; |
128 |
case "6": |
129 |
setFilerVisibility([ |
130 |
false, |
131 |
false, |
132 |
false, |
133 |
false, |
134 |
true, |
135 |
false, |
136 |
false, |
137 |
false, |
138 |
false, |
139 |
false, |
140 |
false, |
141 |
false
|
142 |
]);
|
143 |
break; |
144 |
case "7": |
145 |
setFilerVisibility([ |
146 |
true, |
147 |
false, |
148 |
false, |
149 |
false, |
150 |
false, |
151 |
false, |
152 |
false, |
153 |
false, |
154 |
false, |
155 |
false, |
156 |
false, |
157 |
false
|
158 |
]);
|
159 |
break; |
160 |
case "8": |
161 |
setFilerVisibility([ |
162 |
false, |
163 |
false, |
164 |
false, |
165 |
false, |
166 |
false, |
167 |
false, |
168 |
false, |
169 |
false, |
170 |
false, |
171 |
false, |
172 |
false, |
173 |
true
|
174 |
]);
|
175 |
break; |
176 |
case "9": |
177 |
setFilerVisibility([ |
178 |
false, |
179 |
false, |
180 |
false, |
181 |
false, |
182 |
false, |
183 |
false, |
184 |
false, |
185 |
false, |
186 |
false, |
187 |
false, |
188 |
false, |
189 |
false
|
190 |
]);
|
191 |
break; |
192 |
case "10": |
193 |
setFilerVisibility([ |
194 |
false, |
195 |
false, |
196 |
false, |
197 |
false, |
198 |
false, |
199 |
false, |
200 |
false, |
201 |
false, |
202 |
false, |
203 |
false, |
204 |
false, |
205 |
false
|
206 |
]);
|
207 |
break; |
208 |
default: |
209 |
setFilerVisibility([ |
210 |
false, |
211 |
false, |
212 |
false, |
213 |
false, |
214 |
false, |
215 |
false, |
216 |
false, |
217 |
false, |
218 |
false, |
219 |
false, |
220 |
false, |
221 |
false
|
222 |
]);
|
223 |
break; |
224 |
}
|
225 |
//TODO data fetch
|
226 |
}
|
227 |
|
228 |
function setFilerVisibility(visibility) { |
229 |
const id = [ |
230 |
"filter-case", |
231 |
"filter-countability", |
232 |
"filter-gender", |
233 |
"filter-shape", |
234 |
"filter-grade", |
235 |
"filter-type", |
236 |
"filter-mood", |
237 |
"filter-person", |
238 |
"filter-time", |
239 |
"filter-vid", |
240 |
"filter-v-type", |
241 |
"filter-k-type" |
242 |
];
|
243 |
|
244 |
for(let i = 0; i < id.length && i < visibility.length; i++){ |
245 |
document.getElementById(id[i]).style.display = visibility[i] === true ? "" : "none"; |
246 |
document.getElementById(id[i].replace("filter-", "")).value = ""; |
247 |
}
|
248 |
}
|
249 |
</script>
|
250 |
|
251 |
<!-- conditionaly rendered filters-->
|
252 |
<div class="mr-3" id="filter-case"> |
253 |
<label for="case" class="mr-2">Pád</label> |
254 |
<select id="case"> |
255 |
<option selected="selected" value = "">Nevybráno</option> |
256 |
<option value = "1">Nominativ</option> |
257 |
<option value = "2">Genitiv</option> |
258 |
<option value = "3">Dativ</option> |
259 |
<option value = "4">Akuzativ</option> |
260 |
<option value = "5">Vokativ</option> |
261 |
<option value = "6">Lokál</option> |
262 |
<option value = "7">Instrumentál</option> |
263 |
</select>
|
264 |
</div>
|
265 |
<div class="mr-3" id="filter-countability"> |
266 |
<label for="countability" class="mr-2">Číslo</label> |
267 |
<select id="countability"> |
268 |
<option selected="selected" value = "">Nevybráno</option> |
269 |
<option value = "1">Singulár</option> |
270 |
<option value = "2">Plurál</option> |
271 |
<option value = "3">Duál</option> |
272 |
</select>
|
273 |
</div>
|
274 |
<div class="mr-3" id="filter-gender"> |
275 |
<label for="gender" class="mr-2">Rod</label> |
276 |
<select id="gender"> |
277 |
<option selected="selected" value = "">Nevybráno</option> |
278 |
<option value = "1">maskulinum</option> |
279 |
<option value = "2">femininum</option> |
280 |
<option value = "3">neutrum</option> |
281 |
</select>
|
282 |
</div>
|
283 |
<div class="mr-3" id="filter-shape"> |
284 |
<label for="shape" class="mr-2">Tvar</label> |
285 |
<select id="shape"> |
286 |
<option selected="selected" value = "">Nevybráno</option> |
287 |
<option value = "1">Složený</option> |
288 |
<option value = "2">Jmenný</option> |
289 |
<option value = "3">Přivlastňovací</option> |
290 |
</select>
|
291 |
</div>
|
292 |
<div class="mr-3" id="filter-grade"> |
293 |
<label for="grade" class="mr-2">Stupeň</label> |
294 |
<select id="grade"> |
295 |
<option selected="selected" value = "">Nevybráno</option> |
296 |
<option value = "1">Pozitiv</option> |
297 |
<option value = "2">Komparativ</option> |
298 |
<option value = "3">Superlativ</option> |
299 |
</select>
|
300 |
</div>
|
301 |
<div class="mr-3" id="filter-type"> |
302 |
<label for="type" class="mr-2">Druh</label> |
303 |
<select id="type"> |
304 |
<option selected="selected" value = "">Nevybráno</option> |
305 |
<option value = "1">Personalia</option> |
306 |
<option value = "2">Posesiva</option> |
307 |
<option value = "3">Demonstrativa</option> |
308 |
<option value = "4">Interogativa</option> |
309 |
<option value = "5">Relativa</option> |
310 |
<option value = "6">Indefinita</option> |
311 |
<option value = "7">Limitativa</option> |
312 |
<option value = "8">Negativa</option> |
313 |
</select>
|
314 |
</div>
|
315 |
<div class="mr-3" id="filter-mood"> |
316 |
<label for="mood" class="mr-2">Osoba</label> |
317 |
<select id="mood"> |
318 |
<option selected="selected" value = "">Nevybráno</option> |
319 |
<option value = "1">Indikativ</option> |
320 |
<option value = "2">Imperativ</option> |
321 |
<option value = "3">Kondicionál</option> |
322 |
</select>
|
323 |
</div>
|
324 |
<div class="mr-3" id="filter-person"> |
325 |
<label for="person" class="mr-2">Osoba</label> |
326 |
<select id="person"> |
327 |
<option selected="selected" value = "">Nevybráno</option> |
328 |
<option value = "1">1.</option> |
329 |
<option value = "2">2.</option> |
330 |
<option value = "3">3.</option> |
331 |
</select>
|
332 |
</div>
|
333 |
<div class="mr-3" id="filter-time"> |
334 |
<label for="time" class="mr-2">Čas</label> |
335 |
<select id="time"> |
336 |
<option selected="selected" value = "">Nevybráno</option> |
337 |
<option value = "1">Prézens</option> |
338 |
<option value = "2">Aorist</option> |
339 |
<option value = "3">Préteritum</option> |
340 |
<option value = "4">Imperfektum</option> |
341 |
<option value = "5">Plusquamperfektum</option> |
342 |
<option value = "6">Futurum</option> |
343 |
</select>
|
344 |
</div>
|
345 |
<div class="mr-3" id="filter-vid"> |
346 |
<label for="vid" class="mr-2">Druh</label> |
347 |
<select id="vid"> |
348 |
<option selected="selected" value = "">Nevybráno</option> |
349 |
<option value = "1">Perfektivum</option> |
350 |
<option value = "2">Imperfektivum </option> |
351 |
</select>
|
352 |
</div>
|
353 |
<div class="mr-3" id="filter-v-type"> |
354 |
<label for="v-type" class="mr-2">Rod</label> |
355 |
<select id="v-type"> |
356 |
<option selected="selected" value = "">Nevybráno</option> |
357 |
<option value = "1">Aktivum</option> |
358 |
<option value = "2">Pasivum</option> |
359 |
</select>
|
360 |
</div>
|
361 |
<div class="mr-3" id="filter-k-type"> |
362 |
<label for="k-type" class="mr-2">Typ</label> |
363 |
<select id="k-type"> |
364 |
<option selected="selected" value = "">Nevybráno</option> |
365 |
<option value = "1">Větná</option> |
366 |
<option value = "2">Členská</option> |
367 |
<option value = "3">Navazovací</option> |
368 |
<option value = "4">Spojení s přechodníkem</option> |
369 |
</select>
|
370 |
</div>
|
371 |
</div>
|
372 |
</div>
|
373 |
|
374 |
<div class="search-results my-4"> |
375 |
<table class="table table-striped"> |
376 |
<thead>
|
377 |
<tr>
|
378 |
<th scope="col">Lemma</th> |
379 |
<th scope="col">Tvar slova</th> |
380 |
<th scope="col">Detail</th> |
381 |
<th scope="col">Morfém</th> |
382 |
<th scope="col">Rukopisy</th> |
383 |
<th scope="col">Pozice</th> |
384 |
<th scope="col"></th> |
385 |
</tr>
|
386 |
</thead>
|
387 |
<tbody id="search-table"> |
388 |
<script>
|
389 |
const data = [{"id":1,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"e","finished":true,"namedentity":0,"position1":"45","position2":"19","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161e","lemma_id":1,"tag_id":1},{"id":2,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"e","finished":true,"namedentity":0,"position1":"45","position2":"20","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161e","lemma_id":1,"tag_id":2},{"id":24,"context":"","date":"2013-05-29 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"","finished":true,"namedentity":1,"position1":"100","position2":"07","positiondetail":"","prefix":"","suffix":"","word":"Albrecht","lemma_id":7,"tag_id":8},{"id":3,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"\u011b","finished":true,"namedentity":0,"position1":"45","position2":"19","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161\u011b","lemma_id":1,"tag_id":1},{"id":4,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"","description3":"","ending":"a","finished":true,"namedentity":1,"position1":"96","position2":"15","positiondetail":"","prefix":"","suffix":"","word":"Adalfa","lemma_id":2,"tag_id":3},{"id":5,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"a","finished":true,"namedentity":1,"position1":"96","position2":"15","positiondetail":"","prefix":"","suffix":"","word":"Adolfa","lemma_id":3,"tag_id":3},{"id":25,"context":"","date":"2013-05-28 00:00:00","description":"","description2":"","description3":"","ending":"a","finished":true,"namedentity":1,"position1":"99","position2":"04","positiondetail":"","prefix":"","suffix":"","word":"Albrechta","lemma_id":7,"tag_id":3},{"id":6,"context":"","date":"2013-05-31 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"\u011b","finished":true,"namedentity":1,"position1":"104","position2":"24","positiondetail":"","prefix":"","suffix":"\u00e9\u0159","word":"Ajn\u0161tejn\u00e9\u0159\u011b","lemma_id":4,"tag_id":3},{"id":7,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"","description3":"","ending":"u","finished":true,"namedentity":0,"position1":"96","position2":"10","positiondetail":"","prefix":"","suffix":"\u00f3v","word":"Albertovu","lemma_id":5,"tag_id":4},{"id":38,"context":"z","date":"2013-03-28 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"a","finished":true,"namedentity":1,"position1":"39","position2":"05","positiondetail":"","prefix":"","suffix":"","word":"Aldenburka","lemma_id":12,"tag_id":7}]; |
390 |
let result = ""; |
391 |
data.forEach((item) => { |
392 |
result += "<tr>"; |
393 |
result += "<td>" + item.lemma_id + "</td>"; |
394 |
result += "<td>" + item.word + "</td>"; |
395 |
result += "<td>" + item.prefix + "</td>"; |
396 |
result += "<td>" + item.suffix + "</td>"; |
397 |
result += "<td>" + item.ending + "</td>"; |
398 |
result += "<td>" + item.ending + "</td>"; |
399 |
result += "<td class=\"action-td\">" + |
400 |
"<button class=\"btn\"><i class=\"fa fa-search\"></i></button>" + |
401 |
"</td>"; |
402 |
result += "</tr>"; |
403 |
});
|
404 |
document.getElementById("search-table").innerHTML = result; |
405 |
</script>
|
406 |
</tbody>
|
407 |
</table>
|
408 |
</div>
|
409 |
|
410 |
|