PageSourceSearch

https://www.zi.de/_assets/4483a80560873394161ba712d6ca7e9e/JS/_slider-bf8463bf.js

js zi.de collected 2026-09-25 18:38:37 UTC 3,343 bytes, 97 lines download raw bytes

1import { C as Carousel } from './bootstrap.esm-44062106.js';
2
3//
4function init() {
5  var carousels = new Map();
6  var pausedStates = new Map();
7  Array.from(document.querySelectorAll('.ce-slider')).forEach(function (node) {
8    carousels.set(node, new Carousel(node));
9    pausedStates.set(node, false); // Anfangszustand: läuft
10  });
11
12  //== SET HEIGHT
13  // usage: data-height : fixed / auto
14  var sliderElement = document.querySelectorAll(".ce-slider");
15  if (sliderElement.length) {
16    sliderElement.forEach(function (el) {
17      var ButtonPlayPause = el.querySelector(".carousel-control-play-pause");
18      var CarouselInterval = el.getAttribute("data-bs-interval");
19      var carouselInstance = carousels.get(el);
20      if (el.getAttribute("data-height")) {
21        if (el.dataset.height == "fixed") {
22          setHeight(el);
23        }
24      }
25
26      //== AUTO PLAY
27      if (CarouselInterval !== 'false') {
28        el.setAttribute("data-bs-ride", 'carousel');
29        el.classList.add("is-playing");
30        el.classList.remove("is-stopped");
31        carouselInstance.cycle();
32      } else {
33        el.setAttribute("data-bs-ride", 'false');
34        el.classList.add("is-stopped");
35        el.classList.remove("is-playing");
36      }
37
38      //== PAUSE / PLAY BUTTON
39      if (ButtonPlayPause && carouselInstance) {
40        ButtonPlayPause.addEventListener("click", function () {
41          var isPaused = pausedStates.get(el);
42          if (isPaused) {
43            pausedStates.set(el, false);
44            ButtonPlayPause.ariaLabel = ButtonPlayPause.dataset.pauseText || "Pause Carousel";
45            ButtonPlayPause.querySelector('.visually-hidden').textContent = ButtonPlayPause.dataset.pauseText || "Pause Carousel";
46            el.classList.add("is-playing");
47            el.classList.remove("is-stopped");
48            el.setAttribute("data-bs-ride", 'carousel');
49            el.setAttribute("data-bs-interval", '5000');
50            carouselInstance.cycle();
51            init();
52          } else {
53            pausedStates.set(el, true);
54            ButtonPlayPause.ariaLabel = ButtonPlayPause.dataset.playText || "Play Carousel";
55            ButtonPlayPause.querySelector('.visually-hidden').textContent = ButtonPlayPause.dataset.playText || "Play Carousel";
56            el.classList.add("is-stopped");
57            el.classList.remove("is-playing");
58            el.setAttribute("data-bs-ride", 'false');
59            el.setAttribute("data-bs-interval", 'false');
60            carouselInstance.pause();
61          }
62        });
63      }
64    });
65  }
66  window.addEventListener('resize', function () {
67    sliderElement.forEach(function (el) {
68      if (el.getAttribute("data-height")) {
69        if (el.dataset.height == "fixed") {
70          setHeight(el);
71        }
72      }
73    });
74  }, true);
75  function setHeight(el) {
76    var slides = el.querySelectorAll(".carousel-item");
77    var maxHeight = 0;
78    slides.forEach(function (slide) {
79      var slideHeight = slide.offsetHeight;
80      if (maxHeight < slideHeight) {
81        maxHeight = slideHeight;
82      }
83    });
84    el.style.height = maxHeight + "px";
85
86    /*
87    slides.forEach(function (slide) {
88      slide.style.height = maxHeight + "px";
89    });
90    */
91  }
92}
93var _slider = {};
94var Init = init;
95
96export { Init, _slider as default };
97//# sourceMappingURL=_slider-bf8463bf.js.map

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.