PageSourceSearch

https://europeansleeper.eu/js/index/partial/slider.js?v=1790769689

js europeansleeper.eu collected 2026-10-02 03:38:34 UTC 2,972 bytes, 90 lines download raw bytes

1$(function(){
2    class Slider {
3        constructor(root) {
4            this.root = root;
5            this.slides = root.querySelector('.slides');
6            this.slideCnt = root.querySelectorAll('.slide').length;
7            this.slidePag = root.querySelector('.slider-pag');
8            this.prevBtn = root.querySelector('.slider-prev');
9            this.nextBtn = root.querySelector('.slider-next');
10            this.current = 0;
11
12            this.startX = 0;
13            this.endX = 0;
14            this.swipeThreshold = 50;
15
16            this.init();
17        }
18
19        init() {
20            this.initPagination();
21            this.initButtons();
22            this.initSwipe();
23            this.updateSlider(0);
24        }
25
26        initButtons() {
27            if (this.nextBtn) {
28                this.nextBtn.onclick = () => {
29                    this.current = (this.current + 1) % this.slideCnt;
30                    this.updateSlider(this.current);
31                };
32            }
33
34            if (this.prevBtn) {
35                this.prevBtn.onclick = () => {
36                    this.current = (this.current - 1 + this.slideCnt) % this.slideCnt;
37                    this.updateSlider(this.current);
38                };
39            }
40        }
41
42        initPagination() {
43            this.slidePag.innerHTML = '';
44            for (let i = 0; i < this.slideCnt; i++) {
45                const btn = document.createElement('button');
46                if (i === 0) btn.classList.add('active');
47                btn.addEventListener('click', () => {
48                    this.current = i;
49                    this.updateSlider(this.current);
50                });
51                this.slidePag.appendChild(btn);
52            }
53        }
54
55        initSwipe() {
56            this.slides.addEventListener('touchstart', (e) => {
57                this.startX = e.touches[0].clientX;
58            });
59
60            this.slides.addEventListener('touchmove', (e) => {
61                this.endX = e.touches[0].clientX;
62            });
63
64            this.slides.addEventListener('touchend', () => {
65                const diff = this.endX - this.startX;
66
67                if (diff > this.swipeThreshold) {
68                    this.current = (this.current - 1 + this.slideCnt) % this.slideCnt;
69                    this.updateSlider(this.current);
70                } else if (diff < -this.swipeThreshold) {
71                    this.current = (this.current + 1) % this.slideCnt;
72                    this.updateSlider(this.current);
73                }
74
75                this.startX = 0;
76                this.endX = 0;
77            });
78        }
79
80        updateSlider(index) {
81            this.slides.style.transform = `translateX(-${index * 100}%)`;
82
83            this.slidePag.querySelectorAll('button').forEach((dot, i) => {
84                dot.classList.toggle('active', i === index);
85            });
86        }
87    }
88
89    document.querySelectorAll('.slider').forEach(slider => new Slider(slider));
90});

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.