PageSourceSearch

https://www.downfor.life/js/modules/slide-album.js

js downfor.life collected 2026-10-07 15:12:56 UTC 3,887 bytes, 109 lines download raw bytes

1var x=()=>{if(document.getElementById("slide-album-styles"))return;let r=document.createElement("style");r.id="slide-album-styles",r.textContent=`
2    .slide-album-container {
3      position: relative;
4      width: 100%;
5      margin-bottom: 1rem;
6    }
7    .slide-album-carousel {
8      position: relative;
9      overflow: hidden;
10      border-radius: var(--border-radius, 0.5rem);
11    }
12    .slide-album-track {
13      display: flex;
14      transition: transform 0.3s ease-out;
15      touch-action: pan-y pinch-zoom;
16    }
17    .slide-album-slide {
18      flex: 0 0 100%;
19      width: 100%;
20      aspect-ratio: 16/9;
21      overflow: hidden;
22    }
23    .slide-album-slide img {
24      width: 100%;
25      height: 100%;
26      object-fit: cover;
27      user-select: none;
28      -webkit-user-drag: none;
29    }
30    .slide-album-arrow {
31      position: absolute;
32      top: 50%;
33      transform: translateY(-50%);
34      z-index: 10;
35      width: 36px;
36      height: 36px;
37      border-radius: 50%;
38      background-color: rgba(0, 0, 0, 0.5);
39      border: none;
40      cursor: pointer;
41      display: flex;
42      align-items: center;
43      justify-content: center;
44      transition: background-color 0.2s ease, opacity 0.2s ease;
45      opacity: 0.7;
46    }
47    .slide-album-arrow:hover {
48      background-color: rgba(0, 0, 0, 0.7);
49      opacity: 1;
50    }
51    .slide-album-arrow svg {
52      width: 20px;
53      height: 20px;
54      color: white;
55    }
56    .slide-album-arrow-prev {
57      left: 8px;
58    }
59    .slide-album-arrow-next {
60      right: 8px;
61    }
62    .slide-album-arrow.is-hidden {
63      display: none;
64    }
65    .slide-album-dots {
66      display: flex;
67      justify-content: center;
68      gap: 8px;
69      margin-top: 12px;
70    }
71    .slide-album-dot {
72      width: 8px;
73      height: 8px;
74      border-radius: 50%;
75      background-color: var(--color-text-muted, #666);
76      border: none;
77      padding: 0;
78      cursor: pointer;
79      transition: all 0.2s ease;
80      opacity: 0.5;
81    }
82    .slide-album-dot:hover {
83      opacity: 0.75;
84    }
85    .slide-album-dot.is-active {
86      background-color: var(--color-primary, #f97316);
87      opacity: 1;
88      transform: scale(1.2);
89    }
90    .slide-album-dots.is-hidden {
91      display: none;
92    }
93    @media (max-width: 640px) {
94      .slide-album-arrow {
95        width: 28px;
96        height: 28px;
97      }
98      .slide-album-arrow svg {
99        width: 16px;
100        height: 16px;
101      }
102      .slide-album-arrow-prev {
103        left: 4px;
104      }
105      .slide-album-arrow-next {
106        right: 4px;
107      }
108    }
109  `,document.head.appendChild(r)},a=()=>{document.querySelectorAll(".slide-album-container").forEach(t=>{if(t.dataset.initialized)return;let i=t.querySelector(".slide-album-track"),m=t.querySelectorAll(".slide-album-dot"),h=t.querySelector(".slide-album-dots"),n=t.querySelectorAll(".slide-album-slide"),s=t.querySelector(".slide-album-arrow-prev"),l=t.querySelector(".slide-album-arrow-next");if(!i||n.length===0)return;if(t.dataset.initialized="true",n.length===1){h&&h.classList.add("is-hidden"),s&&s.classList.add("is-hidden"),l&&l.classList.add("is-hidden");return}let o=0,c=n.length,d=e=>{o=e,i.style.transform=`translateX(-${o*100}%)`,m.forEach((u,E)=>{u.classList.toggle("is-active",E===o)})},p=()=>{d((o-1+c)%c)},b=()=>{d((o+1)%c)};m.forEach((e,u)=>{e.addEventListener("click",()=>d(u))}),s&&s.addEventListener("click",p),l&&l.addEventListener("click",b);let g=0,w=0,f=50,v=e=>{g=e.touches[0].clientX},y=e=>{w=e.touches[0].clientX},S=()=>{let e=g-w;Math.abs(e)>f&&(e>0?b():p())};i.addEventListener("touchstart",v,{passive:!0}),i.addEventListener("touchmove",y,{passive:!0}),i.addEventListener("touchend",S),d(0)})};window.initSlideAlbum=a;window.addEventListener("slide-album:init",a);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{x(),a()}):(x(),a());export{a as initSlideAlbum};

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.