PageSourceSearch

https://www.historickasidla.cz/redakce/inc/sablona/dsti/dsti.js

js historickasidla.cz collected 2026-10-02 16:15:15 UTC 22,387 bytes, 636 lines download raw bytes

1var refreshingtable = 0;
2var lastaction = 0;
3var loadingnew = 0;
4var page = 0;
5var exception = 0;
6var loaded = [];
7var centerformap = [];
8
9$(document).ready(function() {
10    if ($("#table_setting").length) {
11        var hash_page = getHashElements("page");
12        hash_page = hash_page * 1;
13        if (!hash_page > 0 || !(typeof hash_page == "number")) {
14            addRepleaceHashElements("page", "0");
15        }
16
17        if ($("#donacitani_dsti").val() == 1) {
18            $(window).scroll(function() {
19                if ($(window).scrollTop() + $(window).height() > $(document).height() - 2500) {
20                    if (loadingnew == 0 && $("#psc_ctrl").html() > 0) {
21                        if (($("#psc_ctrl").html() * 1) >= getHashElements("page")) {
22                            loadanotherpage();
23                        }
24                    }
25                }
26            });
27        } else if ($("#donacitani_dsti").val() == 2) {
28            $(".overflow_cover").scroll(function() {
29                if ($(".overflow_cover").scrollTop() > $("#table_obal").height() / 2) {
30                    if (loadingnew == 0) {
31                        if (($("#psc_ctrl").html() * 1) >= getHashElements("page")) {
32                            loadanotherpage();
33                        }
34                    }
35                }
36            });
37        }
38        if (!getHashElements("orderby").length) {
39            addRepleaceHashElements("orderby", $("#table_settings_orderby").val());
40        } else {
41            $("#table_settings_orderby").val(getHashElements("orderby"));
42            exception = 1;
43        }
44
45        if (getHashElements("skat") != "" && typeof getHashElements("skat") == "string" || (getHashElements("skat") > 0 && typeof getHashElements("skat") == "number")) {
46            getHashElements("skat").split("|").forEach(function(item) {
47                $("#checkbox_skats" + item).attr("checked", true);
48            });
49            $(".checkbox_skats" + (getHashElements("skat").replaceAll("|", "_"))).attr("checked", true);
50            exception = 1;
51        }
52        //
53        if (getHashElements("cis") != "" && typeof getHashElements("cis") == "string" || (getHashElements("cis") > 0 && typeof getHashElements("cis") == "number")) {
54            var cisarr = getHashElements("cis").split("|");
55
56            $(".checkbox_cis").each(function(index, value) {
57                if (cisarr.indexOf(index + "") > -1) {
58                    $(this).attr("checked", true);
59                }
60            });
61            check_checkboxes_cis(0);
62            exception = 1;
63        }
64
65        if ((getHashElements("mesto") != "" && typeof getHashElements("mesto") == "string") || (getHashElements("mesto") > 0 && typeof getHashElements("mesto") == "number")) {
66            $("#table_settings_mesto").val(decodeURI(getHashElements("mesto")));
67            exception = 1;
68        }
69
70        if (getHashElements("region") > 0) {
71            $("#dsti_region_f_sel").val(getHashElements("region"));
72            $("#table_settings_gregionid").val(getHashElements("region"));
73            exception = 1;
74        }
75        if (getHashElements("ehdtplatba") > 0) {
76            $("#filtr_ehd_typ_platby_sel").val(getHashElements("ehdtplatba"));
77            $("#table_settings_ehd_typ_platby").val(getHashElements("ehdtplatba"));
78            exception = 1;
79        }
80
81        if (getHashElements("sousedni_kraje") > 0) {
82            $("#sousedni_kraje_ch").attr("checked", true);
83            $("#table_settings_sousedni_kraje").val(getHashElements("sousedni_kraje"));
84            exception = 1;
85        }
86
87        if (getHashElements("bezbarierovy_pristup") > 0) {
88            $("#bezbarierovy_pristup_ch").attr("checked", true);
89            $("#table_settings_bezbarierovy_pristup").val(getHashElements("bezbarierovy_pristup"));
90            exception = 1;
91        }
92
93        if ((getHashElements("gregionvybrane") != "" && typeof getHashElements("gregionvybrane") == "string") || (getHashElements("gregionvybrane") >
93 0 && typeof getHashElements("gregionvybrane") == "number")) {
94            if ($("#sablona_dsti_filtr_region_nadrazene").length) {
95                $("#table_settings_gregionid").val(getHashElements("gregionvybrane"));
96            } else {
97                $("#table_settings_gregionvybrane").val(getHashElements("gregionvybrane"));
98            }
99            $(".filtry_region").removeClass("aktivni");
100            var helregs = getHashElements("gregionvybrane").split("|");
101            $(".checkbox_regs").each(function() {
102                if (helregs.indexOf($(this).val() + "") >= 0) {
103                    $(this).parent().addClass("aktivni");
104                    $(this).attr("checked", true);
105                }
106            });
107            exception = 1;
108        }
109
110        if ((getHashElements("cis_f_vyber") != "" && typeof getHashElements("cis_f_vyber") == "string") || (getHashElements("cis_f_vyber") > 0 && typeof getHashElements("cis_f_vyber") == "number")) {
111            var tmp_cis_f_vyber = getHashElements("cis_f_vyber").split("|");
112            var c = 0;
113            $(".sab_dsti_vypis_cis_vyber").each(function() {
114                $(this).val(tmp_cis_f_vyber[c]);
115                c++;
116            });
117            cis_filtr_vyber(0);
118            exception = 1;
119        }
120
121        if (getHashElements("vyhledavani") != "") {
122            $("#dsti_vyhledavani").val(decodeURI(getHashElements("vyhledavani")));
123            dsti_vyhledavani(0);
124            exception = 1;
125        }
126
127        if (getHashElements("abc") != "") {
128            $("#dsti_abc_f_sel").val(getHashElements("abc"));
129            $("#table_settings_abc").val(getHashElements("abc"));
130            $(".abc_tlacitko_" + getHashElements("abc")).addClass("aktivni");
131            exception = 1;
132        }
133
134        if ((getHashElements("ehddny") != "" && typeof getHashElements("ehddny") == "string") || (getHashElements("ehddny") > 0 && typeof getHashElements("ehddny") == "number")) {
135            $("#table_settings_ehd_dny").val(getHashElements("ehddny"));
136            var helregs = getHashElements("ehddny").split("|");
137            $(".ehd_den_ch").each(function() {
138                if (helregs.indexOf($(this).val() + "") >= 0) {
139                    $(this).attr("checked", true);
140                }
141            });
142            exception = 1;
143        }
144
145        if ($("#neprenacitat_poprve").val() != 1) {
146            if (exception == 1) {
147                if ($("#hash_clean_id").val() == 1) {
148                    $('#table_settings_zaznamid').val('');
149                }
150                checkcheckboxes(0);
151                checkcheckboxesgreg(0);
152                refreshtable();
153            } else {
154                if (getHashElements("lastclick") > 0 && getHashElements("page") > 0) {
155                    loadingnew = 1;
156                    openuntilx(1, getHashElements("page"));
157                }
158            }
159        }
160    }
161    if ($("#dsti_vyhledavani").length) {
162        $(document).keyup(function(event) {
163            if (event.which === 13) {
164                dsti_vyhledavani();
165            }
166        });
167    }
168});
169
170function refreshtable() {
171    var thisaction = lastaction + 1;
172    lastaction = thisaction;
173    refreshingtable = 1;
174    var dser = $("#table_setting").serialize();
175    $("#table_obal .subjekt").remove();
176    $("#table_obal .subjekt").remove();
177    $("#table_set_page").remove();
178    $("#table_obal").append('<span class="loader"></span>');
179    $.post(urltomstiajax + "dsti&subakce=showtableallparams&htmlAjax=yes", {
180            data: dser,
181            clanek: $("#clanek_id").val()
182        },
183        function(xml) {
184            if (thisaction == thisaction) {
185                $("#table_obal").html(xml);
186                if ($("#clean_id_after_reaload").val() == 1) {
187                    $("#table_settings_zaznamid").val("");
188                }
189                if ($("#nastav_id_after_reaload").length) {
190                    $("#table_settings_zaznamid").val($("#nastav_id_after_reaload").val());
191                }
192                if ($("#sablona_dsti_pocet_zaznamu_h_input").length) {
193                    $("#dsti_pocet_zaznamu").text($("#sablona_dsti_pocet_zaznamu_h_input").val());
194                }
195                if ($("#mapaContMain").length) {
196                    loadmarkers();
197                }
198                refreshingtable = 0;
199                if (exception == 1) {
200                    if (getHashElements("lastclick") > 0 && getHashElements("page") > 0) {
201                        loadingnew = 1;
202                        openuntilx(1, getHashElements("page"));
203                    }
204                    exception = 0;
205                }
206            }
207        });
208}
209
210// hash manipulator - vrati pole promennych z hashe
211function getHashElements(elm) {
212    var arrHash = [];
213    var arrHodVal;
214    var hashSet = location.hash.substring(1);
215    if (hashSet != '') {
216        var hasSetArr = hashSet.split(';');
217        for (var iA = 0; iA < hasSetArr.length; iA++) {
218            arrHodVal = hasSetArr[iA].split('=');
219            if (elm == undefined) {
220                arrHash[arrHodVal[0]] = arrHodVal[1];
221            } else if (elm == arrHodVal[0]) {
222                return arrHodVal[1];
223                break;
224            }
225        }
226        return arrHash;
227    } else {
228        return false;
229    }
230}
231
232// hash manipulator - prida nebo zmeni hash
233function addRepleaceHashElements(elm, val) {
234    if ($("#dsti_bez_hash").val() != 1) {
235        if (val != undefined) {
236            var repleaced = 0;
237            var arrHodVal;
238            var arrHash = [];
239            var hashSet = location.hash.substring(1);
240            if (hashSet != '') {
241                var hasSetArr = hashSet.split(';');
242                for (var iA = 0; iA < hasSetArr.length; iA++) {
243                    arrHodVal = hasSetArr[iA].split('=');
244                    if (elm == arrHodVal[0]) {
245                        arrHash[arrHodVal[0]] = val;
246                        repleaced = 1;
247                        //break;
248                    } else {
249                        arrHash[arrHodVal[0]] = arrHodVal[1];
250                    }
251                }
252            }
253            if (repleaced == 0) {
254                arrHash[elm] = val;
255            }
256            hashSet = '';
257            var separator = '';
258            for (key in arrHash) {
259                hashSet += separator + key + '=' + arrHash[key];
260                separator = ';';
261            }
262
263            location.hash = hashSet;
264            return hashSet;
265        } else {
266            return false;
267        }
268    }
269}
270
271function cleanpage() {
272    $("#table_settings_page").val(0);
273    page = 0;
274    addRepleaceHashElements("page", 0);
275}
276
277function loadanotherpage() {
278    loadingnew = 1;
279    page += 1;
280    addRepleaceHashElements("page", page);
281    $("#table_settings_page").val(($("#table_settings_page").val() * 1) + 1);
282    $.post(urltomstiajax + "dsti&subakce=showtableallparams&htmlAjax=yes", {
283            data: $("#table_setting").serialize(),
284            donacteni: 1,
285            clanek: $("#clanek_id").val()
286        },
287        function(xml) {
288            if (xml.trim() != "") {
289                $("#table_set_page").remove();
290                $("#table_setting").remove();
291                $("#table_obal").append((xml));
292                if ($("#clean_id_after_reaload").val() == 1) {
293                    $("#table_settings_zaznamid").val("");
294                }
295                loadingnew = 0;
296            } else {
297                $("#table_set_page").remove();
298            }
299        });
300}
301
302function openuntilx(x, tmppage) {
303    $("#table_settings_page").val(($("#table_settings_page").val() * 1) + 1);
304    $.post(urltomstiajax + "dsti&subakce=showtableallparams&htmlAjax=yes", {
305            data: $("#table_setting").serialize(),
306            donacteni: 1,
307            clanek: $("#clanek_id").val()
308        },
309        function(xml) {
310            $("#table_set_page").remove();
311            $("#table_setting").remove();
312            $("#table_obal").append((xml));
313            if ($("#clean_id_after_reaload").val() == 1) {
314                $("#table_settings_zaznamid").val("");
315            }
316            page = tmppage * 1;
317            x += 1;
318            if (x <= tmppage) {
319                $('html, body').animateScrollBy("#table_set_page", 800, -800); // u dalšího výpisu predelat na promennou
320                openuntilx(x, tmppage);
321            } else {
322                var tmplast = getHashElements("lastclick");
323                if (tmplast > 0) {
324                    setTimeout(function() {
325                        if ($("#subjekt_obal" + tmplast).length) {
326                            $('html, body').animateScrollBy("#subjekt_obal" + tmplast, 400, -100); // u dalšího výpisu predelat na promennou
327                            loadingnew = 0;
328                        }
329                    }, 250)
330                } else {
331                    loadingnew = 0;
332                }
333            }
334        });
335}
336
337$.fn.animateScrollBy = function(k, t, n, old) {
338    k = k || this.children().first(); // místo, kam se posunout [Selector | Element | $]
339    t = t || 400; // trvání animace [int]
340    n = n || { top: 0, left: 0 }; // offset, který se přičte k pozici místa, kam se posunout [int | {top: int, left: int}]
341    if (typeof n != "object")
342        n = { top: n, left: 0 };
343    var d = { top: this.scrollTop(), left: this.scrollLeft() };
344    this.scrollTop(0).scrollLeft(0);
345    var p = $(k).position();
346    this.scrollTop(d.top).scrollLeft(d.left);
347    if (old == 1) {
348        this.stop(true, false).animate({ scrollTop: p.top + n.top, scrollLeft: p.left + n.left }, t);
349    } else {
350        $(window).scrollTop(p.top + n.top);
351    }
352};
353
354function abeceda_filtr(hodnota, refresh) {
355    if ($("#table_settings_abc").val() == hodnota) {
356        hodnota = "";
357    }
358    var hodnota = ((hodnota != 0) ? hodnota : "");
359    addRepleaceHashElements("abc", hodnota);
360    $("#table_settings_abc").val(hodnota);
361    $(".abc_tlacitko").removeClass("aktivni");
362    $(".abc_tlacitko_" + hodnota).addClass("aktivni");
363    if (refresh != 0) {
364        cleanpage();
365        refreshtable();
366    }
367}
368
369function region_filtr(hodnota, refresh) {
370    var hodnota = ((hodnota != 0) ? hodnota : "");
371    $("#table_settings_gregionid").val(hodnota);
372    addRepleaceHashElements("region", hodnota);
373    if (refresh != 0) {
374        cleanpage();
375        refreshtable();
376    }
377}
378
379function ehd_typ_platby_filtr(hodnota, refresh) {
380    var hodnota = ((hodnota != 0) ? hodnota : "");
381    $("#table_settings_ehd_typ_platby").val(hodnota);
382    addRepleaceHashElements("ehdtplatba", hodnota);
383    if (refresh != 0) {
384        cleanpage();
385        refreshtable();
386    }
387}
388
389function bezbarierovy_pristup_filtr(refresh) {
390    var hodnota = (($("#bezbarierovy_pristup_ch").is(":checked")) ? $("#bezbarierovy_pristup_ch").val() : 0);
391    $("#table_settings_bezbarierovy_pristup").val(hodnota);
392    addRepleaceHashElements("bezbarierovy_pristup", hodnota);
393    if (refresh != 0) {
394        cleanpage();
395        refreshtable();
396    }
397}
398
399function sousedni_kraje_filtr(refresh) {
400    var hodnota = (($("#sousedni_kraje_ch").is(":checked")) ? $("#sousedni_kraje_ch").val() : 0);
401    $("#table_settings_sousedni_kraje").val(hodnota);
402    addRepleaceHashElements("sousedni_kraje", hodnota);
403    if (refresh != 0) {
404        cleanpage();
405        refreshtable();
406    }
407}
408
409function ehd_dny(refresh) {
410    var arr = new Array();
411    $(".ehd_den_ch:checked").each(function() {
412        arr.push($(this).val());
413    });
414    $("#table_settings_ehd_dny").val(arr.join("|"));
415    addRepleaceHashElements("ehddny", arr.join("|"));
416    if (refresh != 0) {
417        cleanpage();
418        refreshtable();
419    }
420}
421
422function checkcheckboxes(refresh) {
423    var arr = new Array();
424    $(".skat_obal").removeClass("aktivni");
425    $(".checkbox_skats:checked").each(function() {
426        arr.push($(this).val());
427        $(this).parent().addClass("aktivni");
428    });
429
430    $("#table_settings_podkategorie").val(arr.join("|"));
431
432    addRepleaceHashElements("skat", arr.join("|"));
433
434    if (refresh != 0) {
435        cleanpage();
436        refreshtable();
437        $(window).scrollTop(0);
438    }
439}
440
441function check_checkboxes_cis(refresh) {
442    var arr = new Array();
443    var arr2 = new Array();
444    var arr3 = new Array();
445    var arr4 = new Array();
446
447    $(".cis_obal").removeClass("aktivni");
448    $(".checkbox_cis:checked").each(function(index) {
449        arr2.push($(this).val());
450        arr3.push(index);
451        if ($(this).is(":checked")) {
452            arr4.push(index);
453            arr.push($(this).val());
454            $(this).parent().addClass("aktivni");
455        }
456    });
457
458    if (arr.length > 0) {
459        $("#table_settings_ciselniky").val(arr.join("|"));
460        addRepleaceHashElements("cis", arr4.join("|"));
461    } else {
462        if ($("#dependsoncis") == 1) {
463            $("#table_settings_ciselniky").val(arr2.join("|"));
464            addRepleaceHashElements("cis", arr3.join("|"));
465        } else {
466            $("#table_settings_ciselniky").val("");
467            addRepleaceHashElements("cis", "");
468        }
469    }
470
471    if (refresh != 0) {
472        cleanpage();
473        refreshtable();
474        $(window).scrollTop(0);
475    }
476}
477
478function cis_filtr_vyber(refresh) {
479
480    var arr = [];
481    var arr2 = [];
482
483    $(".sab_dsti_vypis_cis_vyber").each(function() {
484        if ($(this).val() > 0) {
485            arr.push($(this).data("id") + "#hodnotaID#=#" + $(this).val());
486        }
487        arr2.push((($(this).val() > 0) ? $(this).val() : 0));
488    });
489
490    $("#table_settings_ciselniky").val(arr.join("|"));
491
492    if (refresh != 0) {
493        addRepleaceHashElements("cis_f_vyber", arr2.join("|"));
494        cleanpage();
495        refreshtable();
496        $(window).scrollTop(0);
497    }
498}
499
500function setskat(hodnota, refresh) {
501    if ($("#table_settings_podkategorie").val() == hodnota) {
502        hodnota = "";
503    }
504    var hodnota = ((hodnota != 0) ? hodnota : "");
505    $(".skat_obal").removeClass("aktivni");
506    $("#table_settings_podkategorie").val(hodnota);
507
508    $("#checkbox_skats" + hodnota).parent().addClass("aktivni");
509    if (hodnota) {
510      const safeHodnota = String(hodnota).replace(/\|/g, "_");
511      $(".checkbox_skats" + safeHodnota).parent().addClass("aktivni");
512    }
513
514    addRepleaceHashElements("skat", hodnota);
515    if (refresh != 0) {
516        cleanpage();
517        refreshtable();
518    }
519}
520
521function setpage(hodnota, refresh) {
522    $("#table_settings_page").val(hodnota);
523    addRepleaceHashElements("skat", page);
524    if ($("#dsti_after_set_page_scroll_to").length) {
525        $('html, body').animate({
526            scrollTop: $('#dsti_after_set_page_scroll_to').offset().top - 100
527        }, 500);
528    }
529    if (refresh != 0) {
530        refreshtable();
531    }
532}
533
534function dsti_vyhledavani(refresh) {
535    var hledano = encodeURI($("#dsti_vyhledavani").val());
536    if (hledano != "") {
537        addRepleaceHashElements("vyhledavani", hledano);
538        if ($("#table_settings_search").length) {
539            $("#table_settings_search").val(hledano);
540        } else {
541            $("#table_setting").append('<input type="hidden" id="table_settings_search" name="table_settings_search" value="' + hledano + '">');
542        }
543    } else {
544        if (getHashElements("vyhledavani") != "" && hledano == "") {
545            $("#table_settings_zaznamid").val("");
546        }
547        $("#table_settings_search").val("");
548        addRepleaceHashElements("vyhledavani", "");
549    }
550
551    if (refresh != 0) {
552        cleanpage();
553        refreshtable();
554    }
555}
556
557function ordertableby(col, ascdesc, el) {
558    $(".f_dsti_ordby").removeClass("aktivni");
559    $("#table_settings_orderby").val(((col != 0) ? col + "|" + ascdesc : ""));
560    addRepleaceHashElements("orderby", ((col != 0) ? col + "|" + ascdesc : ""));
561    if (col != 0) {
562        el.addClass("aktivni");
563    }
564    loadingnew = 0;
565    cleanpage();
566    refreshtable();
567}
568
569function checkcheckboxesgreg(refresh) {
570    var arr = new Array();
571    $(".filtry_region").removeClass("aktivni");
572
573    $(".checkbox_regs:checked").each(function() {
574        arr.push($(this).val());
575        $(this).parent().addClass("aktivni");
576    });
577
578    if ($("#sablona_dsti_filtr_region_nadrazene").length) {
579        $("#table_settings_gregionid").val(arr.join("|"));
580    } else {
581        $("#table_settings_gregionvybrane").val(arr.join("|"));
582    }
583
584    addRepleaceHashElements("gregionvybrane", arr.join("|"));
585
586    if (refresh != 0) {
587        loadingnew = 0;
588        cleanpage()
589        refreshtable();
590    }
591}
592
593function zvolit_mesto(ehd) {
594    as4uPopup.show(urltomstiajax + "dsti&htmlAjax=yes&subakce=zvolit_mesto&selectedcities=" + encodeURI($("#table_settings_mesto").val()) + ((ehd == 1) ? "&ehd=1" : ""), 820, 500);
595}
596
597function getToCityChar(c) {
598    $("#citySelectorContent").animateScrollBy("#charcity_" + c, 1000, -120, 1);
599}
600
601function setCheckedSetings(id, el, ehd) {
602    var arr = [];
603
604    if (!id > 0 && ehd == 1) {
605        console.log(el.data("on"));
606        if (el.data("on") == 1) {
607            el.attr("checked", false);
608            $(".mesto_nastaveni_checkbox").data("on", 0);
609            el.data("on", 0)
610        } else {
611            el.attr("checked", true);
612            $(".mesto_nastaveni_checkbox").data("on", 0);
613            el.data("on", 1)
614        }
615    }
616
617    $(".mesto_nastaveni_checkbox:checked").each(function() {
618        arr.push($(this).val());
619    });
620
621    $("#table_settings_page").val(0);
622    addRepleaceHashElements("page", 0);
623    page = 0;
624
625    $("#table_settings_mesto").val(arr.join("|"));
626    addRepleaceHashElements("mesto", encodeURI(arr.join("|")));
627
628    loadingnew = 0;
629
630    loadmarkers();
631    refreshtable();
632
633    if (id > 0) {
634        as4uPopup.close(id);
635    }
636}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.