PageSourceSearch

https://www.selce.sk/skins/selce.sk_lego3/js/swiperInit.js?v=v6.5.0f

js selce.sk collected 2026-10-03 18:02:46 UTC 15,000 bytes, 468 lines download raw bytes

1// Swiper 1
2jQuery(document).ready(function() {
3  const slideTextToggleLabels = {
4    open:
5      (typeof currentTranslation !== "undefined" &&
6        currentTranslation.showSlideText) ||
7      "Zobrazit popis",
8    close:
9      (typeof currentTranslation !== "undefined" &&
10        currentTranslation.hideSlideText) ||
11      "Skrýt popis",
12  };
13
14  if (jQuery(".js-swiper-container1 .swiper-slide").length > 1) {
15    const $container = jQuery(".js-swiper-container1");
16    const $slides = $container.find(".swiper-slide");
17    const $toggleButton = $container.find(".swiper-slide-text-toggle").first();
18
19    jQuery(".swiper-button-next1").removeClass("swiper-button--d-none");
20    jQuery(".swiper-button-prev1").removeClass("swiper-button--d-none");
21    let legoSwiper1 = new Swiper(
22      ".js-swiper-container1",
23      Object.assign(
24        {
25          autoplay: {
26            delay: 6000,
27            disableOnInteraction: false,
28          },
29          // autoplay: false,
30          // pro rovnoměrné rozdělení snímků - slide
31          effect: "fade", // slide, fade, cube, coverflow, flip
32          navigation: {
33            nextEl: ".swiper-button-next1",
34            prevEl: ".swiper-button-prev1",
35          },
36          a11y: {
37            enabled: true,
38            prevSlideMessage: currentTranslation.prev,
39            nextSlideMessage: currentTranslation.next,
40            firstSlideMessage: currentTranslation.first,
41            lastSlideMessage: currentTranslation.last,
42          },
43          simulateTouch: false,
44          pagination: {
45            el: ".swiper-pagination",
46            dynamicBullets: false,
47            clickable: true,
48          },
49          keyboard: {
50            enabled: true,
51            onlyInViewport: true,
52          },
53          preloadImages: false,
54          scrollbar: {
55            el: ".swiper-scrollbar",
56            hide: true,
57          },
58          centeredSlides: false, // pro nerovnoměrné rozdělení snímků - true
59          slidesPerView: 1, // pro nerovnoměrné rozdělení snímků - "auto"
60
61          // slideshow s více snímky
62          // více snímků vedle sebe vyžaduje slide efekt - nastavení výše
63          //breakpointsInverse: true,
64          // breakpoints: {
65          //   320: {
66          //     slidesPerView: 1,
67          //     spaceBetween: 0,
68          //   },
69          //   768: {
70          //     slidesPerView: 2,
71          //     spaceBetween: 0,
72          //   },
73          //   1200: {
74          //     slidesPerView: 3,
75          //     spaceBetween: 0,
76          //   },
77          // },
78
79          speed: 1500,
80        },
81        swiperOptions1
82      )
83    );
84
85    if ($toggleButton.length) {
86      const resetToggleState = () => {
87        $toggleButton
88          .removeClass("is-open")
89          .attr("aria-expanded", "false")
90          .attr("aria-label", slideTextToggleLabels.open);
91      };
92
93      let $activeTextBlock = null;
94
95      const slidesHasText = $slides.map(function(_, slide) {
96        const $text = jQuery(slide)
97          .find(".swiper-slide-text")
98          .first();
99        return !!$text.length;
100      });
101
102      const hideToggle = () => {
103        $toggleButton
104          .attr({
105            "aria-controls": null,
106            "aria-expanded": "false",
107            "aria-hidden": "true",
108            tabindex: "-1",
109          })
110          .removeClass("is-open")
111          .addClass("swiper-button--d-none");
112        $activeTextBlock = null;
113      };
114
115      const bindToggleToActiveSlide = (swiperInstance) => {
116        const activeIndex =
117          swiperInstance && typeof swiperInstance.activeIndex === "number"
118            ? swiperInstance.activeIndex
119            : $container.find(".swiper-slide-active").index();
120
121        if (!slidesHasText[activeIndex]) {
122          hideToggle();
123          return;
124        }
125
126        const $currentSlideText = $slides
127          .eq(activeIndex)
128          .find(".swiper-slide-text")
129          .first();
130
131        if (!$currentSlideText.length) {
132          hideToggle();
133          return;
134        }
135
136        $toggleButton
137          .attr({
138            "aria-hidden": "false",
139            tabindex: "0",
140            "aria-expanded": "false",
141          })
142          .removeClass("swiper-button--d-none");
143
144        if (!$currentSlideText.attr("id")) {
145          $currentSlideText.attr("id", `swiper-slide-text-${activeIndex}`);
146        }
147
148        $container.find(".swiper-slide-text.is-open").removeClass("is-open");
149        $activeTextBlock = $currentSlideText;
150        $toggleButton.attr("aria-controls", $activeTextBlock.attr("id"));
151        resetToggleState();
152      };
153
154      const handleToggle = () => {
155        if (!$activeTextBlock || !$activeTextBlock.length) {
156          return;
157        }
158
159        const willOpen = !$activeTextBlock.hasClass("is-open");
160        $activeTextBlock.toggleClass("is-open", willOpen);
161        $toggleButton
162          .toggleClass("is-open", willOpen)
163          .attr("aria-expanded", willOpen)
164          .attr(
165            "aria-label",
166            willOpen ? slideTextToggleLabels.close : slideTextToggleLabels.open
167          );
168      };
169
170      $toggleButton.off(".swiperTextToggle");
171      $toggleButton.on("click.swiperTextToggle", handleToggle);
172      $toggleButton.on("keydown.swiperTextToggle", function(e) {
173        if (e.key === "Enter" || e.key === " ") {
174          e.preventDefault();
175          handleToggle();
176        }
177      });
178
179      // Navážeme tlačítko hned, aby fungovalo i před prvním slideChange
180      bindToggleToActiveSlide(legoSwiper1);
181
182      legoSwiper1.on("slideChange", function(swiperInstance) {
183        bindToggleToActiveSlide(swiperInstance);
184      });
185    }
186
187    // Pozastavování swiperu
188    let isSwiperRunning = false;
189    let isSwiperPausedByButton = false;
190    let isSwiperResumedByButton = false;
191    let isSwiperPausedByMouseenter = false;
192    let isSwiperPausedByReducedMotion = false;
193
194    // Pokud animace běží, zobrazí se tlačítko pro pozastavení
195    if (legoSwiper1.autoplay.running) {
196      isSwiperRunning = true;
197      jQuery(".swiper-button-pause1")
198        .removeClass("swiper-button--d-none")
199        .addClass("icon-pause")
200        .attr("title", currentTranslation.pause)
201        .attr("aria-label", currentTranslation.pause);
202
203      // Zastavení animace pokud má uživatel nastavený reduce motion
204      if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
205        legoSwiper1.autoplay.stop();
206        isSwiperPausedByReducedMotion = true;
207        jQuery(".swiper-button-pause1")
208          .removeClass("icon-pause")
209          .addClass("icon-play")
210          .attr("title", currentTranslation.play)
211          .attr("aria-label", currentTranslation.play);
212      }
213    } else {
214      jQuery(".swiper-button-pause1")
215        .removeClass("swiper-button--d-none")
216        .addClass("icon-play")
217        .attr("title", currentTranslation.play)
218        .attr("aria-label", currentTranslation.play);
219    }
220
221    // Zastavení animace při najetí myši
222    jQuery(".js-swiper-container1").mouseenter(function() {
223      if (
224        legoSwiper1.autoplay.running &&
225        !isSwiperPausedByReducedMotion &&
226        !isSwiperResumedByButton
227      ) {
228        legoSwiper1.autoplay.stop();
229        isSwiperPausedByMouseenter = true;
230        jQuery(".swiper-button-pause1").addClass("swiper-paused");
231      }
232    });
233    jQuery(".js-swiper-container1").mouseleave(function() {
234      if (
235        !legoSwiper1.autoplay.running &&
236        !isSwiperPausedByButton &&
237        !isSwiperPausedByReducedMotion &&
238        !isSwiperResumedByButton
239      ) {
240        legoSwiper1.autoplay.start();
241        isSwiperPausedByMouseenter = false;
242        jQuery(".swiper-button-pause1").removeClass("swiper-paused");
243      } else if (isSwiperResumedByButton) {
244        isSwiperResumedByButton = false;
245      }
246    });
247
248    // Pozastavení animace po stisknutí tlačítka
249    jQuery(".swiper-button-pause1").on("click keydown", function(e) {
250      if (!legoSwiper1.isLocked) {
251        if (e.type === "click" || e.key === "Enter") {
252          if (legoSwiper1.autoplay.running || isSwiperPausedByMouseenter) {
253            legoSwiper1.autoplay.stop();
254            isSwiperPausedByButton = true;
255            isSwiperPausedByMouseenter = false;
256            jQuery(this)
257              .removeClass("icon-pause")
258              .addClass("icon-play")
259              .attr("title", currentTranslation.play)
260              .attr("aria-label", currentTranslation.play);
261            jQuery(".swiper-button-pause1").removeClass("swiper-paused");
262          } else if (!isSwiperPausedByMouseenter) {
263            legoSwiper1.autoplay.start();
264            isSwiperPausedByButton = false;
265            isSwiperResumedByButton = true;
266            jQuery(this)
267              .removeClass("icon-play")
268              .addClass("icon-pause")
269              .attr("title", currentTranslation.pause)
270              .attr("aria-label", currentTranslation.pause);
271            jQuery(".swiper-button-pause1").removeClass("swiper-paused");
272          }
273        }
274      }
275    });
276
277    // Zablokování tlačítka pro spuštění / pozastavení animace
278    function disablePlayButton1() {
279      if (legoSwiper1.isLocked) {
280        jQuery(".swiper-button-pause1")
281          .attr("aria-disabled", "true")
282          .attr("disabled", "true")
283          .attr("tabindex", "-1")
284          .addClass("swiper-button-disabled swiper-button-lock");
285      } else {
286        jQuery(".swiper-button-pause1")
287          .removeAttr("aria-disabled")
288          .removeAttr("disabled")
289          .attr("tabindex", "0")
290          .removeClass("swiper-button-disabled swiper-button-lock");
291      }
292    }
293
294    // Úprava play/pause buttonu při resize
295    legoSwiper1.on("resize", function() {
296      disablePlayButton1();
297    });
298
299    disablePlayButton1();
300  }
301});
302
303// Swiper 5
304jQuery(document).ready(function() {
305  if (!jQuery(".js-swiper-container5").length) return;
306  let legoSwiper5 = new Swiper(".js-swiper-container5", {
307    autoplay: {
308      delay: 6000,
309      disableOnInteraction: false,
310    },
311    navigation: {
312      nextEl: ".swiper-button-next5",
313      prevEl: ".swiper-button-prev5",
314    },
315    a11y: {
316      enabled: true,
317      prevSlideMessage: currentTranslation.prev,
318      nextSlideMessage: currentTranslation.next,
319      firstSlideMessage: currentTranslation.first,
320      lastSlideMessage: currentTranslation.last,
321    },
322    keyboard: {
323      enabled: true,
324      onlyInViewport: true,
325    },
326    simulateTouch: false,
327    paginationClickable: true,
328    slidesPerGroup: 1,
329    speed: 1500,
330    breakpointsInverse: true,
331    breakpoints: {
332      320: {
333        slidesPerView: 1,
334        spaceBetween: 0,
335      },
336      620: {
337        slidesPerView: 2,
338        spaceBetween: 0,
339      },
340      992: {
341        slidesPerView: 3,
342        spaceBetween: 0,
343      },
344      1200: {
345        slidesPerView: 4,
346        spaceBetween: 0,
347      },
348      1440: {
349        slidesPerView: 5,
350        spaceBetween: 0,
351      },
352    },
353  });
354
355  // Pozastavování swiperu
356  let isSwiperRunning = false;
357  let isSwiperPausedByButton = false;
358  let isSwiperResumedByButton = false;
359  let isSwiperPausedByMouseenter = false;
360  let isSwiperPausedByReducedMotion = false;
361
362  // Pokud animace běží, zobrazí se tlačítko pro pozastavení
363  if (legoSwiper5.autoplay.running) {
364    isSwiperRunning = true;
365    jQuery(".swiper-button-pause5")
366      .removeClass("swiper-button--d-none")
367      .addClass("icon-pause")
368      .attr("title", currentTranslation.pause)
369      .attr("aria-label", currentTranslation.pause);
370
371    // Zastavení animace pokud má uživatel nastavený reduce motion
372    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
373      legoSwiper5.autoplay.stop();
374      isSwiperPausedByReducedMotion = true;
375      jQuery(".swiper-button-pause5")
376        .removeClass("icon-pause")
377        .addClass("icon-play")
378        .attr("title", currentTranslation.play)
379        .attr("aria-label", currentTranslation.play);
380    }
381  } else {
382    jQuery(".swiper-button-pause5")
383      .removeClass("swiper-button--d-none")
384      .addClass("icon-play")
385      .attr("title", currentTranslation.play)
386      .attr("aria-label", currentTranslation.play);
387  }
388
389  // Úprava play/pause buttonu při resize
390  legoSwiper5.on("resize", function() {
391    disablePlayButton5();
392  });
393
394  disablePlayButton5();
395
396  // Zablokování tlačítka pro spuštění / pozastavení animace
397  function disablePlayButton5() {
398    if (legoSwiper5.isLocked) {
399      jQuery(".swiper-button-pause5")
400        .attr("aria-disabled", "true")
401        .attr("disabled", "true")
402        .attr("tabindex", "-1")
403        .addClass("swiper-button-disabled swiper-button-lock");
404    } else {
405      jQuery(".swiper-button-pause5")
406        .removeAttr("aria-disabled")
407        .removeAttr("disabled")
408        .attr("tabindex", "0")
409        .removeClass("swiper-button-disabled swiper-button-lock");
410    }
411  }
412
413  // Zastavení animace při najetí myši
414  jQuery(".js-swiper-container5").mouseenter(function() {
415    if (
416      legoSwiper5.autoplay.running &&
417      !isSwiperPausedByReducedMotion &&
418      !isSwiperResumedByButton
419    ) {
420      legoSwiper5.autoplay.stop();
421      isSwiperPausedByMouseenter = true;
422      jQuery(".swiper-button-pause5").addClass("swiper-paused");
423    }
424  });
425  jQuery(".js-swiper-container5").mouseleave(function() {
426    if (
427      !legoSwiper5.autoplay.running &&
428      !isSwiperPausedByButton &&
429      !isSwiperPausedByReducedMotion &&
430      !isSwiperResumedByButton
431    ) {
432      legoSwiper5.autoplay.start();
433      isSwiperPausedByMouseenter = false;
434      jQuery(".swiper-button-pause5").removeClass("swiper-paused");
435    } else if (isSwiperResumedByButton) {
436      isSwiperResumedByButton = false;
437    }
438  });
439
440  // Pozastavení animace po stisknutí tlačítka
441  jQuery(".swiper-button-pause5").on("click keydown", function(e) {
442    if (!legoSwiper5.isLocked) {
443      if (e.type === "click" || e.key === "Enter") {
444        if (legoSwiper5.autoplay.running || isSwiperPausedByMouseenter) {
445          legoSwiper5.autoplay.stop();
446          isSwiperPausedByButton = true;
447          isSwiperPausedByMouseenter = false;
448          jQuery(this)
449            .removeClass("icon-pause")
450            .addClass("icon-play")
451            .attr("title", currentTranslation.play)
452            .attr("aria-label", currentTranslation.play);
453          jQuery(".swiper-button-pause5").removeClass("swiper-paused");
454        } else if (!isSwiperPausedByMouseenter) {
455          legoSwiper5.autoplay.start();
456          isSwiperPausedByButton = false;
457          isSwiperResumedByButton = true;
458          jQuery(this)
459            .removeClass("icon-play")
460            .addClass("icon-pause")
461            .attr("title", currentTranslation.pause)
462            .attr("aria-label", currentTranslation.pause);
463          jQuery(".swiper-button-pause5").removeClass("swiper-paused");
464        }
465      }
466    }
467  });
468});

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.