PageSourceSearch

https://www.4dox.nl/user/templates/static-assets/js/modules/mainpage-carousel.js?build=601

js 4dox.nl collected 2026-09-26 16:41:26 UTC 2,480 bytes, 65 lines download raw bytes

1class MainpageCarousel {
2    constructor() {
3        this.selector = '#modules-mainpage-carousel';
4        this.initCarousel();
5    }
6
7    initCarousel()
8    {
9        var sliderContainer = $(this.selector);
10
11        if (sliderContainer.length) {
12            var slickUrl = "/user/templates/static-assets/js/slick.min.js";
13
14            // 2. Dynamické načtení JS souboru
15            $.getScript(slickUrl, function () {
16                // 1. Zjistíme, zda jsme na mobilu (standardně pod 768px)
17                var isMobile = window.innerWidth < 768;
18                var items = sliderContainer.find('.item');
19
20                // 2. Projdeme položky a ty nevhodné odstraníme
21                // Používáme klasický for-loop, abychom se vyhnuli .forEach()
22                for (var i = 0; i < items.length; i++) {
23                    var item = $(items[i]);
24                    var showOnMobile = item.attr('data-mobile') === "1";
25                    var showOnDesktop = item.attr('data-desktop') === "1";
26
27                    if (isMobile && !showOnMobile) {
28                        item.remove();
29                    } else if (!isMobile && !showOnDesktop) {
30                        item.remove();
31                    }
32                }
33
34                // 3. Kontrola, zda po filtraci zbyl alespoň jeden slide
35                if (sliderContainer.find('.item').length === 0) {
36                    return; // Pokud nic nezbylo, Slick neincializujeme
37                }
38
39                var $arrows = false;
40                if (typeof (CarouselShowArrows) !== 'undefined' && parseInt(CarouselShowArrows) == 1) {
41                    $arrows = true;
42                }
43                var $dots = false;
44                if (typeof (CarouselShowDots) !== 'undefined' && parseInt(CarouselShowDots) == 1) {
45                    $dots = true;
46                }
47
48                sliderContainer.slick({
49                    autoplay: true,
50                    autoplaySpeed: parseInt(CarouselTimeInterval) * 1000,
51                    speed: 800,
52                    infinite: true,
53                    slidesToShow: 1,
54                    slidesToScroll: 1,
55                    arrows: $arrows,
56                    dots: $dots,
57                    pauseOnHover: true,
58                    adaptiveHeight: true
59                });
60            });
61        }
62    }
63}
64
65nody.modules.MainpageCarousel = new MainpageCarousel();

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.