PageSourceSearch

https://www.ticketlive.cz/js/custom.js?1.44

js ticketlive.cz collected 2026-10-02 07:53:12 UTC 40,021 bytes, 1,074 lines download raw bytes

1var $cdnhostname = "https://cdn.ticketlive.cz/"; // todo
2// if (window.location.hostname == "www.ticketlive.cz") {
3//
4// } else if (window.location.hostname == "www.ticketlive.sk") {
5//
6// } else  {
7//     $cdnhostname = "https://admin.ticketlive.local/";
8// }
9
10function debounce(func, wait, immediate) {
11    var timeout;
12    return function () {
13        var context = this, args = arguments;
14        var later = function () {
15            timeout = null;
16            if (!immediate)
17                func.apply(context, args);
18        };
19        var callNow = immediate && !timeout;
20        clearTimeout(timeout);
21        timeout = setTimeout(later, wait);
22        if (callNow)
23            func.apply(context, args);
24    };
25}
26
27function removeInsuranceFromCart(which) {
28    //$("a.removeInsuranceFromCart[data-i='" + which + "']").remove();
29    //alert($("input#pojisteni_" + which).length);
30    //$("input#pojisteni_" + which).prop('checked', false);
31    //$("input#pojisteni_" + which).removeAttr("checked");
32    $.ajax({
33        type: "POST",
34        url: "/api/cart-insurance",
35        data: '',
36        dataType: "html",
37        async: true,
38        success: function (data) {
39            showCartTable();
40            showCartSummary();
41            $('#insuranceLink').hide();
42        }
43    });
44}
45
46function pojisteniRadioStart(val) {
47    $("input.pojisteni_radio[value='" + val + "']").after("&#160;<a href='#' class='removeInsuranceFromCart' data-i='" + val + "'><i class='fa fa-trash-o'></i></a>");
48    $('a.removeInsuranceFromCart', 'div#basket').click(function () {
49        removeInsuranceFromCart(val);
50        return false;
51    });
52    return false;
53}
54
55function deliveryRadio(c) {
56    $('#tt_2').data("c", c).text(roundToTwo(Number(c)) + " " + $('body').data('m'));
57}
58
59function paymentRadio(c) {
60    $('#tt_4').data("c", c).text(roundToTwo(Number(c)) + " " + $('body').data('m'));
61}
62
63function pojisteniRadio(val) {
64    $.ajax({
65        type: "POST",
66        url: "/api/cart-insurance/" + val,
67        data: '',
68        dataType: "html",
69        async: true,
70        success: function (data) {
71            if (data['r'] == "1") {
72                tablecartSum();
73                showCartSummary();
74                $('#insuranceLink').show();
75            } else {
76                showCartTable();
77                tablecartSum();
78            }
79        }
80    });
81    //alert('val:'+val+", length:"+$("a.removeInsuranceFromCart[data-i='" + val + "']").length);
82    if ($("a.removeInsuranceFromCart[data-i='" + val + "']").length > 0) {
83    } else {
84        //$("a.removeInsuranceFromCart").remove();
85        //$("input.pojisteni_radio[value='" + val + "']").after("&#160;<a href='#' class='removeInsuranceFromCart' data-i='" + val + "'><i class='fa fa-trash-o'></i></a>");
86        /*$('a.removeInsuranceFromCart', 'div#basket').click(function () {
87            removeInsuranceFromCart(val);
88            return false;
89        });*/
90    }
91    return false;
92}
93
94function showNotifications(page) {
95    $.ajax({
96        type: "POST",
97        url: "/api/notifications-lite/" + page,
98        data: '',
99        dataType: "html",
100        async: true,
101        success: function (data) {
102            if ($('div#myNotificationsPager')) {
103                $('div#myNotificationsPager').remove();
104            }
105            $('table#myNotificationsTable').replaceWith(data);
106            $('tr.dismissNotification').click(function () {
107                $i = $(this).data('i');
108                $.ajax({
109                    type: "POST",
110                    url: "/api/notifications-dismiss/" + $i,
111                    data: '',
112                    dataType: "html",
113                    async: true,
114                    success: function (data) {
115                        $('tr.dismissNotification[data-i="' + $i + '"]').css("font-weight", "normal");
116                        showNotificationsHeader();
117                    }
118                });
119            });
120            $('button.dismissNotificationAll').click(function () {
121                $.ajax({
122                    type: "POST",
123                    url: "/api/notifications-dismiss/0",
124                    data: '',
125                    dataType: "html",
126                    async: true,
127                    success: function (data) {
128                        $('tr.dismissNotification').each(function () {
129                            $(this).css("font-weight", "normal");
130                        });
131                        showNotificationsHeader();
132                    }
133                });
134            });
135        }
136    });
137}
138
139function showNotificationsHeader() {
140    $.ajax({
141        type: "POST",
142        url: "/api/notifications-header",
143        data: '',
144        dataType: "html",
145        async: true,
146        success: function (data) {
147            $('li#notificationscenter').replaceWith(data);
148        }
149    });
150}
151
152function showCartSummary() {
153
154}
155
156function showCartTable() {
157    $.ajax({
158        type: "POST",
159        url: "/api/cart/" + $('body').data('l'),
160        data: '',
161        dataType: "html",
162        async: true,
163        success: function (data) {
164            $('div#basket').replaceWith(data);
165            tablecartSum();
166            $('a.removeFromCart', 'div#basket').click(function () {
167                removeFromCart($(this), true);
168            });
169            $('a.removeFromCartAction', 'div#basket').click(function () {
170                $('input.removeFromCartCheck:checked').each(function () {
171                    var a = $('a.removeFromCart[data-k=' + $(this).data('k') + ']');
172                    removeFromCart(a, true);
173                });
174            });
175            $('div#basket a.selectFromCartAction').click(function () {
176                if ($(this).data('s') == '1') {
177                    $(this).data('s', '0');
178                    $('input.removeFromCartCheck').each(function () {
179                        $(this).prop('checked', true);
180                    });
181                } else {
182                    $(this).data('s', '1');
183                    $('input.removeFromCartCheck').each(function () {
184                        $(this).prop('checked', false);
185                    });
186                }
187                return false;
188            });
189            $('a#pojisteniA', 'div#basket').unbind().click(function () {
190                var val = $(this).data('v');
191                pojisteniRadio(val);
192            });
193            $('a#pojisteniN', 'div#basket').unbind().click(function () {
194                var val = $(this).data('v');
195                removeInsuranceFromCart(val);
196            });
197            $('a#showHideInsuranceInfoA').unbind().click(function () {
198                $visible = $('p#showHideInsuranceInfo:visible').is(":visible");
199                if ($visible) {
200                    $('p#showHideInsuranceInfo').hide();
201                } else {
202                    $('p#showHideInsuranceInfo').show();
203                }
204                return false;
205            });
206            /*
207            $('input.pojisteni_radio', 'div#basket').click(function () {
208                var val = $(this).val();
209                pojisteniRadio(val);
210                $('#insuranceLink').show();
211            });
212            $('input.pojisteni_radio:checked', 'div#basket').each(function () {
213                var val = $(this).val();
214                pojisteniRadioStart(val);
215            });
216            */
217            $('a.verify', 'div#basket').click(function () {
218                verifyIsicCard($(this));
219            });
220            $('a.verifyPartner', 'div#basket').click(function () {
221                verifyPartner($(this));
222            });
223            $('button#kodCheck', 'div#basket').click(function () {
224                kodCheck();
225            });
226        }
227    });
228}
229
230function printIframe() {
231    objFra = document.getElementById('iframe');
232    objFra.contentWindow.focus();
233    objFra.contentWindow.print();
234}
235
236function showCartTableLite() {
237    if ($('a.customRefreshBasket')) {
238        $('a.customRefreshBasket span').addClass("spinning");
239    }
240    $.ajax({
241        type: "POST",
242        url: "/api/cartLite/" + $('body').data('l'),
243        data: '',
244        dataType: "html",
245        async: true,
246        success: function (data) {
247            $('div#basket').replaceWith(data);
248            //tablecartSum();
249            $('a.removeFromCart', 'div#basket').click(function () {
250                removeFromCart($(this), true);
251                return false;
252            });
253            $('a.customRefreshBasket span').removeClass("spinning");
254            $('a.customRefreshBasket').click(function () {
255                showCartTableLite();
256                return false;
257            });
258            $('a.verify', 'div#basket').click(function () {
259                verifyIsicCard($(this));
260            });
261            $('a.verifySk', 'div#basket').click(function () {
262                verifyIsicCardSk($(this));
263            });
264            $('a.verifyPartner', 'div#basket').click(function () {
265                verifyPartner($(this));
266            });
267            $('a#fastPaymentOnsite').click(function () {
268                $card = $(this).data("card");
269                if ($card == "1") {
270                    $('a#fastPaymentOnsite[data-card="0"]').remove();
271                    if ($('a#fastPaymentOnsite[data-card="2"]').length > 0) {
272                        $('a#fastPaymentOnsite[data-card="2"]').remove();
273                    }
274                } else if ($card == "2") {
275                    $('a#fastPaymentOnsite[data-card="0"]').remove();
276                    if ($('a#fastPaymentOnsite[data-card="1"]').length > 0) {
277                        $('a#fastPaymentOnsite[data-card="1"]').remove();
278                    }
279                } else {
280                    if ($('a#fastPaymentOnsite[data-card="1"]').length > 0) {
281                        $('a#fastPaymentOnsite[data-card="1"]').remove();
282                    }
283                    if ($('a#fastPaymentOnsite[data-card="2"]').length > 0) {
284                        $('a#fastPaymentOnsite[data-card="2"]').remove();
285                    }
286                }
287
288                $('div#mc').html("");
289                $item = $(this);
290                $('div#basket a.removeFromCart').hide();
291                $item.replaceWith('<span class="glyphicon glyphicon-refresh spinning myWaiting"></span>');
292                $.ajax({
293                    type: "POST",
294                    url: "/"+$('body').data('l') + "/api/fastPaymentOnsite",
295                    data: 'card=' + $card,
296                    dataType: "html",
297                    async: true,
298                    success: function (data) {
299                        m("success", "OK", "Hotovo", true);
300                        $('div#basket table tbody').hide();
301                        $('span.myWaiting').replaceWith(data);
302                        if ($('input#onsitePreviewPrint:checked').length>0) {
303                            var h = $('div#basket table tfoot a.btn-success').attr("href");
304                            if (h!=null && h!='') {
305                                h = h.substr(1,10000);
306                                //FIX ME
307                                const body = document.querySelector('body');
308                                const dataU = body.getAttribute('data-u');
309                                const url = new URL(dataU);
310                                const serverWithProtocol = `${url.protocol}//${url.hostname}`;
311                                var c = '<iframe id="iframe" src="'+serverWithProtocol+'/' + h + '"/><p><a href="#" onclick="printIframe();"><i class="fa fa-print"/></a></p>';
312                                $('div#basket table tfoot input#internalNote').before(c);
313                                objFra = document.getElementById('iframe');
314                                objFra.contentWindow.focus();
315                                setTimeout(function () {
316                                    objFra.contentWindow.print();
317                                }, 1500);
318                            }
319                        }
320                    }
321                });
322                return false;
323            });
324        }
325    });
326}
327
328function m(type, subject, text, inline) {
329    /*
330     $html = '<div class=\"alert alert-' + type + ' alert-dismissible\" role=\"alert\">' +
331     '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>' +
332     '<strong>' + subject + '</strong> ' + text +
333     '</div>';
334     $("div#m").append($html);
335     */
336    if (inline && $('div#mc').length > 0) {
337        $('div#mc').html("");
338        $('div#mc').html('<div class="alert-dismissable alert alert-' + type + '"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>' + subject + '</strong>
338 ' + text + '</div>');
339        if ($('div.basketLite').length > 0) {
340        } else {
341            $.scrollTo($('div#mc'), 0, {offset: 0, axis: 'y'});
342        }
343    } else {
344
345        if ($('div#m').length > 0) {
346        } else {
347            $('#page-content-wrapper div.container-fluid').before('<div id="m"></div>');
348        }
349        $('div#m').html("");
350        $('div#m').html('<div class="alert-dismissable alert alert-' + type + '"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>' + subject + '</strong> ' + text + '</div>');
351        if ($('div.basketLite').length > 0) {
352        } else {
353            $.scrollTo($('div#m'), 400, {offset: -80, axis: 'y',});
354        }
355        /*$('.bottom-right').notify({
356         type: type,
357         message: {
358         html: "<strong>" + subject + "</strong><br/>" + text
359         },
360         fadeOut: {enabled: true, delay: 3000}
361         }).show();
362         */
363    }
364}
365
366function md(type, subject, text, elementId, time, scroll) {
367    if ($('div#' + elementId).length > 0) {
368    } else {
369        $('#page-content-wrapper div.container-fluid').before('<div id="' + elementId + '"></div>');
370    }
371    $('div#' + elementId).html("");
372    $('div#' + elementId).html('<div class="alert-dismissable alert alert-' + type + '"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>' + subject + '</strong> ' + text + '</div>');
373    if (scroll) {
374        $.scrollTo($('div#' + elementId), 400, {offset: -80, axis: 'y',});
375    }
376}
377
378function sumTotE(z) {
379    var selected_id = $('select#s1_' + z).val();
380    var selected_c = $('select#s1_' + z).find("option:selected").data('c');
381    var m = $('select#s1_' + z).find("option:selected").data('m');
382    var selected_count = $('select#s2_' + z).val();
383    var total = selected_c * selected_count;
384    $('span#s3_' + z).text(total + " " + m);
385}
386
387function sumTotEM(z) {
388    //alert(z);
389    var total = 0;
390    var m = '';
391    $('select.s1_' + z).each(function () {
392        var selected_c = $(this).find("option:selected").data('c');
393        var val_c = $(this).find("option:selected").data('iii');
394        m = $(this).find("option:selected").data('m');
395        var selected_count = $('select#s2_' + val_c).val();
396        //alert('s1:' + selected_c + ',s2:' + selected_count + ',val_c:' + val_c + ',m:' + m);
397        total += selected_c * selected_count;
398    });
399
400
401    $('span#s3_' + z).text(total + " " + m);
402}
403
404function sumTotS(t) {
405
406    //var selected_c = $('select.eventCountSortiment').data('c');
407    var selected_c = $(t).data('c');
408    var ic = $(t).data('ic');
409    //var selected_count = $('select.eventCountSortiment').val();
410    var selected_count = $(t).val();
411    var total = selected_c * selected_count;
412    $('span.sumtotS[data-ic=' + ic + ']').text(total);
413}
414
415function roundToTwo(num) {
416//return +(Math.round(num + "e+2") + "e-2");
417    return parseFloat(num.toFixed(2));
418}
419
420function roundToOne(num) {
421    return parseFloat(num.toFixed(1));
422}
423
424function tablecartSum() {
425    //console.log("tablecartSum in action");
426    $tablecart_cena = 0;
427    $count = 0;
428    $countItems = 0;
429    if ($("table.tablecart").length > 0) {
430        $("table.tablecart tbody tr[class!='pojisteni'][class!='info']").each(function () {
431            $count++;
432            //$c = Math.ceil(Number($(this).data('c')));
433            //$c = Math.round(Number($(this).data('c')) * 10) / 10;
434            $c = roundToTwo(Number($(this).data('c')));
435            $tablecart_cena += Number($c);
436            $countItems += Number($(this).data('count'));
437        });
438        if ($count == 0) {
439            $('a#sc1').remove();
440            $("div#order-summary").remove();
441        }
442    } else {
443        if ($("#tt_1").data("c") > 0) {
444            //$tablecart_cena = Math.ceil(Number($("#tt_1").data("c")));
445            //$tablecart_cena = Math.round(Number($("#tt_1").data("c")) * 10) / 10;
446            $tablecart_cena = roundToTwo(Number($("#tt_1").data("c")));
447        } else {
448            $tablecart_cena = 0;
449        }
450        //$tablecart_cena = 0;
451    }
452
453
454    $tablecart_cena = roundToTwo($tablecart_cena);
455    /*console.log("tablecart_cena:"+$tablecart_cena);*/
456    //alert($tablecart_cena);
457    $('div#cart strong').text($tablecart_cena + " " + $('body').data('m'));
458    $('span#quantity').text($countItems);
459
460    if ($('a#pojisteniA').length > 0) {
461        if ($('a#pojisteniA').hasClass("active")) {
462            if ($('a#pojisteniA').data('c') > 0) {
463                //$tablecart_cena += Math.ceil(Number($('input.pojisteni_radio:checked').data('c')));
464                $tablecart_cena += roundToTwo(Number($('a#pojisteniA').data('c')));
465
466            } else {
467
468            }
469        } else {
470
471        }
472    } else {
473        if ($('#tt_3').data('c') > 0) {
474            //$tablecart_cena += Math.ceil(Number($('#tt_3').data('c')));
475            /*$tablecart_cena += Math.round(Number($('#tt_3').data('c')) * 10) / 10;*/
476            $tablecart_cena += Number($('#tt_3').data('c'));
477        }
478    }
479    /*console.log("tablecart_cena:"+$tablecart_cena);*/
480    if ($('body').data('m')=='EUR') {
481
482    } else {
483        /*console.log("non EUR, tablecart_cena:"+$tablecart_cena);*/
484        $tablecart_cena = roundToOne($tablecart_cena);
485    }
486    if ($("table.tablecart").length > 0) {
487        $('table.tablecart tfoot tr th span#t').text($tablecart_cena + " " + $('table.tablecart').data('m'));
488        if ($('div.pull-right a#sc1 strong.t')) {
489            $('div.pull-right a#sc1 strong.t').text($tablecart_cena + " " + $('table.tablecart').data('m'));
490        }
491    }
492    if (($("#tt_4").data('c') > 0)) {
493        //$tablecart_cena += Math.ceil(Number($("#tt_4").data('c')));
494        /*$tablecart_cena += Math.round(Number($("#tt_4").data('c')) * 10) / 10;*/
495        $tablecart_cena += Number($("#tt_4").data('c')) ;
496    }
497    if (($("#tt_2").data('c') > 0)) {
498        //$tablecart_cena += Math.ceil(Number($("#tt_2").data('c')));
499        /*$tablecart_cena += Math.round(Number($("#tt_2").data('c')) * 10) / 10;*/
500        $tablecart_cena += Number($("#tt_2").data('c')) ;
501    }
502
503    if (($("#tt_1_sleva").data('c') != '' && typeof ($("#tt_1_sleva").data('c')) != 'undefined')) {
504
505        //$tablecart_cena += Math.ceil(Number($("#tt_1_sleva").data('c')));
506        /*$tablecart_cena += Math.ceil(Number($("#tt_1_sleva").data('c')) * 10) / 10;*/
507        $tablecart_cena += Number($("#tt_1_sleva").data('c'));
508
509    }
510    //$tablecart_cena = Math.ceil($tablecart_cena);
511    /*$tablecart_cena = Math.round($tablecart_cena * 10) / 10;*/
512    $('th#tt_souhrn').text($tablecart_cena + " " + $('body').data('m'));
513
514    $('a#pojisteniA').unbind().click(function () {
515        var val = $(this).data('v');
516        pojisteniRadio(val);
517    });
518    $('a#pojisteniN').unbind().click(function () {
519        var val = $(this).data('v');
520        removeInsuranceFromCart(val);
521    });
522    $('a#showHideInsuranceInfoA').unbind().click(function () {
523        $visible = $('p#showHideInsuranceInfo:visible').is(":visible");
524        if ($visible) {
525            $('p#showHideInsuranceInfo').hide();
526        } else {
527            $('p#showHideInsuranceInfo').show();
528        }
529        return false;
530    });
531}
532
533function updateGenres(selected, language) {
534//alert(selected);
535    if (typeof selected != 'undefined') {
536        $.ajax({
537            type: "POST",
538            url: '/'+ language + "/api/cat/" + selected,
539            data: '',
540            dataType: "json",
541            async: true,
542            success: function (data) {
543                $i = $('.selectpicker#f_cat_genres').data('i');
544                $options = '<option value="">' + $('.selectpicker#f_cat_genres').attr('title') + '</option>';
545                $.each(data, function (index, element) {
546                    if ($i == element.i) {
547                        $options += '<option selected="selected" data-i="' + element.i + '" value="' + element.u + '">' + element.n + '</option>';
548                    } else {
549                        $options += '<option value="' + element.u + '" data-i="' + element.i + '">' + element.n + '</option>';
550                    }
551                });
552                $('.selectpicker#f_cat_genres').prop('disabled', false);
553                $('.selectpicker#f_cat_genres').selectpicker({title: ''});
554                $("#f_cat_genres").html($options);
555                $('.selectpicker#f_cat_genres').selectpicker('refresh');
556            }
557        });
558    }
559}
560
561function updateCity(category_id, genre_id, language) {
562//alert(category_id + "|" + genre_id);
563    if (typeof genre_id == 'undefined') {
564        genre_id = '';
565    }
566    if (typeof category_id == 'undefined') {
567    } else {
568        $.ajax({
569            type: "POST",
570            url: '/' + language + "/api/city/" + category_id + (genre_id != '' ? '/' + genre_id : ''),
571            data: '',
572            dataType: "json",
573            async: true,
574            success: function (data) {
575                $i = $('.selectpicker#f_cat_city').data('i');
576                $options = '<option value="">' + $('.selectpicker#f_cat_city').attr('title') + '</option>';
577                $.each(data, function (index, element) {
578                    if (element.n.length > 0) {
579                        if ($i == element.n) {
580                            $options += '<option selected="selected" values="' + element.n + '">' + element.n + '</option>';
581                        } else {
582                            $options += '<option value="' + element.n + '">' + element.n + '</option>';
583                        }
584                    }
585                });
586                $('.selectpicker#f_cat_city').prop('disabled', false);
587                $('.selectpicker#f_cat_city').selectpicker({title: ''});
588                $("#f_cat_city").html($options);
589                $('.selectpicker#f_cat_city').selectpicker('refresh');
590            }
591        });
592    }
593}
594
595function getTimeRemaining(endtime) {
596    var t = Date.parse(endtime) - Date.parse(new Date());
597    var seconds = Math.floor((t / 1000) % 60);
598    var minutes = Math.floor((t / 1000 / 60) % 60);
599    var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
600    var days = Math.floor(t / (1000 * 60 * 60 * 24));
601    return {
602        'total': t,
603        'days': days,
604        'hours': hours,
605        'minutes': minutes,
606        'seconds': seconds
607    };
608}
609
610function initializeClock(id, endtime) {
611    var clock = document.getElementById(id);
612    var daysSpan = clock.querySelector('.days');
613    var hoursSpan = clock.querySelector('.hours');
614    var minutesSpan = clock.querySelector('.minutes');
615    var secondsSpan = clock.querySelector('.seconds');
616
617    function updateClock() {
618        var t = getTimeRemaining(endtime);
619
620        daysSpan.innerHTML = t.days;
621        hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
622        minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
623        secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
624
625        if (t.total <= 0) {
626            clearInterval(timeinterval);
627        }
628    }
629
630    updateClock();
631    var timeinterval = setInterval(updateClock, 1000);
632}
633
634$(document).ready(function () {
635    $('.clockdiv').each(function () {
636        //var deadline = new Date(Date.parse(new Date()) + 15 * 24 * 60 * 60 * 1000);
637        var deadline = new Date($(this).data('date'));
638        initializeClock($(this).attr('id'), deadline);
639    });
640
641    $('select#form_id_stat_dodaci').change(function () {
642        $('input#form_id_zeme_fakturacni').val($('select#form_id_stat_dodaci option:selected').text());
643    });
644    if ($('select#form_id_stat_dodaci')) {
645        $('input#form_id_zeme_fakturacni').val($('select#form_id_stat_dodaci option:selected').text());
646    }
647    $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function (event) {
648        event.preventDefault();
649        event.stopPropagation();
650        $(this).parent().siblings().removeClass('open');
651        $(this).parent().toggleClass('open');
652    });
653
654    $("#menu-toggle").click(function (e) {
655        e.preventDefault();
656        if ($("#menu-full:visible").length>0) {
657            $("#menu-full").hide();
658        } else {
659            $("#search-full").hide();
660            $("#menu-full").show();
661        }
662    });
663    $("#search-toggle").click(function (e) {
664        e.preventDefault();
665        if ($("#search-full:visible").length>0) {
666            $("#search-full").hide();
667        } else {
668            $("#menu-full").hide();
669            $("#search-full").show();
670            $("input#searchElasticTop").focus();
671        }
672    });
673    $("#closeMenu").click(function (e) {
674        e.preventDefault();
675        $("#menu-full").hide();
676    });
677    $("#closeSearch").click(function (e) {
678        e.preventDefault();
679        $("#search-full").hide();
680        $("#search-full input#searchElasticTop").val("");
681        $('#autocompleteListTop').empty();
682    });
683    var debounceTimeout;
684
685    $('#searchElastic').on('input', function () {
686        var query = $(this).val();
687
688        clearTimeout(debounceTimeout);
689
690        debounceTimeout = setTimeout(function () {
691            searchElastic(query);
692        }, 300); // Debounce time in milliseconds
693    });
694    $('#searchElasticTop').on('input', function () {
695        var query = $(this).val();
696
697        clearTimeout(debounceTimeout);
698
699        debounceTimeout = setTimeout(function () {
700            searchElastic(query);
701        }, 300); // Debounce time in milliseconds
702    });
703
704    function searchElastic(query) {
705        if (query.length === 0) {
706            if ($("#search-full:visible").length>0) {
707                $('#autocompleteListTop').hide();
708            } else {
709                $('#autocompleteList').hide();
710            }
711            return;
712        }
713        var l = $('body').data('l');
714        $.ajax({
715            url: "/api/4.0/event/search/"+ l+"/s",
716            method: 'POST',
717            data: {
718                s: query
719            },
720            success: function (data) {
721                renderResults(data,query);
722            }
723        });
724    }
725    function logSearchResult(idZaznam,nazev,p,l,query) {
726        $.ajax({
727            type: "POST",
728            url: "/api/logActivity",
729            data: 'e=' + encodeURIComponent(idZaznam) + '&n=' + encodeURIComponent(nazev) + '&p=' + p + '&l=' + l+ '&t=K3&q='+encodeURIComponent(query),
730            dataType: "json",
731            async: true,
732            success: function (data) {
733            }
734        });
735        return true;
736    }
737    function renderResults(data,query) {
738        var l = $('body').data('l');
739        var $autocompleteList = $('#autocompleteList');
740        if ($("#search-full:visible").length>0) {
741            var $autocompleteList = $('#autocompleteListTop');
742        }
743        $autocompleteList.empty();
744
745        if (data.length === 0) {
746            $autocompleteList.hide();
747            return;
748        }
749        if (data.hits.total.value==0) {
750            var item = '<td><p>Ups, bohužel hledanému výrazu neodpovídá žádný záznam :-( <br/><em>TIP: Zkuste hledaný výraz zkrátit či přeformulovat.</em></p></td>';
751            if ($('body').data('l')=='sk') {
752                item = '<td><p>Ups, bohužiaľ neexistuje žiadna zhoda pre hľadaný výraz :-(<br/>TIP: Skúste skrátiť alebo preformulovať hľadaný výraz.</p></td>';
753            } else if ($('body').data('l')=='en') {
754                item = '<td><p>Oops, unfortunately no record matches the search term :-(<br/>TIP: Try shortening or rephrasing the search term.</p></td>';
755            }
756            var $listItem = $('<tr></tr>').html(item);
757            $autocompleteList.append($listItem);
758        }
759        var idP = $('body').data('p');
760        var idL = $('body').data('l');
761        $.each(data['hits']['hits'],function (key,val) {
762
763            var idE = data['hits']['hits'][key]._id;
764            var idN = data['hits']['hits'][key]._source.nazev;
765            var item = ''
766                + '<td class=""><a href="/'+l+'/event/'+data['hits']['hits'][key]._source.nazev_uri+'" data-e="E'+idE+'" data-i="'+idN+'" data-p="'+idP+'" data-l="'+idL+'" data-s="'+query+'" class="logAct"><img src="'+$cdnhostname+'upload/obrazek/zvetsena/'+data['hits']['hits'][key]._source.obrazek+'" class="search-result-image"></a></td>'
767                + '<td><h4><a href="/'+l+'/event/'+data['hits']['hits'][key]._source.nazev_uri+'" data-e="E'+idE+'" data-i="'+idN+'" data-p="'+idP+'" data-l="'+idL+'" data-s="'+query+'" class="logAct">'
768                + '<span class="label label-info hidden-xs-search-label" style="">'+data['hits']['hits'][key]._source.datum+'</span>'
769                + data['hits']['hits'][key]._source.nazev
770                + '<span class="label label-info show-xs-search-label" style="">'+data['hits']['hits'][key]._source.datum+'</span>'
771                + '</a></h4>'
772                + '<p style=""><span class="hidden-xs-search-label"><a href="/'+l+'/venue/'+data['hits']['hits'][key]._source.prostor_uri+'" style="">'+data['hits']['hits'][key]._source.prostor+'</a><br/></span>'
773                + '<span class="hidden-xs-search-label">vstupenky: </span><a href="/'+l+'/event/'+data['hits']['hits'][key]._source.nazev_uri+'" data-e="E'+idE+'" data-i="'+idN+'" data-p="'+idP+'" data-l="'+idL+'" data-s="'+query+'" class="logAct"><i class="fa fa-ticket"></i> '+data['hits']['hits'][key]._source.stav+'</a>'
774                + '</p>'
775                +'</td> ';
776            var $listItem = $('<tr></tr>').html(item);
777            $autocompleteList.append($listItem);
778        });
779        //data.forEach(function (item) {
780            //var $listItem = $('<li class="list-group-item"></li>').text(item);
781            //$autocompleteList.append($listItem);
782        //});
783
784        $autocompleteList.show();
785        $('.logAct',$autocompleteList).click(function(){
786            logSearchResult($(this).data('e'),$(this).data('i'),$(this).data('p'),$(this).data('l'),$(this).data('s'))
787        });
788    }
789
790
791    var highestBox = 0;
792    $('.sameheight').each(function () {
793        if ($(this).height() > highestBox) {
794            highestBox = $(this).height();
795        }
796    });
797    $('.sameheight').height(highestBox + 2);
798    /*var highestBox = 0;
799     $('.sameheight2').each(function () {
800     if ($(this).height() > highestBox) {
801     highestBox = $(this).height();
802     }
803     });
804     $('.sameheight2').height(highestBox);*/
805    var highestBox = 0;
806    $('.sameheight3').each(function () {
807        if ($(this).height() > highestBox) {
808            highestBox = $(this).height();
809        }
810    });
811    $('.sameheight3').height(highestBox);
812    var highestBox = 0;
813    $('.sameheight4').each(function () {
814        if ($(this).height() > highestBox) {
815            highestBox = $(this).height();
816        }
817    });
818    $('.sameheight4').height(highestBox);
819    $(function () {
820        $("[data-toggle='tooltip']").tooltip();
821    });
822    $('a.showMore').click(function () {
823        $('div.evlable:hidden').show();
824        $(this).parent().parent().hide();
825        return false;
826    });
827    $('.selectpicker').selectpicker();
828    $('.selectpickerL').selectpicker({
829        liveSearch: true,
830        size: 10,
831    });
832    if ($('.selectpicker#f_cat_categories option:selected').length > 0) {
833        $v = $('.selectpicker#f_cat_categories option:selected').val();
834        $('.selectpicker#f_cat_categories').selectpicker('val', $v);
835        var selected = $('option:selected', this).data('i');
836        updateGenres(selected, $('select#f_cat_categories').data('locale'));
837    }
838    $('.selectpicker#f_cat_categories').on('hidden.bs.select', function (e) {
839        var selected = $('option:selected', this).data('i');
840        updateGenres(selected, $('select#f_cat_categories').data('locale'));
841        updateCity(selected, '', $('select#f_cat_categories').data('locale'));
842    });
843    $('.selectpicker#f_cat_genres').on('hidden.bs.select', function (e) {
844        var selected = $('option:selected', this).data('i');
845        updateCity($('.selectpicker#f_cat_categories option:selected').data('i'), selected, $('select#f_cat_categories').data('locale'));
846    });
847    $('.selectpicker.eventCount').on('change', function () {
848        var z = $(this).data("z");
849        sumTotE(z);
850    });
851    $('.selectpicker.eventCountM').on('change', function () {
852        var z = $(this).data("z");
853        sumTotEM(z);
854    });
855    $('.selectpicker.ticketsType').on('change', function () {
856        var z = $(this).data("z");
857        sumTotE(z);
858    });
859    $('.selectpicker.ticketsTypeM').on('change', function () {
860        var z = $(this).data("z");
861        sumTotEM(z);
862    });
863    $('.eventCount').each(function () {
864        var z = $(this).data('z');
865        sumTotE(z);
866    });
867    $('.eventCountSortiment').each(function () {
868        sumTotS($(this));
869    });
870    $('.selectpicker.eventCountSortiment').on('change', function () {
871        sumTotS($(this));
872    });
873    if ($('.selectpicker#f_cat_genres')) {
874        $('.selectpicker#f_cat_genres').prop('disabled', true);
875        $('.selectpicker#f_cat_genres').selectpicker('refresh');
876    }
877    $('button#f_cat_search_btn').click(function () {
878//alert($('.selectpicker#f_cat_genres option:selected')+$('.selectpicker#f_cat_genres option:selected').val()+'|'+$('.selectpicker#f_cat_genres option:selected').attr('i')+'|'+$('.selectpicker#f_cat_genres option:selected').attr('value'));
879        $c = $('.selectpicker#f_cat_categories option:selected').val();
880        $g = $('.selectpicker#f_cat_genres option:selected').attr('value');
881        $city = $('.selectpicker#f_cat_city option:selected').attr('value');
882        $d = $('input#f_cat_date').val()
883        if ($c != '') {
884            $u = $('select#f_cat_categories').data('locale') + '/cat/' 
884+ $c;
885        } else {
886            $u = $('select#f_cat_categories').data('locale') + '/cat';
887        }
888        $a = '';
889        if ($g != '') {
890            $u = $u + '/' + $g;
891        }
892        if ($city != '' && $d != '') {
893            $a = '?c=' + $city + '&d=' + $d;
894        } else if ($city != '' && $d == '') {
895            $a = '?c=' + $city;
896        } else if ($city == '' && $d != '') {
897            $a = '?d=' + $d;
898        }
899
900        if ($a != '') {
901            $u = $u + $a;
902        }
903//alert($u + "|" + $city);
904        window.location.href = '/'+ $u;
905    });
906    $('a.datePicker').click(function (e) {
907        e.preventDefault();
908        t = $(this).attr("id");
909        $d = '';
910        $today = new Date();
911        switch (t) {
912            case "c1":
913                break;
914            case "c2":
915                $today = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
916                break;
917            case "c3":
918        }
919        switch (t) {
920            case "c1":
921            case "c2":
922                var dd = $today.getDate();
923                var mm = $today.getMonth() + 1; //January is 0!
924                var yyyy = $today.getFullYear();
925                if (dd < 10) {
926                    dd = '0' + dd;
927                }
928                if (mm < 10) {
929                    mm = '0' + mm;
930                }
931                $d = dd + '.' + mm + '.' + yyyy;
932                break;
933            case "c3":
934            case "c4":
935            case "c5":
936                $d = $(this).data('d');
937                break;
938        }
939
940        $("input#f_cat_date").val($d);
941    });
942
943
944    if ($('table.tablecart').length > 0) {
945        tablecartSum();
946        showCartSummary();
947    }
948
949    /*
950     $('input.deliveryRadio').click(function () {
951     var c = $(this).data('c');
952     deliveryRadio(c);
953     });
954     $('input.paymentRadio').click(function () {
955     var c = $(this).data('c');
956     paymentRadio(c);
957     });
958     */
959    $('input.deliveryPaymentRadio').click(function () {
960        var cp = eval(eval($(this).data('cp')) + eval($(this).data('po')));
961
962        var cd = $(this).data('cd');
963
964        deliveryRadio(cd);
965        paymentRadio(cp);
966        tablecartSum();
967        $('div.payment-method').each(function () {
968            $(this).removeClass("active");
969        });
970        $(this).parent().parent().addClass("active");
971    });
972
973    /*
974        $('input.pojisteni_radio:checked').each(function () {
975            var val = $(this).val();
976            pojisteniRadioStart(val);
977        });
978    */
979
980    $('button.reg').click(function () {
981        $val = $('input#fos_user_registration_form_email').val();
982        $('input#fos_user_registration_form_username').val($val);
983        return true;
984    });
985    $('[data-toggle="ajaxModal"]').on('click', function (e) {
986            $('#ajaxModal').remove();
987            e.preventDefault();
988            var $this = $(this)
989                , $remote = $this.data('remote') || $this.attr('href')
990                , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>');
991            $('#footerr').before($modal);
992            $modal.modal({backdrop: 'static', keyboard: false});
993            $modal.load($remote);
994        }
995    );
996    $('#notificationsmodal').on('shown.bs.modal', function () {
997        showNotifications(1);
998    });
999
1000
1001    $('div.seats').each(function () {
1002        var zona = $(this);
1003        var loaded = zona.data('loaded');
1004        var zona_id = zona.data('id');
1005        var im = zona.data('im');
1006        var event_uri = zona.data('u');
1007        var locale = $('body').data('l');
1008        if (!loaded) {
1009            zona.data('loaded', true);
1010            refreshZona(zona_id, event_uri, locale, false, im);
1011        }
1012    });
1013    $('a.zz').click(function (event) {
1014        event.preventDefault();
1015        event.stopPropagation();
1016        var zona = $(this);
1017        var zona_id = zona.data('id');
1018        var im = zona.data('im');
1019        var event_uri = zona.data('u');
1020        var locale = $('body').data('l');
1021        refreshZona(zona_id, event_uri, locale, true, im);
1022    });
1023    $('a.inpageJump').click(function (event) {
1024        event.preventDefault();
1025        event.stopPropagation();
1026        var h = $(this).attr("href");
1027        h = h.substr(1);
1028        var target = 'div#' + h;
1029        //alert(target);
1030        $.scrollTo(target, 400, {
1031                offset: -80,
1032                axis: 'y',
1033                onAfter: function () {
1034                    $('div#' + h + ' h4').fadeOut(400, function () {
1035                        $(this).fadeIn(400);
1036                    });
1037                }
1038            }
1039        );
1040    });
1041    $('button.kodButton').click(function () {
1042        var valKod = $('input#kod').val();
1043        window.location.href = "/promo/" + valKod;
1044    });
1045    $('[data-toggle="tooltip"]').tooltip();
1046    $('input#priceReplacement').change(function () {
1047        var priceNew = $(this).val();
1048        $.ajax({
1049            type: "POST",
1050            url: "/api/cart/priceReplacement",
1051            data: 'p=' + priceNew,
1052            dataType: "json",
1053            async: true,
1054            success: function (data) {
1055
1056            }
1057        });
1058    });
1059    $('input#internalNote').change(function () {
1060        var internalNote = $(this).val();
1061        $.ajax({
1062            type: "POST",
1063            url: "/api/cart/priceReplacement",
1064            data: 't=' + internalNote,
1065            dataType: "json",
1066            async: true,
1067            success: function (data) {
1068
1069            }
1070        });
1071    });
1072
1073
1074});

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.