PageSourceSearch

https://akademssr.se/themes/custom/akademssr/assets/js/teaser-slider.js?v=1.x

js akademssr.se collected 2026-10-02 06:05:08 UTC 1,642 bytes, 43 lines download raw bytes

1(function (Drupal, once) {
2  Drupal.behaviors.teaserSlider = {
3    attach: function (context) {
4      once("teaser-slider-init", ".teaser-wrapper", context).forEach(
5        (wrapper) => {
6          const content = wrapper.querySelector(".teaser-wrapper__content");
7          const btnPrev = wrapper.querySelector(".teaser-wrapper__nav--prev");
8          const btnNext = wrapper.querySelector(".teaser-wrapper__nav--next");
9          const teasers = content.querySelectorAll(".teaser");
10          const lastTeaser = teasers[teasers.length - 1];
11
12          if (!content || !btnPrev || !btnNext || !lastTeaser) return;
13
14          const updateButtonStates = () => {
15            const contentRect = content.getBoundingClientRect();
16            const teaserRect = lastTeaser.getBoundingClientRect();
17
18            const teaserWidth = teaserRect.width;
19            const visibleWidth = contentRect.right - teaserRect.left;
20            const visiblePercentage = visibleWidth / teaserWidth;
21
22            const isMostlyVisible = visiblePercentage >= 0.8;
23
24            btnPrev.disabled = content.scrollLeft <= 0;
25            btnNext.disabled = isMostlyVisible;
26          };
27
28          btnPrev.addEventListener("click", () => {
29            content.scrollBy({ left: -300, behavior: "smooth" });
30          });
31
32          btnNext.addEventListener("click", () => {
33            content.scrollBy({ left: 300, behavior: "smooth" });
34          });
35
36          content.addEventListener("scroll", updateButtonStates);
37          window.addEventListener("resize", updateButtonStates);
38          updateButtonStates();
39        },
40      );
41    },
42  };
43})(Drupal, once);

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.