PageSourceSearch

https://www.mm-filmpresse.de/js/front/custom.js?_v=2026092500-02

js mm-filmpresse.de collected 2026-09-24 22:57:18 UTC 9,984 bytes, 419 lines download raw bytes

1var body;
2var initialized = false;
3
4$(function () {
5    body = $("body");
6
7    initAll();
8});
9
10
11var initAll = function () {
12    if (!initialized) {
13        initOnce();
14
15        initialized = true;
16    }
17
18    initAlways();
19}
20
21
22var initOnce = function () {
23    //initFooter();
24    initAjax();
25    initScrollToTarget();
26    initBlockAsLink();
27    showModals();
28    initChangeHandles();
29}
30
31
32var initAlways = function () {
33    showFlashMessages();
34    initLightbox();
35    initSelect();
36}
37
38
39/**
40 * FLASH MESSAGES
41 */
42var showFlashMessages = function () {
43    $("div.flash-messages").each(function (i) {
44        var text = $(this).html();
45
46        if ($(this).hasClass("info") || $(this).hasClass("success")) {
47            alertify.success(text);
48        }
49        if ($(this).hasClass("error") || $(this).hasClass("danger")) {
50            alertify.error(text);
51        }
52    })
53}
54
55
56/**
57 * AJAX
58 */
59var initAjax = function () {
60    body.on('click', "a.ajax", function (event) {
61        event.preventDefault();
62
63        if (!$(this).hasClass('with-confirm')) {
64            ajaxGet(this.href);
65        }
66    });
67
68    body.on('click', ".ajax-click", function (e) {
69        e.preventDefault();
70
71        ajaxGet($(this).attr('href'));
72    })
73
74    body.on('click', "a.ajax-modal", function (event) {
75        event.preventDefault();
76
77        var modalTarget = $($(this).data('target'));
78
79        ajaxGet(this.href, function (payload) {
80            if (modalTarget && modalTarget.length && (typeof payload.doNotOpenModal === 'undefined' || !payload.doNotOpenModal)) {
81                modalTarget.modal('show');
82            }
83        });
84    });
85
86    body.on('submit', "form.ajax", function (event) {
87        event.preventDefault();
88
89        var formCloseButton = $(this).hasClass('ajax-modal-close') ? $(this).closest('.modal').find(".close") : null;
90
91        ajaxPost(this.action, $(this).serialize(), function (payload) {
92            if (formCloseButton && (typeof payload.doNotCloseModal === 'undefined' || !payload.doNotCloseModal)) {
93                formCloseButton.trigger('click');
94            }
95        });
96    });
97}
98
99
100var ajaxGet = function (href, callback) {
101    $.ajax({
102        type: 'get',
103        url: href,
104        cache: false,
105        success: function (payload) {
106            ajaxCallback(payload, callback);
107        }
108    });
109}
110
111
112var ajaxPost = function (action, data, callback) {
113    $.post(action, data, function (payload) {
114        ajaxCallback(payload, callback);
115    });
116}
117
118
119var ajaxCallback = function (payload, callback) {
120    if (payload.redirect) {
121        location.href = payload.redirect;
122    }
123
124    if (payload.snippets) {
125        for (var i in payload.snippets) {
126            $('#' + i).html(payload.snippets[i]);
127
128            $('#' + i + ' form').each(function () {
129                Nette.initForm(this);
130            });
131        }
132    }
133
134    if (payload.forms) {
135        for (var f in payload.forms) {
136            if (payload.forms[f]) {
137                for (var i in payload.forms[f]) {
138                    $("#frm-" + f + "-" + i).val(payload.forms[f][i]);
139                }
140            }
141        }
142    }
143
144    if (payload.urlParameter) {
145        window.history.replaceState(null, null, payload.urlParameter);
146    }
147
148    if (payload.formInputFocus) {
149        var field = $("input[name=" + payload.formInputFocus + "]");
150        if (field.length) {
151            field.focus();
152        }
153    }
154
155    if (callback) {
156        callback(payload);
157    }
158
159    initAll();
160}
161
162var initSelect = function() {
163    /*$('select').select2({
164        minimumResultsForSearch: -1
165    });*/
166
167    $('.selectpicker').selectpicker({
168        style: 'btn-primary',
169        size: 10
170    });
171}
172
173var initScrollToTarget = function () {
174    body.on('click', ".scroll-to-target", function (event) {
175        event.preventDefault();
176        event.stopPropagation();
177
178        scrollToTarget($($(this).data('target')));
179    });
180}
181
182
183var scrollToTarget = function (target) {
184    if (target.length) {
185        $("html, body").animate({
186            scrollTop: Math.max(target.offset().top - 20, 0)
187        }, getScrollSpeed(target));
188    }
189}
190
191
192var getScrollSpeed = function (target) {
193    const targetTop = target.offset().top;
194    const windowTop = $(window).scrollTop();
195
196    return Math.round(windowTop > targetTop ? windowTop - targetTop : targetTop - windowTop) / 2;
197}
198
199
200var showModals = function () {
201    if (location.hash) {
202        var modal = $(location.hash);
203
204        if (modal.length && modal.hasClass('modal')) {
205            modal.modal('show');
206        }
207    }
208}
209
210
211var initBlockAsLink = function () {
212    body.on('click', ".block-as-link", function (event) {
213        var ignored = $(event.target).closest(".block-as-link-ignore").length > 0;
214        var a = $(this).find("a");
215
216        if (a.length && !ignored) {
217            location.href = a.attr('href');
218        }
219    });
220}
221
222
223var initDatePicker = function() {
224
225    var date = new Date();
226
227    /* Datepicker */
228    $('.datepicker-input').datepicker({
229        language: 'cs',
230        format: 'dd.mm.yyyy',
231        autoclose: true,
232        container: ".date-input",
233        startDate: date,
234        todayHighlight: true
235    });
236    /* END Datepicker */
237}
238
239
240var initLightbox = function () {
241    $('.photo-popup').magnificPopup({
242        type: 'image',
243    });
244
245    $('.photo-gallery').each(function() {
246        $(this).magnificPopup({
247            delegate: '.photo-gallery-item',
248            type: 'image',
249            gallery: {
250                enabled: true,
251                navigateByImgClick: true,
252                tPrev: '',
253                tNext: '',
254                tCounter: '%curr% / %total%'
255            }
256        });
257    })
258}
259
260
261var initChangeHandles = function () {
262    $("body").on('change', "select.change-handler, input[type=text].change-handler", function () {
263        ajaxGet($(this).data('handler') + $(this).val());
264    });
265
266    $("body").on('click', ".click-handler", function () {
267        ajaxGet($(this).data('handler') + $(this).data('value'));
268    });
269}
270
271
272
273// live form
274$(function() {
275    // live form validation
276    LiveForm.setOptions({
277        wait: 200,
278        showValid: true
279    });
280})
281
282
283// swipers
284$(function() {
285
286    $('.header-menu-toggle').click(function () {
287        $(this).toggleClass('open');
288    });
289    const swiper = new Swiper('.hp-slider', {
290        direction: 'horizontal',
291        slidesPerView: 1,
292        loop: true,
293        autoplay: {
294            delay: 5000,
295            disableOnInteraction: false,
296        },
297        // Navigation arrows
298        navigation: {
299            nextEl: '.swiper-button-next',
300            prevEl: '.swiper-button-prev',
301        },
302    });
303
304
305    newsSlider = new Swiper('.news-slider', {
306        slidesPerView: 'auto',
307        slideClass: 'news-item-col',
308        // Navigation arrows
309        navigation: {
310            nextEl: '.swiper-button-next',
311            prevEl: '.swiper-button-prev',
312        },
313    });
314
315    galSlider = new Swiper('.gal-slider', {
316        slidesPerView: '1',
317        // slideClass: 'news-item-col',
318        // Navigation arrows
319        navigation: {
320            nextEl: '#gal-next',
321            prevEl: '#gal-prev',
322        },
323    });
324
325    trailerSlider = new Swiper('.trailer-slider', {
326        slidesPerView: '1',
327        spaceBetween: 24,
328        // slideClass: 'news-item-col',
329        // Navigation arrows
330        navigation: {
331            nextEl: '#trailer-next',
332            prevEl: '#trailer-prev',
333        },
334    });
335});
336
337
338// more less
339$(function() {
340    if ($('.more-less-wrap').length) {
341        $backSize = $(".more-less-btn").data("size");
342        if ($('.more-less-wrap').height() < $backSize) {
343            $(".more-less-btn").hide();
344            $('.more-less-wrap').addClass("open");
345        }
346        else {
347            $('.more-less-wrap').css("height", $backSize);
348        }
349    }
350    $('.more-less-btn').on('click', function (e) {
351        e.preventDefault();
352        totalHeight = 0
353        $el = $(this);
354        $backSize = $(this).data("size");
355        console.log($backSize);
356        $moreLess = $(this).prev('.more-less-wrap');
357        totalHeight += $($moreLess).children(".more-less-inner").outerHeight();
358        if (!($moreLess).hasClass('open')) {
359            $moreLess.css({
360                "height": $moreLess.height(),
361                "max-height": 9999
362            }).animate({
363                "height": totalHeight
364            })
365            .toggleClass('open');
366            $moreLess.next('.more-less-btn').addClass("hide-btn").removeClass('show-more');
367        } else {
368            $moreLess.animate({
369                "height": $backSize
370            })
371            .toggleClass('open');
372            $moreLess.next('.more-less-btn').addClass("show-btn").removeClass("show-less");
373        }
374        return false;
375
376    });
377})
378
379
380// gallery
381$(function() {
382    $("body").on('click', ".gal-item-show-more", function(e) {
383        e.preventDefault();
384
385        $(this).closest(".gal-overlay").find(".gal-item-list .gal-item:not(:visible)").each(function() {
386            $(this).slideDown(200);
387        })
388
389        $(this).parent().remove();
390    })
391})
392
393
394// search
395var searchTimer;
396$(function() {
397    body.on("keyup", "#searchModal .search-input input, #search-wrap .search-input input", function() {
398        var _this = $(this);
399        var term = _this.val();
400        clearTimeout(searchTimer);
401
402        searchTimer = setTimeout(function() {
403            ajaxGet(_this.data('handler')+term, function() {
404                _this.closest(".search-wrap").find(".search-results").show();
405            });
406        }, 400);
407    })
408
409    body.on('click', "#searchModal .search-input .search-button, #search-wrap .search-input .search-button", function() {
410        window.location.href = $(this).data('handler')+$(this).parent().find("input").val();
411    });
412
413    $(".search-wrap").hover(function(){
414            $(".search-results").show();
415        },
416        function(){
417            $(".search-results").hide();
418        });
419})

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.