PageSourceSearch

https://www.profidoplnkystravy.cz/js/custom.js

js profidoplnkystravy.cz collected 2026-10-08 11:45:49 UTC 91,020 bytes, 2,914 lines download raw bytes

1//settings
2const insta_token = $('#insta_token').val();
3//---------
4
5
6document.addEventListener("DOMContentLoaded", function() {
7
8    if ($(".parallax").length > 0) {
9
10        const parallax = document.querySelector(".parallax");
11
12        const imageUrl = parallax.getAttribute("data-bg");
13        if (imageUrl) {
14            parallax.style.backgroundImage = `url('${imageUrl}')`;
15        }
16
17        function updateParallax() {
18            let scrollPosition = window.scrollY;
19            let windowHeight = window.innerHeight;
20            let parallaxOffset = parallax.offsetTop;
21            let parallaxHeight = parallax.offsetHeight;
22
23            let percentage = (scrollPosition + windowHeight - parallaxOffset) / (windowHeight + parallaxHeight);
24            let backgroundPosY = percentage * 50;
25
26            parallax.style.backgroundPosition = `center ${backgroundPosY}%`;
27        }
28
29        window.addEventListener("scroll", updateParallax);
30        updateParallax();
31    }
32});
33
34function throttle(func, limit) {
35    let lastFunc;
36    let lastRan;
37    return function() {
38        const context = this;
39        const args = arguments;
40        if (!lastRan) {
41            func.apply(context, args);
42            lastRan = Date.now();
43        } else {
44            clearTimeout(lastFunc);
45            lastFunc = setTimeout(function() {
46                if (Date.now() - lastRan >= limit) {
47                    func.apply(context, args);
48                    lastRan = Date.now();
49                }
50            }, limit - (Date.now() - lastRan));
51        }
52    };
53}
54
55function debounce(func, wait, immediate = false) {
56    let timeout;
57    return function(...args) {
58        const context = this;
59
60        const callNow = immediate && !timeout;
61
62        clearTimeout(timeout);
63        timeout = setTimeout(() => {
64            timeout = null;
65        }, wait);
66
67        if (callNow) func.apply(context, args);
68    };
69}
70
71
72const observerLozad = lozad('picture', { threshold: 0.1 });
73
74function myFunction() {
75    var input, filter, ul, li, a, i, txtValue;
76    input = document.getElementById('search-list');
77    filter = input.value.toUpperCase();
78    ul = document.getElementById("myUL");
79    li = ul.getElementsByTagName('li');
80
81    for (i = 0; i < li.length; i++) {
82        a = li[i].getElementsByTagName("label")[0];
83        txtValue = a.textContent || a.innerText;
84        if (txtValue.toUpperCase().indexOf(filter) > -1) {
85            li[i].style.display = "";
86        } else {
87            li[i].style.display = "none";
88        }
89    }
90}
91
92
93
94function setEqualHeight(wrapperClass, itemClass, elementsClasses, rowBased = false) {
95    var tolerance = 2;
96    var wrappers = $(wrapperClass);
97
98    if (wrappers.length === 0) {
99        return;
100    }
101
102    wrappers.each(function() {
103        var wrapper = $(this);
104        var isGrid = wrapper.css('display') === 'grid';
105        var items = wrapper.find(itemClass);
106
107        // Reset výšky před výpočtem
108        items.css('height', 'auto');
109        elementsClasses.forEach(function(elementClass) {
110            items.find(elementClass).css('height', 'auto');
111        });
112
113        var itemsPerRow;
114        if (isGrid) {
115            // Získáme počet sloupců z grid-template-columns
116            var gridTemplateColumns = wrapper.css('grid-template-columns');
117            itemsPerRow = gridTemplateColumns.split(' ').length;
118        } else {
119            var itemWidth = items.outerWidth();
120            var gap = parseInt(wrapper.css('gap')) || 0;
121            var wrapperWidth = wrapper.width();
122            itemsPerRow = 0;
123            var totalWidth = 0;
124
125            items.each(function(index) {
126                totalWidth += itemWidth;
127                if (index > 0) {
128                    totalWidth += gap;
129                }
130                if (totalWidth > wrapperWidth + tolerance) {
131                    return false;
132                }
133                itemsPerRow++;
134            });
135        }
136
137        if (rowBased) {
138            // Procházíme řádky, kde každý řádek má "itemsPerRow" položek
139            for (let i = 0; i < items.length; i += itemsPerRow) {
140                let rowItems = items.slice(i, i + itemsPerRow);
141                equalizeHeights(rowItems, elementsClasses, itemClass, isGrid);
142            }
143        } else {
144            equalizeHeights(items, elementsClasses, itemClass, isGrid);
145        }
146    });
147}
148
149function equalizeHeights(items, elementsClasses, itemClass, isGrid) {
150    elementsClasses.forEach(function(elementClass) {
151        var maxHeight = 0;
152        var elements = items.find(elementClass);
153
154        elements.each(function() {
155            let elementHeight = $(this).height();
156
157            if ($(this).css('box-sizing') === 'border-box') {
158                elementHeight += parseFloat($(this).css('padding-top')) || 0;
159                elementHeight += parseFloat($(this).css('padding-bottom')) || 0;
160            }
161
162            maxHeight = Math.max(maxHeight, elementHeight);
163        });
164
165        elements.css('height', maxHeight + 'px');
166    });
167
168    if (!isGrid) {
169        var maxItemHeight = 0;
170        items.each(function() {
171            let itemHeight = $(this).height();
172
173            if ($(this).css('box-sizing') === 'border-box') {
174                itemHeight += parseFloat($(this).css('padding-top')) || 0;
175                itemHeight += parseFloat($(this).css('padding-bottom')) || 0;
176            }
177
178            maxItemHeight = Math.max(maxItemHeight, itemHeight);
179        });
180
181        items.css('height', maxItemHeight + 'px');
182    }
183}
184
185
186
187
188function initializeEqualHeight() {
189
190    setEqualHeight('.products.carousel', '.item', ['h3', '.text', '.availability', '.info-wrap', '.info-box > div:first-child', '.info-box', '.desc', ], false);
191    setEqualHeight('.products:not(.carousel)', '.item', ['h3', '.text', '.availability', '.info-wrap', '.info-box > div:first-child', '.info-box', '.desc', ], true);
192
193    setEqualHeight('.blog-posts.carousel', '.item', ['h3'], false);
194    setEqualHeight('.blog-posts:not(.carousel)', '.item', ['.desc-wrap'], true);
195
196    setEqualHeight('.best-selling', '.item', ['h3', '.price-block'], false);
197}
198
199const debouncedInitializeEqualHeight = debounce(initializeEqualHeight, 200, true);
200
201
202
203
204
205
206function setHeights($list, item) {
207    $list.each(function() {
208
209        var $items = $(this).find(item);
210        $items.css('height', 'auto');
211        var perRow = Math.floor($list.width() / $items.width());
212        if (perRow == null || perRow < 2) return true;
213        for (var i = 0, j = $items.length; i < j; i += perRow) {
214            var maxHeight = 0,
215                $row = $items.slice(i, i + perRow);
216            $row.each(function() {
217                var itemHeight = parseInt($(this).outerHeight());
218                if (itemHeight > maxHeight) maxHeight = itemHeight;
219            });
220            if (maxHeight > 0) $row.css('height', maxHeight);
221        }
222        //$items.css( 'height', maxHeight + 'px' );
223    });
224}
225
226function integer(number) {
227    return Math[number < 0 ? 'ceil' : 'floor'](number);
228}
229
230var bannerIndex = $('.products > div.banner_list').index();
231
232function clearLines($list, item) {
233
234    $list.each(function() {
235
236        if ($(this).find('.banner_list')) {
237
238            var banner = $(this).find('.banner_list').detach();
239
240        }
241
242
243        $(this).children('.clear-x').remove();
244
245        $(this).append('<div class="clear-x"></div>');
246        var $items = $(this).find(item);
247
248        var perRow = Math.floor(($list.outerWidth() + 5) / $items.outerWidth());
249        if (perRow == null || perRow < 2 || perRow == 'Infinity') return true;
250
251        //alert($items.outerWidth());
252
253        var itm = item + ':nth-child(' + perRow + 'n)';
254        //alert(itm);
255
256        $(this).find(itm).after('<div class="clear-x"></div>');
257
258        if ($(this).find('.banner_list')) {
259            var line = (integer(bannerIndex / perRow) * perRow) - 1;
260            //var line=(perRow*2)-1;
261
262
263            banner.insertAfter($(this).find(item + ':eq(' + line + ')'));
264
265        }
266
267
268    });
269}
270
271function setHeights2($list, item) {
272
273    $list.each(function() {
274
275
276        var $items = $(this).find(item);
277        $items.css('height', 'auto');
278        var perRow = Math.floor($list.width() / ($items.width() - 2));
279        if (perRow == null || perRow < 2) return true;
280
281        for (var i = 0, j = $items.length; i < j; i += perRow) {
282            var maxHeight = 0,
283                $row = $items.slice(i, i + perRow);
284            $row.each(function() {
285                var itemHeight = parseInt($(this).height());
286                if (itemHeight > maxHeight) maxHeight = itemHeight;
287            });
288            if (maxHeight > 0) $row.css('height', maxHeight);
289        }
290    });
291}
292
293function startListHeight($tag) {
294
295    function setHeight(s) {
296        s.css('height', 'auto');
297        var max = 0;
298        s.each(function() {
299            var h = $(this).height();
300            max = Math.max(max, h);
301        }).height('').height(max);
302    }
303
304    $(window).on('ready load resize', setHeight($tag));
305}
306
307
308var product_list = function() {
309
310    $(".products .item .wrap").each(function() {
311        $(this).on({
312            mouseenter: function() {
313                var height = $(this).find(".height-wrap").height();
314                $(this).find(".hidden-box").height(height);
315            },
316            mouseleave: function() {
317                $(this).find(".hidden-box").height(0);
318            },
319        });
320    });
321
322
323    initCarousel();
324
325
326    if ($("#basketa").length > 0) {
327        setTimeout(function() {
328            startListHeight($('.more_tr .graybox .wrap:visible .products .wrap  h3'));
329            startListHeight($('.more_tr .graybox .wrap:visible .products .wrap  .info-wrap'));
330            startListHeight($('.more_tr .graybox .wrap:visible .products .wrap  .info-box'));
331            startListHeight($('.more_tr .graybox .wrap:visible .products .wrap  .info-box > div:first-child'));
332            startListHeight($('.more_tr .graybox .wrap:visible .products .item'));
333        }, 400);
334
335    } else {
336
337        $('.banner_list').hide();
338        // clearLines($('.products:not(.variant2):not(.carousel)'), '.item');
339        $('.banner_list').show();
340
341        debouncedInitializeEqualHeight()
342
343
344    }
345
346    $(".products .item, .products .owl-item  ").hover(
347        function() {
348            var that = this;
349            $(that).css('z-index', '9000');
350        },
351        function() {
352            var that = this;
353            $(that).css('z-index', '8000');
354            setTimeout(function() {
355                $(that).css('z-index', '1000');
356            }, 0);
357        }
358    );
359
360    prepareFavoriteAnimation();
361
362
363};
364
365var prepare_slider = function() {
366
367};
368
369function prepareFavoriteAnimation() {
370
371    $(".products .item .favorite").mouseenter(function() {
372            $(this).addClass('hover');
373
374        })
375        .mouseleave(function() {
376            $(this).removeClass('hover');
377
378        });
379
380    $(".products .item .favorite").each(function() {
381        if (!$(this).find('.animateHeart').length) {
382            $(this).append('<img class="animateHeart" alt="" src="./images/svg/favorite2.svg" />');
383
384        }
385
386    });
387
388
389    $(".products .item .favorite").off('click.favoriteAnim').on("click.favoriteAnim", function(e) {
390
391
392
393        e.preventDefault();
394
395        var activated = $(this).hasClass('active');
396
397        $(this).toggleClass("active");
398
399
400
401        // if ($('body').width() <= 450) {
402        //     var favorite = $('header .middle-box .table-container .col.mobile .mobile-menu');
403        //     var move = -7;
404        // } else {
405        //     var favorite = $('header .middle-box .table-container .col.favorite-col .favorite >');
406        //     var move = 0;
407        // }
408
409
410
411
412        var width = favorite.width();
413        var imgtodrag = $(this).find('img');
414
415        if (imgtodrag && !activated) {
416            $(this).removeClass("hover");
417            var imgclone = imgtodrag.clone()
418                .offset({
419                    top: imgtodrag.offset().top,
420                    left: imgtodrag.offset().left
421                })
422                .css({
423                    'opacity': '0.6',
424                    'position': 'absolute',
425                    'height': '40px',
426                    'width': '40px',
427                    'margin-left': '-6px',
428                    'margin-top': '-5px',
429                    'z-index': '9999'
430                })
431                .appendTo($('body'))
432                .animate({
433                    'top': favorite.offset().top + move,
434                    'left': favorite.offset().left + 0,
435                    'width': width,
436                    'height': width,
437                    'margin-left': '0px',
438                    'margin-top': '0px',
439                }, 1000, 'easeInOutCubic');
440
441
442
443            imgclone.animate({
444                'width': width,
445                'height': width,
446                'opacity': 0
447            }, function() {
448                $(this).detach();
449            });
450        }
451
452    });
453
454
455
456}
457
458
459
460function refreshPage() {
461    $(window).trigger('resize');
462}
463
464
465
466
467var window_width = 0;
468var lastContainerWidth = 0;
469
470var wideMenu = function() {
471
472
473    const $outerWrap = $('.outer-wrap');
474    const $menuSpace = $('#menu-space');
475    const $menuNext = $('#menu-next ul');
476    const currentContainerWidth = $menuSpace.find('.menu').width();
477
478    if (currentContainerWidth === lastContainerWidth) {
479        return;
480    }
481
482    lastContainerWidth = currentContainerWidth;
483
484    $('.menu > li').removeClass('visible');
485
486    const windowWidth = $('body').width();
487
488    $outerWrap.css('max-width', '100%');
489
490    if (windowWidth > 979) {
491        let totalWidth = 0;
492        const overflowItems = [];
493        let shouldMoveToOverflow = false;
494
495        $menuNext.empty();
496
497        const $menuItems = $menuSpace.find('.menu > li:not(.space-submenu):not(.logo-menu)').hide();
498
499        const availableWidth = $menuSpace.find('.menu').outerWidth(true);
500        $menuItems.each(function() {
501            const $item = $(this);
502            const itemWidth = $item.outerWidth(true);
503
504            if (!shouldMoveToOverflow && (totalWidth + (itemWidth + 55)) < availableWidth) {
505                totalWidth += itemWidth;
506                $item.show();
507            } else {
508                shouldMoveToOverflow = true;
509                overflowItems.push($item.clone().show());
510            }
511        });
512
513        if (overflowItems.length) {
514            totalWidth += 50;
515        }
516
517        $outerWrap.css('max-width', totalWidth);
518
519        if (overflowItems.length) {
520            $menuNext.append(overflowItems);
521            $('.space-submenu').show();
522            $menuSpace.addClass('overflow');
523        } else {
524            $('.space-submenu').hide();
525            $menuSpace.removeClass('overflow');
526        }
527    }
528
529    $('.menu > li:not(.logo-menu)').addClass('visible');
530};
531
532
533var sticky_navigation = function() {
534    const wrap = $("header");
535    const st = $(window).scrollTop();
536
537    const width = $('body').width();
538
539    if (width <= 979) {
540        if (st > 300) {
541            wrap.addClass('fixed')
542            setTimeout(function() {
543                wrap.addClass('animation')
544            }, 10);
545
546        } else {
547            wrap.removeClass('fixed')
548            wrap.removeClass('animation')
549        }
550
551    } else {
552        wrap.removeClass('fixed')
553        wrap.removeClass('animation')
554    }
555};
556
557
558// NEW
559
560
561//header
562var lastScrollTop = 0;
563
564$(window).on('scroll', function() {
565     if ($('.overlay').css('display') === 'block' || $('.header-wrap').hasClass('v2')) {
566        return;
567    }
568
569    if ($(window).width() > 979) {
570        var st = $(this).scrollTop();
571        if (st > 100) {
572            if (st > lastScrollTop) {
573                $('body').removeClass('sticky-nav-show').addClass('sticky-nav-hide');
574            } else if (st < lastScrollTop) {
575                $('body').removeClass('sticky-nav-hide').addClass('sticky-nav-show');
576            }
577        } else {
578            $('body').removeClass('sticky-nav-show sticky-nav-hide');
579        }
580        lastScrollTop = st;
581    } else {
582        $('body').addClass('sticky-nav-hide');
583    }
584});
585
586var $masonryEl = $('header #menu .wrap > ul');
587var initMansory = function() {
588    if (typeof $.fn.masonry === 'function' && $masonryEl.length) {
589        if ($masonryEl.data('masonry')) {
590            $masonryEl.masonry('destroy');
591        }
592        $masonryEl.masonry({ percentPosition: true });
593    }
594}
595
596
597
598$(document).ready(function() {
599    if ($('#sticky-widget').length) {
600        var $trigger = $('#widget-trigger');
601
602        $(window).on('scroll', function() {
603            var scrollTop = $(window).scrollTop();
604
605            var triggerBottom = $trigger.offset().top + $trigger.outerHeight();
606
607            if (scrollTop > triggerBottom) {
608                $('body').addClass('widget-visible');
609            } else {
610                $('body').removeClass('widget-visible');
611            }
612        });
613    }
614
615    $(document).on('click', '.radio-block.basket-gift .item', function(e) {
616        e.preventDefault();
617        var $radio = $(this).find('input[type="radio"]');
618        if ($radio.length) {
619            $radio.prop('checked', true).trigger('change');
620
621            $.ajax({
622                type: 'GET',
623                url: location.protocol + "//" + location.hostname + "/ajax/save_giftid.php?id=" + $($radio).val(),
624                success: function(data) {
625
626                }
627            });
628
629        }
630    });
631
632
633
634
635
636
637    if ($('table.product-list-table tr').length > 5) {
638        $('.show-more-wrap').show();
639    }
640
641    $('#showMoreProducts').on('click', function(e) {
642        e.preventDefault();
643        $('table.product-list-table tr:nth-child(n+6)').slideDown();
644        $(this).parent().hide();
645    });
646
647
648    $(document).on('click', '.radio-block.pay-delivery.ontransport .item', function(e) {
649        var $radio = $(this).find('input[type="radio"]');
650        if ($radio.length) {
651            if ($radio.hasClass('disabled')) return false;
652            $radio.prop('checked', true).trigger('change');
653
654            calculateShipping('transport');
655            $('.ontransfer').fadeIn(500);
656            $('.div_transport').fadeOut(0);
657            $(this).fadeIn(0);
658            $('.back').fadeIn(0);
659            $.ajax({
660                type: 'GET',
661                url: location.protocol + "//" + location.hostname + "/ajax/load_cart.php",
662                success: function(data) {
663                    if (data && data != "") $('#load_cart').html(data);
664                }
665            });
666
667        }
668
669
670
671    });
672
673    $(document).on('click', '.radio-block.pay-delivery.ontransfer .item', function(e) {
674        var $radio = $(this).find('input[type="radio"]');
675        if ($radio.length) {
676            if ($radio.hasClass('disabled')) return false;
677            $radio.prop('checked', true).trigger('change');
678            calculateShipping('transfer');
679
680            $.ajax({
681                type: 'GET',
682                url: location.protocol + "//" + location.hostname + "/ajax/load_cart.php",
683                success: function(data) {
684                    if (data && data != "") $('#load_cart').html(data);
685                }
686            });
687
688        }
689    });
690
691
692    function formatState(state) {
693        if (!state.id) {
694            return state.text;
695        }
696        var $state = $(
697            '<span class="flag-option"><img  src="' + $(state.element).attr('data-flag') + '" class="img-flag" /> ' + state.text + '</span>'
698        );
699        return $state;
700    };
701    if (typeof $.fn.select2 === "function") {
702        $("#countrySelect").select2({
703            templateResult: formatState,
704            templateSelection: formatState,
705            minimumResultsForSearch: -1
706        });
707    }
708});
709
710
711
712//custom select 
713$(document).ready(function() {
714    $('.custom-select__trigger').on('click', function(e) {
715        e.stopPropagation();
716        var $customSelect = $(this).closest('.custom-select');
717
718        $('.custom-select').not($customSelect).removeClass('open');
719
720        $customSelect.toggleClass('open');
721
722        var currentVal = $customSelect.closest('.custom-select-wrapper').find('.original-select').val();
723        $customSelect.find('.custom-select__option').removeClass('selected');
724        $customSelect.find('.custom-select__option').each(function() {
725            if ($(this).data('value') == currentVal) {
726                $(this).addClass('selected');
727            }
728        });
729    });
730
731    $('.custom-select__option').on('click', function() {
732        var $option = $(this);
733        var value = $option.data('value');
734        var text = $option.text();
735        var $wrapper = $option.closest('.custom-select-wrapper');
736        var $customSelect = $option.closest('.custom-select');
737
738        $customSelect.find('.selected-text').text(text);
739
740        $wrapper.find('.original-select').val(value).trigger('change');
741
742        $customSelect.removeClass('open');
743    });
744
745    $(document).on('click', function(e) {
746        if (!$(e.target).closest('.custom-select').length) {
747            $('.custom-select').removeClass('open');
748        }
749    });
750
751    $('.custom-select-wrapper').each(function() {
752        var $wrapper = $(this);
753        var $originalSelect = $wrapper.find('.original-select');
754        var text = $originalSelect.find('option:selected').text();
755        $wrapper.find('.custom-select').find('.selected-text').text(text);
756    });
757});
758
759
760
761
762
763var initPopupCarousel = function() {
764
765    setTimeout(function() {
766
767
768        if ($(".products.v6:not(.owl-loaded)").length > 0) {
769            $('.products.carousel.v6:not(.owl-carousel)').owlCarousel({
770                items: 3,
771                margin: 30,
772                loop: ($(".products.carousel.v6 .item").length > 1) ? true : false,
773                dots: true,
774                stagePadding: 30,
775                responsive: true,
776                //onRefreshed: refreshPage,
777
778                navText: [
779                    '<span></span>',
780                    '<span></span>'
781                ],
782                responsive: {
783
784                    0: {
785                        items: 2,
786                        margin: 10,
787                        stagePadding: 0,
788                        nav: ($(".products.carousel.v6 .item").length > 2) ? true : false,
789                    },
790                    451: {
791                        margin: 20,
792                        items: 2,
793                        stagePadding: 0,
794                        nav: ($(".products.carousel.v6 .item").length > 2) ? true : false,
795                    },
796
797                    651: {
798                        items: 3,
799                        margin: 20,
800                        stagePadding: 20,
801                        nav: ($(".products.carousel.v6 .item").length > 3) ? true : false,
802
803                    },
804
805                },
806                nav: true
807            });
808
809        }
810
811    }, 500);
812
813
814}
815
816
817
818function updateNeighborClasses(carousel, cont) {
819    const items = carousel.find('.owl-item');
820
821    items.removeClass('neighbor');
822
823    if (!cont) return;
824
825    const activeItems = items.filter('.active');
826
827    activeItems.each(function() {
828        const prev = $(this).prev('.owl-item');
829        const next = $(this).next('.owl-item');
830
831        if (prev.length) prev.addClass('neighbor');
832        if (next.length) next.addClass('neighbor');
833    });
834}
835
836
837var initCarousel = function() {
838
839    if ($(".slider:not(.owl-carousel)").length > 0) {
840        if ($(".slider > li").length > 1) {
841            $('.slider').owlCarousel({
842                animateOut: 'fadeOut',
843                responsive: true,
844                autoHeight: true,
845                items: 1,
846                margin: 0,
847                loop: true,
848                stagePadding: 0,
849                smartSpeed: 300,
850                dots: true,
851                autoplay: true,
852                autoplayTimeout: 4000,
853                autoplayHoverPause: true,
854
855            });
856
857        }
858    }
859
860
861    if ($(".best-selling.carousel:not(.owl-carousel)").length > 0) {
862        $('.best-selling.carousel:not(.owl-carousel)').owlCarousel({
863            items: 6,
864            margin: 14,
865            loop: ($(".best-selling.carousel .item").length > 1) ? true : false,
866            dots: true,
867            stagePadding: 0,
868            responsive: false,
869            nav: true,
870            navText: [
871                '<span></span>',
872                '<span></span>'
873            ],
874            responsive: {
875                0: {
876                    items: 1,
877                    margin: 10,
878                    stagePadding: 60,
879                    nav: ($(".best-selling.carousel .item").length > 1) ? true : false,
880                },
881                551: {
882                    margin: 10,
883                    items: 2,
884                    stagePadding: 0,
885                    nav: ($(".best-selling.carousel .item").length > 2) ? true : false,
886                },
887                700: {
888                    items: 3,
889                    margin: 10,
890                    stagePadding: 0,
891                    nav: ($(".best-selling.carousel .item").length > 3) ? true : false,
892                },
893                1150: {
894                    items: 4,
895                    margin: 20,
896                    stagePadding: 0,
897                    nav: ($(".best-selling.carousel .item").length > 4) ? true : false,
898                },
899                1300: {
900                    items: 5,
901                    margin: 20,
902                    stagePadding: 0,
903                    nav: ($(".best-selling.carousel .item").length > 5) ? true : false,
904                },
905                1600: {
906                    items: 5,
907                    margin: 24,
908                    stagePadding: 0,
909                    nav: ($(".best-selling.carousel .item").length > 5) ? true : false,
910                }
911            },
912            onInitialized: function() {
913                updateNeighborClasses(this.$element, true);
914            },
915            onChange: function() {
916                updateNeighborClasses(this.$element, false);
917            },
918            onTranslated: function() {
919                updateNeighborClasses(this.$element, true);
920            },
921            onTranslate: function() {
922                updateNeighborClasses(this.$element, true);
923            },
924            onChanged: function() {
925                updateNeighborClasses(this.$element, true);
926            }
927        });
928    }
929
930
931    if ($(".blog-posts.carousel:not(.owl-carousel)").length > 0) {
932        $('.blog-posts.carousel:not(.owl-carousel)').owlCarousel({
933            items: 4,
934            margin: 14,
935            loop: ($(".blog-posts.carousel .item").length > 1) ? true : false,
936            dots: true,
937            stagePadding: 0,
938            responsive: false,
939            nav: true,
940            navText: [
941                '<span></span>',
942                '<span></span>'
943            ],
944            responsive: {
945                0: {
946                    items: 1,
947                    margin: 10,
948                    stagePadding: 50,
949                    nav: ($(".blog-posts.carousel .item").length > 1) ? true : false,
950                },
951
952
953                551: {
954                    items: 2,
955                    margin: 10,
956                    stagePadding: 0,
957                    nav: ($(".blog-posts.carousel .item").length > 2) ? true : false,
958                },
959                901: {
960
961                    items: 3,
962                    margin: 14,
963                    stagePadding: 0,
964                    nav: ($(".blog-posts.carousel .item").length > 3) ? true : false,
965                },
966                1300: {
967                    items: 4,
968                    margin: 14,
969                    stagePadding: 0,
970                    nav: ($(".blog-posts.carousel .item").length > 4) ? true : false,
971                }
972            },
973            onInitialized: function() {
974                updateNeighborClasses(this.$element, true);
975            },
976            onChange: function() {
977                updateNeighborClasses(this.$element, false);
978            },
979            onTranslated: function() {
980                updateNeighborClasses(this.$element, true);
981            },
982            onTranslate: function() {
983                updateNeighborClasses(this.$element, true);
984            },
985            onChanged: function() {
986                updateNeighborClasses(this.$element, true);
987            }
988        });
989    }
990
991    if ($(".hp-big-banners.carousel:not(.owl-carousel)").length > 0) {
992        $('.hp-big-banners.carousel:not(.owl-carousel)').owlCarousel({
993            items: 2,
994            margin: 24,
995            loop: ($(".hp-big-banners.carousel .item").length > 1) ? true : false,
996            dots: true,
997            stagePadding: 0,
998            responsive: false,
999            nav: true,
1000            navText: [
1001                '<span></span>',
1002                '<span></span>'
1003            ],
1004            responsive: {
1005                0: {
1006                    items: 2,
1007                    margin: 0,
1008                    stagePadding: 10,
1009                    nav: ($(".hp-big-banners.carousel .item").length > 2) ? true : false,
1010                },
1011                451: {
1012                    margin: 0,
1013                    items: 2,
1014                    stagePadding: 15,
1015                    nav: ($(".hp-big-banners.carousel .item").length > 2) ? true : false,
1016                },
1017                601: {
1018                    items: 3,
1019                    margin: 0,
1020                    stagePadding: 15,
1021                    nav: ($(".hp-big-banners.carousel .item").length > 3) ? true : false,
1022                },
1023                801: {
1024                    items: 1,
1025                    margin: 10,
1026                    stagePadding: 0,
1027                    nav: ($(".hp-big-banners.carousel .item").length > 1) ? true : false,
1028                },
1029                980: {
1030
1031                    items: 2,
1032                    margin: 24,
1033                    stagePadding: 0,
1034                    nav: ($(".hp-big-banners.carousel .item").length > 2) ? true : false,
1035                }
1036            },
1037            onInitialized: function() {
1038                updateNeighborClasses(this.$element, true);
1039            },
1040            onChange: function() {
1041                updateNeighborClasses(this.$element, false);
1042            },
1043            onTranslated: function() {
1044                updateNeighborClasses(this.$element, true);
1045            },
1046            onTranslate: function() {
1047                updateNeighborClasses(this.$element, true);
1048            },
1049            onChanged: function() {
1050                updateNeighborClasses(this.$element, true);
1051            }
1052        });
1053    }
1054
1055    if ($(".hp-top-banners.carousel:not(.owl-carousel)").length > 0) {
1056        $('.hp-top-banners.carousel:not(.owl-carousel)').owlCarousel({
1057            items: 4,
1058            margin: 14,
1059            loop: ($(".hp-top-banners.carousel .item").length > 1) ? true : false,
1060            dots: true,
1061            stagePadding: 0,
1062            responsive: false,
1063            nav: true,
1064            navText: [
1065                '<span></span>',
1066                '<span></span>'
1067            ],
1068            responsive: {
1069                0: {
1070                    items: 1,
1071                    margin: 14,
1072                    stagePadding: 0,
1073
1074                    nav: ($(".hp-top-banners.carousel .item").length > 1) ? true : false,
1075                },
1076
1077                500: {
1078                    items: 2,
1079                    margin: 14,
1080                    stagePadding: 0,
1081
1082                    nav: ($(".hp-top-banners.carousel .item").length > 2) ? true : false,
1083                },
1084                800: {
1085                    items: 3,
1086                    margin: 14,
1087                    stagePadding: 0,
1088                    nav: ($(".hp-top-banners.carousel .item").length > 3) ? true : false,
1089                },
1090                1150: {
1091                    items: 4,
1092                    margin: 14,
1093                    stagePadding: 0,
1094                    nav: ($(".hp-top-banners.carousel .item").length > 4) ? true : false,
1095                }
1096            },
1097            onInitialized: function() {
1098                updateNeighborClasses(this.$element, true);
1099            },
1100            onChange: function() {
1101                updateNeighborClasses(this.$element, false);
1102            },
1103            onTranslated: function() {
1104                updateNeighborClasses(this.$element, true);
1105            },
1106            onTranslate: function() {
1107                updateNeighborClasses(this.$element, true);
1108            },
1109            onChanged: function() {
1110                updateNeighborClasses(this.$element, true);
1111            }
1112        });
1113    }
1114
1115    if ($(".hp-categories.carousel:not(.owl-carousel)").length > 0) {
1116        $('.hp-categories.carousel:not(.owl-carousel)').owlCarousel({
1117            items: 4,
1118            margin: 14,
1119            loop: ($(".hp-categories.carousel .item").length > 1) ? true : false,
1120            dots: true,
1121            stagePadding: 0,
1122            responsive: false,
1123            nav: true,
1124            navText: [
1125                '<span></span>',
1126                '<span></span>'
1127            ],
1128            responsive: {
1129                0: {
1130                    items: 2,
1131                    margin: 10,
1132                    stagePadding: 50,
1133                    nav: ($(".hp-categories.carousel .item").length > 2) ? true : false,
1134                },
1135                400: {
1136                    items: 2,
1137                    margin: 10,
1138                    stagePadding: 50,
1139                    nav: ($(".hp-categories.carousel .item").length > 2) ? true : false,
1140                },
1141                550: {
1142                    margin: 10,
1143                    items: 2,
1144                    stagePadding: 0,
1145                    nav: ($(".hp-categories.carousel .item").length > 2) ? true : false,
1146                },
1147                601: {
1148                    items: 3,
1149                    margin: 10,
1150                    stagePadding: 0,
1151                    nav: ($(".hp-categories.carousel .item").length > 3) ? true : false,
1152                },
1153                801: {
1154                    items: 4,
1155                    margin: 10,
1156                    stagePadding: 0,
1157                    nav: ($(".hp-categories.carousel .item").length > 4) ? true : false,
1158                },
1159                980: {
1160                    items: 4,
1161                    margin: 14,
1162                    stagePadding: 0,
1163                    nav: ($(".hp-categories.carousel .item").length > 4) ? true : false,
1164                },
1165                1200: {
1166                    items: 5,
1167                    margin: 14,
1168                    stagePadding: 0,
1169                    nav: ($(".hp-categories.carousel .item").length > 5) ? true : false,
1170                }
1171            },
1172            onInitialized: function() {
1173                updateNeighborClasses(this.$element, true);
1174            },
1175            onChange: function() {
1176                updateNeighborClasses(this.$element, false);
1177            },
1178            onTranslated: function() {
1179                updateNeighborClasses(this.$element, true);
1180            },
1181            onTranslate: function() {
1182                updateNeighborClasses(this.$element, true);
1183            },
1184            onChanged: function() {
1185                updateNeighborClasses(this.$element, true);
1186            }
1187        });
1188    }
1189
1190
1191    if ($(".products.carousel.v1:not(.owl-carousel)").length > 0) {
1192        $('.products.carousel.v1:not(.owl-carousel)').owlCarousel({
1193            items: 6,
1194            margin: 10,
1195            loop: ($(".products.carousel.v1 .item").length > 1) ? true : false,
1196            dots: true,
1197            stagePadding: 30,
1198            responsive: false,
1199            nav: true,
1200            navText: [
1201                '<span></span>',
1202                '<span></span>'
1203            ],
1204            responsive: {
1205                0: {
1206                    items: 2,
1207                    margin: 0,
1208                    stagePadding: 10,
1209                    nav: ($(".products.carousel.v1 .item").length > 2) ? true : false,
1210                },
1211                451: {
1212                    margin: 0,
1213                    items: 2,
1214                    stagePadding: 15,
1215                    nav: ($(".products.carousel.v1 .item").length > 2) ? true : false,
1216                },
1217                601: {
1218                    items: 3,
1219                    margin: 0,
1220                    stagePadding: 15,
1221                    nav: ($(".products.carousel.v1 .item").length > 3) ? true : false,
1222                },
1223                801: {
1224                    items: 3,
1225                    margin: 0,
1226                    stagePadding: 15,
1227                    nav: ($(".products.carousel.v1 .item").length > 3) ? true : false,
1228                },
1229                980: {
1230                    items: 3,
1231                    margin: 0,
1232                    stagePadding: 15,
1233                    nav: ($(".products.carousel.v1 .item").length > 3) ? true : false,
1234                },
1235                1150: {
1236                    items: 6,
1237                    margin: 0,
1238                    stagePadding: 15,
1239                    nav: ($(".products.carousel.v1 .item").length > 6) ? true : false,
1240                }
1241            },
1242            onInitialized: function() {
1243                updateNeighborClasses(this.$element, true);
1244            },
1245            onChange: function() {
1246                updateNeighborClasses(this.$element, false);
1247            },
1248            onTranslated: function() {
1249                updateNeighborClasses(this.$element, true);
1250            },
1251            onTranslate: function() {
1252                updateNeighborClasses(this.$element, true);
1253            },
1254            onChanged: function() {
1255                updateNeighborClasses(this.$element, true);
1256            }
1257        });
1258    }
1259
1260
1261    if ($("#blog-detail .products.carousel.v2:not(.owl-carousel)").length > 0) {
1262        $('#blog-detail .products.carousel.v2:not(.owl-carousel)').owlCarousel({
1263            items: 6,
1264            margin: 0,
1265            loop: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1266            dots: true,
1267            stagePadding: 30,
1268            responsive: false,
1269            nav: true,
1270            navText: [
1271                '<span></span>',
1272                '<span></span>'
1273            ],
1274            responsive: {
1275                0: {
1276                    items: 1,
1277                    margin: 10,
1278                    stagePadding: 75,
1279                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1280                },
1281                400: {
1282                    items: 1,
1283                    margin: 10,
1284                    stagePadding: 85,
1285                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1286                },
1287                500: {
1288                    items: 2,
1289                    margin: 10,
1290                    stagePadding: 0,
1291                    nav: ($(".products.carousel.v2 .item").length > 2) ? true : false,
1292                },
1293                600: {
1294                    margin: 10,
1295                    items: 3,
1296                    stagePadding: 0,
1297                    nav: ($(".products.carousel.v2 .item").length > 3) ? true : false,
1298                },
1299                850: {
1300                    items: 3,
1301                    margin: 10,
1302                    stagePadding: 50,
1303                    nav: ($(".products.carousel.v2 .item").length > 4) ? true : false,
1304                },
1305                980: {
1306
1307                    items: 3,
1308                    margin: 0,
1309                    stagePadding: 50,
1310                    nav: ($(".products.carousel.v2 .item").length > 3) ? true : false,
1311                }
1312            },
1313            onInitialized: function() {
1314                updateNeighborClasses(this.$element, true);
1315            },
1316            onChange: function() {
1317                updateNeighborClasses(this.$element, false);
1318            },
1319            onTranslated: function() {
1320                updateNeighborClasses(this.$element, true);
1321            },
1322            onTranslate: function() {
1323                updateNeighborClasses(this.$element, true);
1324            },
1325            onChanged: function() {
1326                updateNeighborClasses(this.$element, true);
1327            }
1328        });
1329    }
1330
1331    if ($("#subpage-wrap .products.carousel.v2:not(.owl-carousel)").length > 0) {
1332        $('#subpage-wrap .products.carousel.v2:not(.owl-carousel)').owlCarousel({
1333            items: 6,
1334            margin: 0,
1335            loop: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1336            dots: true,
1337            stagePadding: 30,
1338            responsive: false,
1339            nav: true,
1340            navText: [
1341                '<span></span>',
1342                '<span></span>'
1343            ],
1344            responsive: {
1345                0: {
1346                    items: 1,
1347                    margin: 10,
1348                    stagePadding: 75,
1349                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1350                },
1351                400: {
1352                    items: 1,
1353                    margin: 10,
1354                    stagePadding: 85,
1355                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1356                },
1357                500: {
1358                    items: 2,
1359                    margin: 10,
1360                    stagePadding: 0,
1361                    nav: ($(".products.carousel.v2 .item").length > 2) ? true : false,
1362                },
1363                600: {
1364                    margin: 10,
1365                    items: 3,
1366                    stagePadding: 0,
1367                    nav: ($(".products.carousel.v2 .item").length > 3) ? true : false,
1368                },
1369                850: {
1370                    items: 3,
1371                    margin: 10,
1372                    stagePadding: 50,
1373                    nav: ($(".products.carousel.v2 .item").length > 4) ? true : false,
1374                },
1375                980: {
1376
1377                    items: 4,
1378                    margin: 0,
1379                    stagePadding: 50,
1380                    nav: ($(".products.carousel.v2 .item").length > 3) ? true : false,
1381                }
1382            },
1383            onInitialized: function() {
1384                updateNeighborClasses(this.$element, true);
1385            },
1386            onChange: function() {
1387                updateNeighborClasses(this.$element, false);
1388            },
1389            onTranslated: function() {
1390                updateNeighborClasses(this.$element, true);
1391            },
1392            onTranslate: function() {
1393                updateNeighborClasses(this.$element, true);
1394            },
1395            onChanged: function() {
1396                updateNeighborClasses(this.$element, true);
1397            }
1398        });
1399    }
1400
1401    if ($("*:not(#blog-detail):not(#subpage-wrap) .products.carousel.v2:not(.owl-carousel)").length > 0) {
1402        $('*:not(#blog-detail):not(#subpage-wrap) .products.carousel.v2:not(.owl-carousel)').owlCarousel({
1403            items: 6,
1404            margin: 0,
1405            loop: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1406            dots: true,
1407            stagePadding: 30,
1408            responsive: false,
1409            nav: true,
1410            // dragEndSpeed:25000,
1411            navText: [
1412                '<span></span>',
1413                '<span></span>'
1414            ],
1415            responsive: {
1416                0: {
1417                    items: 1,
1418                    margin: 10,
1419                    stagePadding: 75,
1420                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1421                },
1422                400: {
1423                    items: 1,
1424                    margin: 10,
1425                    stagePadding: 85,
1426                    nav: ($(".products.carousel.v2 .item").length > 1) ? true : false,
1427                },
1428                500: {
1429                    items: 2,
1430                    margin: 10,
1431                    stagePadding: 0,
1432                    nav: ($(".products.carousel.v2 .item").length > 2) ? true : false,
1433                },
1434                600: {
1435                    margin: 10,
1436                    items: 3,
1437                    stagePadding: 0,
1438                    nav: ($(".products.carousel.v2 .item").length > 3) ? true : false,
1439                },
1440                850: {
1441                    items: 4,
1442                    margin: 10,
1443                    stagePadding: 0,
1444                    nav: ($(".products.carousel.v2 .item").length > 4) ? true : false,
1445                },
1446                979: {
1447                    items: 4,
1448                    margin: 0,
1449                    stagePadding: 50,
1450                    nav: ($(".products.carousel.v2 .item").length > 4) ? true : false,
1451                },
1452                1150: {
1453                    items: 5,
1454                    margin: 0,
1455                    stagePadding: 50,
1456                    nav: ($(".products.carousel.v2 .item").length > 5) ? true : false,
1457                },
1458                1350: {
1459                    items: 6,
1460                    margin: 0,
1461                    stagePadding: 50,
1462                    nav: ($(".products.carousel.v2 .item").length > 6) ? true : false,
1463                }
1464            },
1465            onInitialized: function() {
1466                updateNeighborClasses(this.$element, true);
1467            },
1468            onChange: function() {
1469                updateNeighborClasses(this.$element, false);
1470            },
1471            onTranslated: function() {
1472                updateNeighborClasses(this.$element, true);
1473            },
1474            onTranslate: function() {
1475                updateNeighborClasses(this.$element, true);
1476            },
1477            onChanged: function() {
1478                updateNeighborClasses(this.$element, true);
1479            }
1480        });
1481    }
1482
1483
1484
1485};
1486
1487
1488function adjustCarousel() {
1489    $('.owl-carousel:not(.brands-carousel):not(.slider)').each(function() {
1490        $(this).css('height', 'auto');
1491        const hiddenBox = $(this).find('.hidden-box');
1492        hiddenBox.addClass('invisible');
1493
1494        let padding = 0;
1495        if ($(this).hasClass('products')) padding = 50;
1496
1497        $(this).css('height', $(this).height() - padding);
1498        hiddenBox.removeClass('invisible');
1499    });
1500}
1501
1502// Spuštění při načtení stránky
1503$(document).ready(function() {
1504    adjustCarousel();
1505    $("body").addClass('loaded')
1506});
1507
1508$(window).load(function() {
1509
1510    adjustCarousel();
1511});
1512
1513// Debounce při změně velikosti okna
1514let resizeTimer;
1515$(window).on('resize', function() {
1516    clearTimeout(resizeTimer);
1517    resizeTimer = setTimeout(function() {
1518        adjustCarousel();
1519    }, 500);
1520});
1521
1522
1523
1524
1525
1526function hideTr(tr, tim) {
1527    tr.find('td').wrapInner('<div style="display: block;" />').parent().find('td > div').slideUp(tim, function() {
1528        tr.hide();
1529        var $set = jQuery(this);
1530        $set.replaceWith($set.contents());
1531    });
1532}
1533
1534function showTr(tr, tim) {
1535    tr.show()
1536    tr.find('td').wrapInner('<div style="display: none;" />').parent().find('td > div').fadeIn(tim, function() {
1537        var $set = jQuery(this);
1538        $set.replaceWith($set.contents());
1539    });
1540}
1541
1542function hideCover() {
1543
1544    $('header.fixed .middle-box').css('height', 'auto');
1545
1546    $('header .middle-box,header .middle-box #search').css('z-index', 7000);
1547    $('.overlay-menu-search').fadeOut(300);
1548    $('.overlay-search').fadeOut(300);
1549    $('.overlay').fadeOut(300);
1550    $('.fixed-info-overlay').fadeOut(300);
1551
1552    $('#naseptavacDiv').css('display', 'none');
1553    $(".col.search").removeClass('show');
1554
1555    $('html').removeClass('disableScroll');
1556    $("#closeSearch").hide();
1557
1558    setTimeout(function() {
1559        $('#naseptavacDiv').css('visibility', 'hidden');
1560        $('#naseptavacList').hide();
1561        $('#naseptavacDiv').css('display', 'block');
1562
1563    }, 1000);
1564
1565}
1566
1567
1568$(document).ready(function() {
1569    function setupFooterAccordion() {
1570        if ($(window).width() < 600) {
1571            const footerCols = $("footer .container .col").has(".col-content");
1572
1573            footerCols.addClass("toggl");
1574
1575            footerCols.find(".col-content").hide();
1576
1577            footerCols.find(".title").off("click").on("click", function() {
1578                const $currentColContent = $(this).next(".col-content");
1579
1580                footerCols.find(".col-content").not($currentColContent).slideUp();
1581
1582                if ($currentColContent.is(":visible")) {
1583                    $currentColContent.slideUp();
1584                } else {
1585                    $currentColContent.slideDown();
1586                }
1587            });
1588        } else {
1589            $("footer .container .col").removeClass("toggl");
1590            $("footer .container .col .col-content").show();
1591
1592            $("footer .container .col .title").off("click");
1593        }
1594    }
1595
1596    setupFooterAccordion();
1597
1598    $(window).on("resize", function() {
1599        setupFooterAccordion();
1600    });
1601});
1602
1603
1604
1605$(document).ready(function() {
1606
1607    $(document).on('click', '.mobile-tab', function(e) {
1608
1609
1610        e.preventDefault();
1611
1612
1613
1614        $(this).toggleClass("active"), $(this).next().slideToggle(400, function() {});
1615    })
1616
1617
1618    wideMenu()
1619
1620    hideTr($(".top-table .sethidden"), 0);
1621
1622    $(document).on('click', '.next_topsale', function(e) {
1623        e.preventDefault();
1624
1625        $(this).hide();
1626
1627        var $tr = $(".top-table .sethidden");
1628        if ($tr.is(':hidden')) {
1629            showTr($tr, 600);
1630        } else {
1631            hideTr($tr, 500);
1632        }
1633    });
1634
1635
1636    $(".filter-button").click(function() {
1637
1638        if ($(this).hasClass('active')) {
1639            $(".filter-button-box").slideUp(300, function() {});
1640            $(this).removeClass('active');
1641            $(this).parent().removeClass('active');
1642        } else {
1643            $(".filter-button-box").slideUp(300, function() {});
1644            $('.filter-button').removeClass('active');
1645            $('.filter-box').removeClass('active');
1646            $(this).toggleClass('active');
1647            $(this).parent().toggleClass('active');
1648            $(this).parent().find('.filter-button-box').slideToggle(300, function() {});
1649        }
1650
1651    });
1652    $("#filter-block").mouseleave(function(e) {
1653
1654        if ($("body").width() > 550) {
1655            var ajaxLoader = $("#ajax_image_loader");
1656
1657            if (!ajaxLoader.is(e.relatedTarget) && !ajaxLoader.has(e.relatedTarget).length) {
1658                $(".filter-button-box").slideUp(300, function() {});
1659                $(".filter-button").removeClass('active');
1660            }
1661        }
1662    });
1663
1664
1665
1666
1667    if ($('.instagram-block').length != 0 && insta_token != "") {
1668
1669        var token = insta_token;
1670        var fields = 'id,media_type,media_url,thumbnail_url,timestamp,permalink,caption';
1671        var limit = 6; // Set a number of display items
1672
1673        $.ajax({
1674            url: 'https://graph.instagram.com/me/media?fields=' + fields + '&access_token=' + token + '&limit=' + limit,
1675            type: 'GET',
1676            success: function(response) {
1677                $('.instagram-block > div:not(.default)').remove();
1678                var i = 1;
1679                for (var x in response.data) {
1680                    var link = response.data[x]['permalink'],
1681                        caption = response.data[x]['caption'],
1682                        image = response.data[x]['media_url'],
1683                        image_video = response.data[x]['thumbnail_url'],
1684                        html = '';
1685
1686                    if (response.data[x]['media_type'] == 'VIDEO') {
1687                        html += '<div class="item" style="order:' + i + '">';
1688                        html += '<a class="insta-link" href="' + link + '" rel="noopener" target="_blank" title="' + caption + '">';
1689                        html += '<img src="' + image_video + '" loading="lazy" alt="" class="insta-image" />';
1690                        html += '</a>';
1691                        html += '</div>';
1692                    } else {
1693                        html += '<div class="item" style="order:' + i + '">';
1694                        html += '<a class="insta-link" href="' + link + '" rel="noopener" target="_blank"  title="' + caption + '">';
1695                        html += '<img src="' + image + '" loading="lazy" alt="" class="insta-image" />';
1696                        html += '</a>';
1697                        html += '</div>';
1698                    }
1699                    $('.instagram-block').append(html);
1700                    i++;
1701                }
1702
1703
1704
1705
1706            },
1707            error: function(data) {
1708                var html = '<div class="class-no-data">No Images Found</div>';
1709                //$('.instagram-block').append(html);
1710                console.log('Load instagram data error');
1711            }
1712        });
1713    }
1714
1715    $(".aside-box .box-title").click(function() {
1716        $(this).toggleClass("active"), $(this).parent().find(".wrap").slideToggle(400, function() {});
1717        var ids = $(this).attr('id');
1718
1719        if ($(this).hasClass('active'))
1720            Cookies.set(ids, '1', { expires: 1 });
1721        else
1722            Cookies.set(ids, '0', { expires: 1 });
1723    });
1724
1725    $(".sort-button").click(function() {
1726        $(this).toggleClass('active');
1727        $(this).parent().find('.sort-button-box').slideToggle(300, function() {});
1728
1729    });
1730
1731    $(document).mouseup(function(e) {
1732        var container = $(".sort-box");
1733
1734        // if the target of the click isn't the container nor a descendant of the container
1735        if (!container.is(e.target) && container.has(e.target).length === 0) {
1736            $(".sort-button-box").slideUp(300, function() {});
1737            $(".sort-button").removeClass('active');
1738        }
1739    });
1740
1741
1742
1743    //     $(".more_tr .graybox .wrap:hidden").addClass('hidex').show();
1744    // product_list();
1745    // $(".more_tr .graybox .wrap.hidex").removeClass('hidex').hide();
1746
1747
1748    $(".cart-box-button").click(function() {
1749        var show = $(this).attr('data-caption-show');
1750        var hide = $(this).attr('data-caption-hide');
1751        $(this).toggleClass("active"), $(this).parent().parent().find("> .wrap").slideToggle(400, function() {
1752
1753
1754        });
1755        var ids = $(this).attr('id');
1756        if ($(this).hasClass("active")) {
1757            $(this).html(hide);
1758            Cookies.set(ids, '0', { expires: 1 });
1759
1760        } else {
1761            $(this).html(show);
1762            Cookies.set(ids, '1', { expires: 1 });
1763
1764        }
1765
1766
1767        product_list();
1768
1769
1770
1771    });
1772
1773
1774
1775    // tabbed content
1776    $(".tab_content").hide();
1777    $(".tab_content:first").show();
1778
1779    /* if in tab mode */
1780    $("ul.tabs li").click(function() {
1781
1782        $(".tab_content").hide();
1783        var activeTab = $(this).attr("rel");
1784        $("#" + activeTab).fadeIn();
1785
1786        $("ul.tabs li").removeClass("active");
1787        $(this).addClass("active");
1788
1789        $(".tab_drawer_heading").removeClass("d_active");
1790        $(".tab_drawer_heading[rel^='" + activeTab + "']").addClass("d_active");
1791
1792    });
1793    /* if in drawer mode */
1794    $(".tab_drawer_heading").click(function() {
1795
1796        $(".tab_content").hide();
1797        var d_activeTab = $(this).attr("rel");
1798        $("#" + d_activeTab).fadeIn();
1799
1800        $(".tab_drawer_heading").removeClass("d_active");
1801        $(this).addClass("d_active");
1802
1803        $("ul.tabs li").removeClass("active");
1804        $("ul.tabs li[rel^='" + d_activeTab + "']").addClass("active");
1805    });
1806
1807
1808    $('ul.tabs li').last().addClass("tab_last");
1809
1810
1811
1812    if (!Cookies.get('fixed-info-line')) {
1813        $(".fixed-info-line").show();
1814    }
1815    $(".fixed-info-line").slideDown();
1816
1817    $(".fixed-info-line .close").click(function() {
1818        $(".fixed-info-line").hide();
1819        $('.header-wrap').css('margin-top', 0);
1820        $(window).trigger('resize');
1821        Cookies.set('fixed-info-line', '1', { expires: 7 });
1822    });
1823
1824
1825
1826    $(".top-menu")
1827        .mouseenter(function() {
1828
1829            $('header .middle-box,header .middle-box .top-menu').css('z-index', 9999);
1830
1831
1832        })
1833        .mouseleave(function() {
1834            $('.header .middle-box').fadeOut(300);
1835            $('header .middle-box,header .middle-box .top-menu').css('z-index', 7000);
1836        });
1837
1838
1839
1840
1841
1842    var timer;
1843
1844    $(document)
1845        .on('mouseenter', 'header .menu > li', function() {
1846            var $this = $(this);
1847            clearTimeout(timer);
1848
1849
1850            $('header .menu > li.with-sub').not(this).find('.sub').fadeOut(300);
1851            $('header .menu > li.with-sub').children('a').addClass('notr');
1852            $('header .menu > li.with-sub').not(this).children('a').removeClass('actived');
1853
1854            timer = setTimeout(function() {
1855
1856                if ($this.hasClass('with-sub')) {
1857                    $('.overlay').fadeIn(150);
1858                    $('.overlay-menu').fadeIn(150);
1859                    $('.fixed-info-overlay').fadeIn(150);
1860                    $this.find('.sub').fadeIn(0);
1861                    initMansory()
1862
1863                    $this.addClass('visible-arrow');
1864                    $this.find('.sub').css("opacity", 1).css("visibility", "visible");
1865                    $this.children('a').addClass('actived');
1866                    $this.find(' img').loadScroll(500);
1867                } else {
1868                    $('.overlay').fadeOut(150);
1869                    $('.overlay-menu').fadeOut(150);
1870                    $('.fixed-info-overlay').fadeOut(150);
1871                }
1872            }, 150);
1873        })
1874        .on('mouseleave', 'header .menu > li.with-sub', function() {
1875            var $this = $(this);
1876            clearTimeout(timer);
1877
1878            timer = setTimeout(function() {
1879                $this.find('.sub').fadeOut(150);
1880                $this.children('a').removeClass('actived');
1881
1882                $('.overlay').fadeOut(150);
1883                $('.overlay-menu').fadeOut(150);
1884                $('.fixed-info-overlay').fadeOut(150);
1885            }, 150);
1886        });
1887
1888
1889    $(document).on('mouseenter', '#menu-next', function() {
1890        var $this = $(this);
1891        $('.overlay').fadeIn(300);
1892        $('.overlay-menu').fadeIn(300);
1893        $('.fixed-info-overlay').fadeIn(300);
1894
1895    }).on('mouseleave', '#menu-next', function() {
1896
1897        $('.overlay').fadeOut(300);
1898        $('.overlay-menu').fadeOut(300);
1899        $('.fixed-info-overlay').fadeOut(300);
1900
1901    }).on('mouseleave', 'header .menu', function() {
1902
1903        $('header .menu').removeClass('hovered');
1904    });
1905
1906
1907
1908
1909
1910
1911    $('<span id="closeSearch"></span>').insertBefore('#inp-search');
1912
1913    $('#closeSearch').on('click', function(e) {
1914        hideCover();
1915    });
1916
1917    $('#closeSearch').hide();
1918
1919
1920    $("header #inp-search")
1921        .focusin(function() {
1922            $('header .middle-box,header .middle-box #search').css('z-index', 9999);
1923            $('.overlay-menu-search').fadeIn(300);
1924
1925            $('.overlay').fadeIn(300);
1926            $('.fixed-info-overlay').fadeIn(300);
1927
1928            if ($("#cover").width() <= 979) {
1929                $('#naseptavacList').css('max-height', $('.overlay').height() - 75);
1930            } else {
1931                $('.overlay-search').fadeIn(300);
1932                $('#naseptavacList').css('max-height', '480px');
1933            }
1934
1935
1936            $('html').addClass('disableScroll');
1937            $('#naseptavacList').show();
1938            // $('#naseptavacDiv').css('visibility', 'visible');
1939
1940
1941            if ($("body").width() <= 979) {
1942
1943
1944                if (!$("#closeSearch").length) {
1945
1946                } else {
1947                    $("#closeSearch").show();
1948                }
1949
1950
1951                // $('header.fixed .middle-box').css('height', '10px');
1952
1953                var $target = $('#inp-search');
1954                $('html, body').stop().animate({
1955                    // 'scrollTop': ($target.offset().top - 10)
1956                }, 400, 'swing', function() {
1957                    //window.location.hash = target;
1958                });
1959            }
1960        })
1961        .focusout(function() {
1962            /*
1963            $('header .middle-box,header .middle-box #search').css('z-index', 7000);
1964            $('.overlay-menu-search').fadeOut(300);
1965            $('.overlay-search').fadeOut(300);
1966            $('.overlay').fadeOut(300);
1967            $('.fixed-info-overlay').fadeOut(300);
1968
1969            */
1970        });
1971
1972
1973
1974
1975
1976
1977    $(document).on('click', 'body', function(e) {
1978
1979
1980        if ($(e.target).closest("#search button").length > 0) {
1981            return true;
1982        }
1983
1984
1985        if ($(e.target).closest(".search .top-menu").length > 0) {
1986            return true;
1987        }
1988
1989        if ($(e.target).closest(".search p").length > 0) {
1990            return true;
1991        }
1992
1993        if ($(e.target).closest(".search #closeSearch").length > 0) {
1994            return true;
1995        }
1996
1997        if ($(e.target).closest("#naseptavacDiv a").length > 0) {
1998            return true;
1999        }
2000        if ($(e.target).closest("#naseptavacDiv p").length > 0) {
2001            return true;
2002        }
2003
2004        if ($(e.target).closest("#naseptavac-box").length > 0) {
2005            return true;
2006        }
2007
2008        if ($(e.target).closest("#naseptavacDiv").length > 0) {
2009            return false;
2010        }
2011        if ($(e.target).closest(".search").length > 0) {
2012            return false;
2013        }
2014        if ($(e.target).closest(".naseptavac-wrap").length > 0) {
2015            return false;
2016        }
2017
2018        if ($(e.target).closest(".mobile-search").length > 0) {
2019            return false;
2020        }
2021
2022        if ($(e.target).closest("#inp-search").length > 0) {
2023
2024            return false;
2025        }
2026
2027        hideCover();
2028
2029    });
2030
2031    const onChangeElement = function(qSelector, cb) {
2032        const targetNode = document.querySelector(qSelector);
2033        if (targetNode) {
2034            const config = { attributes: true, childList: false, subtree: false };
2035            const callback = function(mutationsList, observer) {
2036                cb($(qSelector))
2037            };
2038            const observer = new MutationObserver(callback);
2039            observer.observe(targetNode, config);
2040        } else {
2041            // console.error("onChangeElement: Invalid Selector")
2042        }
2043    }
2044
2045    if (typeof SimpleBar === "function") {
2046
2047        new SimpleBar($('#naseptavacList')[0], { autoHide: false, forceVisible: 'y' });
2048
2049        $('.simplebar-track.simplebar-vertical').hide();
2050
2051    } else {
2052        $('#naseptavacList').css('padding-right', 0);
2053    }
2054
2055
2056    onChangeElement('#naseptavacDiv', function(jqueryElement) {
2057
2058        var vis = $('#naseptavacDiv').css("visibility");
2059
2060
2061        if (vis == 'hidden') {
2062            $('.simplebar-track.simplebar-vertical').hide();
2063
2064        } else {
2065            $('.simplebar-track.simplebar-vertical').show();
2066        }
2067    })
2068
2069
2070
2071
2072
2073
2074    $(".more-items").click(function(e) {
2075        e.preventDefault();
2076        $(this).parent().find('.item.invisible').fadeIn('slow').removeClass('invisible');
2077        $(this).hide();
2078    });
2079
2080
2081
2082
2083    /*$(".aside-box .more a").click(function(e) {
2084        e.preventDefault();
2085        $(this).text(function(i, text) {
2086            return (text == 'Zobrazit více') ? 'Skrýt' : 'Zobrazit více';
2087        });
2088        $(this).parent().parent().find('.visible-wrap').toggleClass('expand');
2089    });*/
2090
2091
2092    if ($('.sb-right').length) {
2093        $('.menu').clone().appendTo('.sb-slidebar.sb-right');
2094        $('.top-menu').clone().appendTo('.sb-slidebar.sb-right');
2095        $('.sb-slidebar ul.bottom').each(function() {
2096            $(this).insertAfter('.sb-slidebar.sb-right  .menu');
2097        });
2098    } else if ($('.sb-left').length) {
2099        $('.menu').clone().appendTo('.sb-slidebar.sb-left');
2100        $('.top-menu').clone().appendTo('.sb-slidebar.sb-left');
2101        $('.sb-slidebar ul.bottom').each(function() {
2102            $(this).insertAfter('.sb-slidebar.sb-left  .menu');
2103        });
2104    }
2105    // $('.sb-slidebar ul.menu > li, .sb-slidebar ul.bottom > li').each(function() {
2106    //     $(this).find('.sub > .wrap > ul').appendTo(this);
2107    //     $(this).find('br').remove();
2108    //     $(this).find('.sub').remove();
2109    // });
2110
2111    if ($('.bar').length) {
2112        $('.bar').each(function(e) {
2113            var nameOfElement = $(this).attr('data-id');
2114            if (nameOfElement && $('#' + nameOfElement + '2').length) {
2115                var price = $('#' + nameOfElement + '2').val().split('-');
2116
2117                var min_val = parseFloat(price[0]);
2118                var max_val = parseFloat(price[1]);
2119
2120                if (min_val == max_val) {
2121                    max_val = max_val + 1;
2122                }
2123
2124                var limitSlider = this.getElementsByClassName('nouislider-' + nameOfElement)[0];
2125
2126                noUiSlider.create(limitSlider, {
2127                    start: [0, max_val],
2128                    sliderTheme: 'light',
2129                    behaviour: 'drag',
2130                    connect: true,
2131                    showTimer: true,
2132                    step: 1,
2133                    range: {
2134                        'min': min_val,
2135                        'max': max_val
2136                    },
2137
2138                });
2139
2140                var limitFieldMin = this.getElementsByClassName('slider-limit-value-min-' + nameOfElement)[0];
2141                var limitFieldMax = this.getElementsByClassName('slider-limit-value-max-' + nameOfElement)[0];
2142
2143                if ($('#' + nameOfElement).val() != $('#' + nameOfElement + '2').val()) {
2144                    var actual_price = $('#' + nameOfElement).val().split('-');
2145                    limitSlider.noUiSlider.set([actual_price[0], actual_price[1]]);
2146                    $('.slider-limit-value-min-' + nameOfElement).html(actual_price[0]);
2147                    $('.slider-limit-value-max-' + nameOfElement).html(actual_price[1]);
2148                    $("#remove_parameters").css('display', 'block');
2149                }
2150
2151                limitSlider.noUiSlider.on('end', function(values, handle) {
2152                    (handle ? limitFieldMax : limitFieldMin).innerHTML = parseInt(values[handle]);
2153
2154                    $("#" + nameOfElement).val(values);
2155                    var valus = $("#" + nameOfElement).val();
2156                    var vals = valus.split(',');
2157                    $("#" + nameOfElement).val(vals[0] + "-" + vals[1]);
2158                    $("#nextpage").val(0);
2159                    $('.paging_next.basic').css('display', 'none');
2160                    $("#cpage").val('0');
2161                    load_page();
2162                    $("#remove_parameters").css('display', 'block');
2163                    return false;
2164                });
2165
2166
2167                limitSlider.noUiSlider.on('update', function(values, handle) {
2168                    (handle ? limitFieldMax : limitFieldMin).innerHTML = parseInt(values[handle]);
2169                    return false;
2170                });
2171
2172
2173
2174            }
2175        });
2176
2177    }
2178
2179
2180    if ($(".brands-carousel").length > 0) {
2181        $('.brands-carousel').owlCarousel({
2182            items: 7,
2183            margin: 0,
2184            loop: ($(".brands-carousel .item").length > 1) ? true : false,
2185            dots: false,
2186            responsive: true,
2187            navText: [
2188                '<span></span>',
2189                '<span></span>'
2190            ],
2191            responsive: {
2192                0: {
2193                    items: 2
2194                },
2195                400: {
2196                    items: 3
2197                },
2198                500: {
2199                    items: 4
2200                },
2201                980: {
2202                    items: 6
2203                },
2204                1250: {
2205                    items: 7
2206                }
2207            },
2208
2209            nav: true
2210        });
2211    }
2212
2213
2214
2215
2216
2217    if ($(".products.carousel.v3:not(.owl-carousel)").length > 0) {
2218        $('.products.carousel.v3').owlCarousel({
2219            items: 4,
2220            margin: 30,
2221            loop: ($(".products.carousel.v3 .item").length > 1) ? true : false,
2222            dots: true,
2223            stagePadding: 30,
2224            responsive: false,
2225            onRefreshed: refreshPage,
2226
2227            navText: [
2228                '<span></span>',
2229                '<span></span>'
2230            ],
2231            responsive: {
2232
2233                0: {
2234                    items: 1,
2235                    margin: 10,
2236                    stagePadding: 10,
2237                    nav: ($(".products.carousel.v3 .item").length > 1) ? true : false,
2238                },
2239                620: {
2240                    margin: 20,
2241                    items: 2,
2242                    stagePadding: 14,
2243                    nav: ($(".products.carousel.v3 .item").length > 2) ? true : false,
2244                },
2245                880: {
2246                    margin: 20,
2247                    items: 3,
2248                    stagePadding: 14,
2249                    nav: ($(".products.carousel.v3 .item").length > 3) ? true : false,
2250                },
2251
2252                979: {
2253                    items: 2,
2254                    margin: 20,
2255                    stagePadding: 20,
2256                    nav: ($(".products.carousel.v3 .item").length > 2) ? true : false,
2257
2258                },
2259                1200: {
2260                    items: 3,
2261                    margin: 20,
2262                    stagePadding: 20,
2263                    nav: ($(".products.carousel.v3 .item").length > 3) ? true : false,
2264
2265                },
2266                1300: {
2267                    items: ($('body').hasClass('without_column') ? 5 : ($('body').hasClass('fully') ? 4 : 3)),
2268                    margin: 30,
2269                    stagePadding: 29,
2270                    nav: ($(".products.carousel.v3 .item").length > ($('body').hasClass('without_column') ? 5 : ($('body').hasClass('fully') ? 4 : 3))) ? true : false,
2271                }
2272            },
2273            nav: true
2274        });
2275
2276    }
2277
2278
2279
2280    initCarousel();
2281
2282
2283    $("#search-toggle").click(function(e) {
2284        e.preventDefault();
2285        $("header").addClass("show-search");
2286
2287        if ($(window).scrollTop() < 300) {
2288            $('html, body').animate({
2289                scrollTop: $('#header').offset().top + $('#header').height()
2290            }, 250, function() {
2291                $("#inp-search").focus();
2292            });
2293        } else {
2294            // $("#inp-search").focus();
2295
2296            leaveTimer = setTimeout(function() {
2297                $("#inp-search").focus();
2298            }, 50);
2299        }
2300
2301        // leaveTimer = setTimeout(function() {
2302        //     $("#inp-search").focus();
2303        // }, 50);
2304
2305    });
2306
2307    $("#inp-search").focusout(function() {
2308        $("header").removeClass('show-search');
2309    });
2310
2311
2312    // $("#search-toggle").click(function(e) {
2313    //     e.preventDefault();
2314    //     $(".col.search").addClass('show');
2315    //     $("#inp-search").focus();
2316    // });
2317
2318    // $("#inp-search").focusout(function() {
2319    //     //$(".col.search").removeClass('show');
2320    // });
2321
2322
2323    $(".toggle-filter").click(function(e) {
2324        e.preventDefault();
2325        if ($("#filter").hasClass("active")) {
2326            $(this).text($(".filter-show").html());
2327            $("#filter").slideUp(400, function() {
2328                $(this).removeClass("active");
2329            });
2330        } else {
2331            $(this).text($(".filter-hide").html());
2332            $("#filter").slideDown(400, function() {
2333                $(this).addClass("active");
2334            });
2335        }
2336
2337        if ($("#filter-block-wrap").hasClass("active")) {
2338            $(this).text($(this).data('show'));
2339            $("#filter-block-wrap").slideUp(400, function() {
2340                $(this).removeClass("active");
2341            });
2342        } else {
2343            $(this).text($(this).data('hide'));
2344            $("#filter-block-wrap").slideDown(400, function() {
2345                $(this).addClass("active");
2346            });
2347        }
2348    });
2349
2350    $('.scroll').on('click', function(e) {
2351        e.preventDefault();
2352
2353        var target = this.hash;
2354        var $target = $(target);
2355
2356        if (!$target.length) {
2357            return;
2358        }
2359
2360        var minus;
2361        if ($("#cover").width() <= 930) {
2362            minus = 120;
2363        } else {
2364            minus = ($('#sticky-widget').length > 0) ? 240 : 160;
2365        }
2366
2367        $('html, body').stop().animate({
2368            'scrollTop': ($target.offset().top - minus)
2369        }, 900, 'swing');
2370    });
2371
2372
2373    var mySlidebars = new $.slidebars({
2374        scrollLock: true
2375    });
2376    // $('.sb-slidebar li').each(function() {
2377    //     var item = $(this).find("ul");
2378    //     if (item.length == 0) {
2379    //         $(this).addClass("sb-close");
2380
2381    //     }
2382    // });
2383    // $('.sb-slidebar ul li a').each(function() {
2384    //     $(this).click(function(event) {
2385    //         event.preventDefault();
2386    //         if ($(this).parent().hasClass('sb-close')) {
2387
2388    //             window.location.href = $(this).attr('href');
2389    //         } else {
2390
2391    //             $(this).next().slideToggle(); // Toggle the targeted ul
2392    //         }
2393
2394    //     });
2395    // });
2396
2397
2398
2399    $(document).ready(function() {
2400        $('.sub > .wrap > ul').addClass('level2');
2401        $('.sub li').each(function() {
2402            var $li = $(this);
2403            var $nestedUl = $li.children('ul');
2404            if ($nestedUl.length > 0 && !$nestedUl.parent().is('div[class^="level"]')) {
2405                var $closestUl = $li.closest('ul[class^="level"]');
2406                var parentLevel = 2;
2407                if ($closestUl.length > 0) {
2408                    var classes = $closestUl.attr('class').split(/\s+/);
2409                    $.each(classes, function(index, className) {
2410                        if (className.indexOf('level') === 0) {
2411                            var lvl = parseInt(className.replace('level', ''));
2412                            if (!isNaN(lvl)) {
2413                                parentLevel = lvl;
2414                                return false;
2415                            }
2416                        }
2417                    });
2418                }
2419                var currentLevel = parentLevel + 1;
2420                $nestedUl.wrap('<div class="level' + currentLevel + '"></div>');
2421            }
2422        });
2423
2424        $('.sb-slidebar .menu li:has(ul)').addClass('has-sub');
2425        $('.sb-slidebar .menu > li.with-sub > a').on('click', function(e) {
2426            e.preventDefault();
2427            $('.sb-slidebar').toggleClass('overflow-hidden');
2428            $(this).closest('li').toggleClass('active');
2429        });
2430        // $('.sb-slidebar .menu .level2 > li.has-sub > a').on('click', function(e) {
2431        //     e.preventDefault();
2432        //     var $parentLi = $(this).parent();
2433        //     $parentLi.toggleClass('current');
2434        //     $parentLi.find('ul').slideToggle();
2435        // });
2436        $('.sb-slidebar .menu .level2, .sb-slidebar .menu .level2 ul').each(function() {
2437            var $ul = $(this);
2438            var $parentA = $ul.closest('li').children('a').first();
2439            if ($parentA.length && $ul.children('li.show-all').length === 0) {
2440                var parentHref = $parentA.attr('href');
2441                // var showAllLink = '<li class="show-all"><a href="' + parentHref + '">Zobrazit vše</a></li>';
2442                // $ul.prepend(showAllLink);
2443            }
2444        });
2445
2446    });
2447
2448
2449
2450
2451    if ($(".spinner").length > 0) {
2452        var minNumber = 1;
2453        var maxNumber = 1000;
2454
2455        $('.spinner input').keypress(function(e) {
2456            if (String.fromCharCode(e.keyCode).match(/[^0-9]/g)) return false;
2457        });
2458
2459        let timeout;
2460        $('.spinner input').keyup(function(e) {
2461            clearTimeout(timeout);
2462            timeout = setTimeout(() => {
2463                if ($(this).val() > maxNumber) $(this).val(maxNumber);
2464                else if ($(this).val() < minNumber) $(this).val(minNumber);
2465                if ($('#basketa').length > 0) $('#basketa').submit();
2466            }, 1000);
2467        });
2468
2469        $(document).on('click', '.spinner .btn:first-of-type', function() {
2470            if ($(this).closest('.spinner').find('input').val() == maxNumber) {
2471                return false;
2472            } else {
2473                $(this).closest('.spinner').find('input').val(parseInt($(this).closest('.spinner').find('input').val(), 10) + 1);
2474                if ($('#basketa').length > 0) $('#basketa').submit();
2475            }
2476        });
2477        $(document).on('click', '.spinner .btn:last-of-type', function() {
2478            if ($(this).closest('.spinner').find('input').val() == minNumber) {
2479                return false;
2480            } else {
2481                $(this).closest('.spinner').find('input').val(parseInt($(this).closest('.spinner').find('input').val(), 10) - 1);
2482                if ($('#basketa').length > 0) $('#basketa').submit();
2483            }
2484        });
2485    }
2486    sticky_navigation();
2487    // sticky_menu();
2488
2489    debouncedInitializeEqualHeight()
2490
2491
2492    window.addEventListener("scroll", function() {
2493
2494        sticky_navigation()
2495    });
2496    updateContainer();
2497});
2498$(window).resize(function() {
2499
2500    //alert('resized');
2501    if ($('body').width() != window_width) wideMenu();
2502    updateContainer();
2503    $('.header-wrap').height($('#header').outerHeight());
2504
2505});
2506$(window).load(function() {
2507    updateContainer();
2508
2509    //AOS.init({ offset: 70, });
2510
2511
2512
2513
2514
2515    $(".toggle-active").on("click", function(e) {
2516        e.preventDefault();
2517        $(this).toggleClass("active");
2518    });
2519
2520
2521});
2522
2523
2524$(document).ajaxStop(function() {
2525    $(":animated").promise().done(function() {
2526        //alert('done1');
2527        refreshPage();
2528    });
2529
2530});
2531
2532$(document).ajaxComplete(function(event, request, settings) {
2533
2534});
2535
2536function updateContainer() {
2537
2538    prepare_slider();
2539
2540    initCarousel();
2541
2542    debouncedInitializeEqualHeight()
2543
2544    $('.table_compare table tr').css('height', 'auto');
2545    $('.table_compare').first().find('table tr').each(function(i, el) {
2546
2547        var ind = i;
2548        var hgt = $(this).height();
2549
2550
2551        $('.table_compare').each(function() {
2552            var height = $(this).find('tr').eq(ind).height();
2553            if (height > hgt) hgt = height;
2554        });
2555
2556
2557
2558
2559        $('.table_compare').each(function() {
2560            $(this).find('tr').eq(ind).height(hgt);
2561        });
2562    });
2563
2564
2565    $('.products:not(.variant2) .item .image  img, .subcategories  img').loadScroll(500);
2566
2567
2568
2569    observerLozad.observe();
2570
2571    $('.images .big').css('height', 'auto');
2572    var height = $('.jcarousel-wrapper').height();
2573    $('.images .big').height(height);
2574
2575    var right = ($('body').width() - $('footer .box').width()) / 2;
2576    $('.scroll-top').css('right', right);
2577
2578    if ($(".fixed-info-line").is(":visible")) {
2579        var height = $(".fixed-info-line").outerHeight();
2580
2581        //$('.header-wrap').css('margin-top',height);
2582
2583    }
2584
2585
2586    if ($(".side-banner").length) {
2587        var layoutWidth = $('header .layout-center').outerWidth();
2588
2589        if ($(".fixed-info-line").is(":visible")) {
2590            var add = $('.fixed-info-line .layout-center').outerHeight() + 14;
2591
2592        } else var add = 0;
2593
2594        if ($("#content").length > 0) add = add + 41;
2595
2596        var headerHeight = $('.header-wrap').outerHeight() + add + 30;
2597        $('.side-banner.left').css('margin-left', -(layoutWidth / 2) - 170 - 35).css('top', headerHeight);
2598        $('.side-banner.right').css('margin-right', -(layoutWidth / 2) - 170 - 35).css('top', headerHeight);
2599        $('.side-banner').css('top', headerHeight);
2600        $('.side-banner').css('z-index', 7000);
2601
2602    }
2603
2604
2605
2606    $('.images .big').css('height', 'auto');
2607    var height = $('.jcarousel-wrapper').height();
2608    $('.images .big').height(height);
2609
2610    if ($('body').hasClass('without_column')) {
2611        $('#filter').insertBefore($('.toggle-filter'));
2612        $('#filter').hide();
2613    }
2614
2615
2616
2617
2618
2619    if ($('body').width() <= 979) {
2620        if ($("#content #filter").length == 0) {
2621            $('#aside #filter').insertBefore($('.toggle-filter'));
2622            $('#filter').hide();
2623        }
2624    } else {
2625        if ($("#aside #filter").length == 0) {
2626
2627            $('#aside').append($('#filter'));
2628            $('#filter').show();
2629
2630        }
2631    }
2632
2633
2634    if ($('body').width() <= 450) {
2635        $('.compare-col').prependTo($('.sb-slidebar .menu'));
2636        // $('.favorite-col').prependTo($('.sb-slidebar .menu'));
2637        $('.col-currency').prependTo($('.sb-slidebar .menu'));
2638    } else {
2639        $('.compare-col').insertBefore($('.col.basket-info'));
2640        $('.col-currency').insertBefore($('.col.account-col'));
2641        // $('.favorite-col').insertBefore($('.col.basket-info'));
2642
2643    }
2644
2645    /*if ($('body').width() <= 600) {
2646        $('.detail-box #action_links').insertAfter($('.detail-box  .rating'));
2647    } else {
2648        $('.detail-box #action_links').insertAfter($('.detail-box  #detail_price'));
2649
2650    }*/
2651
2652
2653    if ($('body').width() <= 979) {
2654        $('#detail-main-desc').prependTo($('.left-side'));
2655        // $('.right-side > p').appendTo($('.right-side'));
2656
2657        //$('h1.detail-h1.h1down').insertBefore($('#detail-wrap'));
2658    } else {
2659        $('#detail-main-desc').prependTo($('.right-side'));
2660        // $('.right-side > p').insertBefore($('#detail-main-box'));
2661    }
2662
2663
2664    product_list();
2665    clearLines($('footer .container'), '.col');
2666
2667    //setHeights($('.menu'), '.tab > a ');
2668    // $('.menu > li').each(function() {
2669    //     startListHeight($(this).find('.tab > a'))
2670    // });
2671
2672    setHeights($('.category'), '.item ');
2673    setHeights2($('.category'), '.item .name');
2674
2675    setHeights($('.article'), '.item ');
2676    setHeights2($('.article'), '.item .perex-wrap h2');
2677    setHeights2($('.article'), '.item .perex-wrap');
2678
2679    setHeights($('.giftbox'), '.div_gift ');
2680    setHeights2($('.giftbox'), '.div_gift p.giftname');
2681
2682    sticky_navigation();
2683
2684
2685
2686
2687    if (!$('#menu').hasClass('fixed-menu') && !$('header').hasClass('fixed')) {
2688
2689        $('.header-wrap').height($('#header').outerHeight());
2690
2691    }
2692
2693
2694}
2695
2696
2697
2698
2699
2700
2701
2702
2703(function($) {
2704
2705    $.fn.loadScroll = function(duration) {
2706
2707        var $window = $(window),
2708            images = this,
2709            inview,
2710            loaded;
2711
2712        images.one('loadScroll', function() {
2713
2714            if (this.getAttribute('data-src')) {
2715                this.setAttribute('src', this.getAttribute('data-src'));
2716                this.removeAttribute('data-src');
2717
2718                if (duration) {
2719                    $(this).hide()
2720                        .fadeIn(duration)
2721                        .removeAttr('style');
2722                }
2723            }
2724        });
2725
2726        function checkInView() {
2727            inview = images.filter(function() {
2728                var a = $window.scrollTop(),
2729                    b = $window.height(),
2730                    c = $(this).offset().top,
2731                    d = $(this).height();
2732
2733                return c + d >= a && c <= a + b;
2734            });
2735
2736            loaded = inview.trigger('loadScroll');
2737            images = images.not(loaded);
2738        }
2739
2740        $window.scroll(checkInView);
2741
2742        $(document).ready(checkInView);
2743
2744        $window.on('load', checkInView);
2745    };
2746
2747})(jQuery);
2748
2749
2750jQuery.fn.ForceNumericOnly =
2751    function() {
2752        return this.each(function() {
2753            $(this).keydown(function(e) {
2754                var key = e.charCode || e.keyCode || 0;
2755                // allow backspace, tab, delete, enter, arrows, numbers and keypad numbers ONLY
2756                // home, end, period, and numpad decimal
2757                return (
2758                    key == 8 ||
2759                    key == 9 ||
2760                    key == 13 ||
2761                    key == 46 ||
2762                    key == 110 ||
2763                    key == 190 ||
2764                    (key >= 35 && key <= 40) ||
2765                    (key >= 48 && key <= 57) ||
2766                    (key >= 96 && key <= 105));
2767            });
2768        });
2769    };
2770
2771
2772
2773(function($) {
2774    $(function() {
2775        if ($('.jcarousel').length) {
2776            $('.jcarousel').jcarousel({
2777                vertical: true,
2778                rows: 1,
2779            })
2780            $('.jcarousel-control-prev')
2781                .on('jcarouselcontrol:active', function() {
2782                    $(this).removeClass('inactive')
2783                })
2784                .on('jcarouselcontrol:inactive', function() {
2785                    $(this).addClass('inactive')
2786                })
2787                .jcarouselControl({
2788                    target: '-=1',
2789                })
2790            $('.jcarousel-control-next')
2791                .on('jcarouselcontrol:active', function() {
2792                    $(this).removeClass('inactive')
2793                })
2794                .on('jcarouselcontrol:inactive', function() {
2795                    $(this).addClass('inactive')
2796                })
2797                .jcarouselControl({
2798                    target: '+=1',
2799                })
2800            $('.jcarousel-pagination')
2801                .on('jcarouselpagination:active', 'a', function() {
2802                    $(this).addClass('active')
2803                })
2804                .on('jcarouselpagination:inactive', 'a', function() {
2805                    $(this).removeClass('active')
2806                })
2807                .jcarouselPagination()
2808        }
2809    })
2810})(jQuery)
2811
2812
2813
2814$(document).ready(function() {
2815    // localStorage.removeItem("fancyboxShown");
2816    // localStorage.removeItem("saleClosed");
2817    // localStorage.removeItem("firstVisitTime");
2818
2819     if (typeof $.fancybox === "undefined" || $("#sale-button").length === 0 || $("#sale-dialog-content").length === 0) {
2820        return;
2821    }
2822
2823    var $saleButton = $("#sale-button").hide(); // Od začátku je skrytý
2824    var $closeButton = $("#close-sale-button");
2825    var fancyboxTimeout;
2826    var firstVisitTime = localStorage.getItem("firstVisitTime");
2827
2828    if (!firstVisitTime) {
2829        localStorage.setItem("firstVisitTime", Date.now());
2830        firstVisitTime = Date.now(); 
2831    } else {
2832        firstVisitTime = parseInt(firstVisitTime, 10);
2833    }
2834
2835    var elapsedTime = Date.now() - firstVisitTime;
2836    var remainingTime = Math.max(60000 - elapsedTime, 0);
2837
2838    function showSaleButton() {
2839        if (!localStorage.getItem("saleClosed")) {
2840            setTimeout(function () {
2841                $saleButton.css("display", "block").animate({ bottom: "0px" }, 500);
2842            }, 500);
2843        }
2844    }
2845
2846    if (!localStorage.getItem("fancyboxShown") && remainingTime > 0) {
2847        fancyboxTimeout = setTimeout(function () {
2848            $.fancybox.open({
2849                src: "#sale-dialog-content",
2850                type: "inline",
2851                afterClose: function () {
2852                    localStorage.setItem("fancyboxShown", "true");
2853                    showSaleButton();
2854                }
2855            });
2856        }, remainingTime);
2857    } else if (localStorage.getItem("fancyboxShown")) {
2858        showSaleButton(); 
2859    }
2860
2861    $saleButton.on("click", function () {
2862        clearTimeout(fancyboxTimeout);
2863        localStorage.setItem("fancyboxShown", "true");
2864    });
2865
2866    $closeButton.on("click", function (event) {
2867        event.preventDefault();
2868        $saleButton.animate({ bottom: "-50px" }, 500, function () {
2869            $(this).hide();
2870            localStorage.setItem("saleClosed", "true");
2871        });
2872    });
2873});
2874
2875
2876$(document).ready(function () {
2877    function applyEllipsis() {
2878        $(".seodescription").each(function () {
2879            const $paragraph = $(this);
2880            const maxLines = 3;
2881            const lineHeight = parseFloat($paragraph.css("line-height"));
2882            const maxHeight = maxLines * lineHeight;
2883            const $link = $paragraph.find("a"); 
2884
2885         
2886            $paragraph.css({
2887                "max-height": "",
2888                "overflow": "",
2889                "text-overflow": ""
2890            });
2891
2892            if ($paragraph[0].scrollHeight > maxHeight) {
2893                $paragraph.css({
2894                    "max-height": maxHeight + "px",
2895                    "overflow": "hidden",
2896                    "text-overflow": "ellipsis"
2897                });
2898
2899               
2900                if ($link.length && ($link[0].offsetTop + $link.outerHeight() > $paragraph.offset().top + maxHeight)) {
2901                    $paragraph.after($("<div>").append($link.clone())); 
2902                    $link.remove(); 
2903                }
2904            }
2905        });
2906    }
2907
2908    applyEllipsis(); 
2909
2910    $(window).on("resize", function () {
2911        applyEllipsis(); 
2912    });
2913});
2914

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.