PageSourceSearch

https://caringvillage.com/wp-content/themes/caringvillage/assets/index.js

js caringvillage.com collected 2026-09-24 10:46:12 UTC 14,939 bytes, 429 lines download raw bytes

1(function() {
2    "use strict";
3    document.addEventListener("DOMContentLoaded", function() {
4        const n = document.querySelector(".mobile-menu")
5            , d = document.querySelector(".mobile-menu-toggle")
6            , l = document.querySelector(".mobile-menu-close")
7            , o = document.querySelector(".floating-navigation")
8            , c = document.querySelector(".main-banner-section");
9        d == null || d.addEventListener("click", function() {
10            h()
11        }),
12        l == null || l.addEventListener("click", function() {
13            S()
14        }),
15        n == null || n.addEventListener("click", function(s) {
16            s.target === n && S()
17        });
18        const r = n == null ? void 0 : n.querySelectorAll("nav a");
19        r == null || r.forEach(s => {
20            s.addEventListener("click", function() {
21                S()
22            })
23        }
24        );
25        function h() {
26            const s = n == null ? void 0 : n.querySelector(".mobile-menu-content");
27            n == null || n.classList.add("active"),
28            document.body.style.overflow = "hidden",
29            requestAnimationFrame( () => {
30                s == null || s.style.setProperty("transform", "translateX(0)")
31            }
32            )
33        }
34        function S() {
35            const s = n == null ? void 0 : n.querySelector(".mobile-menu-content");
36            s == null || s.style.setProperty("transform", "translateX(-100%)"),
37            setTimeout( () => {
38                n == null || n.classList.remove("active"),
39                document.body.style.overflow = ""
40            }
41            , 300)
42        }
43        function y() {
44            document.querySelectorAll('a[href^="#"], a[href*="#"]').forEach(w => {
45                w.addEventListener("click", function(B) {
46                    B.preventDefault();
47                    const i = this.getAttribute("href")
48                        , u = i.includes("#") ? i.split("#")[1] : i.substring(1)
49                        , f = document.getElementById(u);
50                    if (f)
51                        if (window.innerWidth >= 834) {
52                            const e = 132 * parseFloat(getComputedStyle(document.documentElement).fontSize)
53                                , t = f.offsetTop - e;
54                            window.scrollTo({
55                                top: Math.max(0, t),
56                                behavior: "smooth"
57                            })
58                        } else
59                            f.scrollIntoView({
60                                behavior: "smooth"
61                            })
62                })
63            }
64            )
65        }
66        y();
67        function g() {
68            if (!o || !c)
69                return;
70            c.getBoundingClientRect().bottom <= 0 ? o.classList.add("visible") : o.classList.remove("visible")
71        }
72        window.addEventListener("scroll", g),
73        g();
74        function b() {
75            const s = Array.from(document.querySelectorAll("video"));
76            if (s.length === 0)
77                return;
78            const w = i => {
79                const u = i.getBoundingClientRect();
80                return u.bottom > 0 && u.top < (window.innerHeight || document.documentElement.clientHeight)
81            }
82            ;
83            s.forEach(i => {
84                if (i.setAttribute("preload", "none"),
85                !w(i))
86                    try {
87                        i.pause()
88                    } catch (u) {}
89            }
90            );
91            const B = new IntersectionObserver(i => {
92                i.forEach(u => {
93                    const f = u.target;
94                    if (u.isIntersecting) {
95                        const L = f.querySelectorAll("source[data-src]");
96                        if (L.length > 0) {
97                            L.forEach(e => {
98                                e.setAttribute("src", e.getAttribute("data-src")),
99                                e.removeAttribute("data-src")
100                            }
101                            );
102                            try {
103                                f.load()
104                            } catch (e) {}
105                        }
106                        const v = f.play();
107                        v && typeof v.then == "function" && v.catch(e => {}
108                        )
109                    } else
110                        try {
111                            f.pause()
112                        } catch (L) {}
113                }
114                )
115            }
116            ,{
117                root: null,
118                rootMargin: "200px 0px",
119                threshold: .1
120            });
121            s.forEach(i => {
122                w(i) || i.querySelectorAll("source[src]").forEach(u => {
123                    const f = u.getAttribute("src");
124                    f && (u.setAttribute("data-src", f),
125                    u.removeAttribute("src"))
126                }
127                ),
128                B.observe(i)
129            }
130            )
131        }
132        b()
133    }),
134    document.addEventListener("DOMContentLoaded", function() {
135        if (typeof Swiper == "undefined")
136            return;
137        function n() {
138            const r = window.innerWidth;
139            return r >= 1440 ? r / 1440 : r >= 834 ? r / 834 : (r >= 393,
140            r / 393)
141        }
142        const d = n()
143            , l = new Swiper(".testimonials-swiper-1",{
144            slidesPerView: "auto",
145            spaceBetween: d * 16,
146            loop: !0,
147            loopedSlides: 3,
148            autoplay: {
149                delay: 0,
150                disableOnInteraction: !1
151            },
152            speed: 8e3,
153            grabCursor: !0,
154            allowTouchMove: !0,
155            watchSlidesProgress: !0,
156            watchSlidesVisibility: !0,
157            effect: "slide",
158            cssMode: !1,
159            breakpoints: {
160                834: {
161                    spaceBetween: d * 24
162                },
163                1440: {
164                    spaceBetween: d * 40
165                }
166            }
167        })
168            , o = new Swiper(".testimonials-swiper-2",{
169            slidesPerView: "auto",
170            spaceBetween: d * 16,
171            loop: !0,
172            loopedSlides: 3,
173            autoplay: {
174                delay: 0,
175                disableOnInteraction: !1
176            },
177            speed: 6e3,
178            grabCursor: !0,
179            allowTouchMove: !0,
180            watchSlidesProgress: !0,
181            watchSlidesVisibility: !0,
182            effect: "slide",
183            cssMode: !1,
184            breakpoints: {
185                834: {
186                    spaceBetween: d * 24
187                },
188                1440: {
189                    spaceBetween: d * 40
190                }
191            }
192        });
193        o.autoplay.stop(),
194        o.params.autoplay.reverseDirection = !0,
195        o.autoplay.start();
196        let c;
197        window.addEventListener("resize", function() {
198            clearTimeout(c),
199            c = setTimeout(function() {
200                const r = n();
201                l.params.spaceBetween = r * 16,
202                o.params.spaceBetween = r * 16,
203                window.innerWidth >= 834 && (l.params.spaceBetween = r * 24,
204                o.params.spaceBetween = r * 24),
205                window.innerWidth >= 1440 && (l.params.spaceBetween = r * 40,
206                o.params.spaceBetween = r * 40),
207                o.autoplay.stop(),
208                o.params.autoplay.reverseDirection = !0,
209                o.autoplay.start()
210            }, 250)
211        })
212    }),
213    document.addEventListener("DOMContentLoaded", function() {
214        if (typeof Swiper == "undefined")
215            return;
216        function n() {
217            const e = window.innerWidth;
218            return e >= 1440 ? e / 1440 : e >= 834 ? e / 834 : (e >= 393,
219            e / 393)
220        }
221        const d = n()
222            , l = new Swiper(".advantages-swiper",{
223            slidesPerView: "auto",
224            spaceBetween: d * 16,
225            speed: 800,
226            grabCursor: !0,
227            allowTouchMove: !0,
228            watchSlidesProgress: !0,
229            watchSlidesVisibility: !0,
230            effect: "slide",
231            cssMode: !1,
232            centeredSlides: !0,
233            navigation: {
234                nextEl: ".advantages-swiper-button-next",
235                prevEl: ".advantages-swiper-button-prev"
236            },
237            pagination: {
238                el: ".advantages-swiper-pagination",
239                clickable: !0,
240                type: "bullets"
241            },
242            breakpoints: {
243                393: {
244                    slidesPerView: "auto",
245                    spaceBetween: d * 16,
246                    centeredSlides: !0
247                },
248                834: {
249                    slidesPerView: "auto",
250                    spaceBetween: d * 16,
251                    centeredSlides: !0
252                },
253                1440: {
254                    slidesPerView: "auto",
255                    spaceBetween: d * 24,
256                    centeredSlides: !0
257                }
258            }
259        })
260            , o = document.querySelectorAll(".advantages-nav-button");
261        let c = 0, r, h = null;
262        const S = 1e4;
263        let y = !0
264            , g = Date.now()
265            , b = 0
266            , s = 0;
267        function w(e) {
268            o.forEach( (t, p) => {
269                if (t.classList.remove("active", "completed", "progressing"),
270                p < e) {
271                    t.classList.add("completed"),
272                    t.style.setProperty("--progress", "1");
273                    const a = t.querySelector("span");
274                    if (a) {
275                        const m = a.getAttribute("data-label") || a.textContent.trim();
276                        a.textContent = m,
277                        a.setAttribute("data-text", m)
278                    }
279                } else if (p === e) {
280                    t.classList.add("active"),
281                    t.style.setProperty("--progress", "0");
282                    const a = t.querySelector("span");
283                    if (a) {
284                        const E = `● ${a.getAttribute("data-label") || a.textContent.trim()}`;
285                        a.textContent = E,
286                        a.setAttribute("data-text", E)
287                    }
288                } else {
289                    t.classList.remove("active", "completed", "progressing"),
290                    t.style.setProperty("--progress", "0");
291                    const a = t.querySelector("span");
292                    if (a) {
293                        const m = a.getAttribute("data-label") || a.textContent.trim();
294                        a.textContent = m,
295                        a.setAttribute("data-text", m)
296                    }
297                }
298            }
299            ),
300            B(e)
301        }
302        function B(e) {
303            const t = document.querySelector(".advantages-nav-container")
304                , p = o[e];
305            if (!t || !p || window.innerWidth > 833)
306                return;
307            if (e === 0) {
308                t.scrollTo({
309                    left: 0,
310                    behavior: "smooth"
311                });
312                return
313            }
314            const a = t.getBoundingClientRect()
315                , m = p.getBoundingClientRect()
316                , E = a.left
317                , A = m.left
318                , P = 20 * n()
319                , k = 20 * n()
320                , q = t.scrollLeft + (A - E) - P - k;
321            t.scrollTo({
322                left: Math.max(0, q),
323                behavior: "smooth"
324            })
325        }
326        function i() {
327            const e = o[c];
328            if (!e)
329                return;
330            clearInterval(r),
331            h !== null && (cancelAnimationFrame(h),
332            h = null),
333            e.classList.add("progressing"),
334            s > 0 ? (g = Date.now() - s,
335            b = s,
336            s = 0) : (g = Date.now(),
337            b = 0);
338            const t = () => {
339                if (!y) {
340                    h = requestAnimationFrame(t);
341                    return
342                }
343                b = Date.now() - g;
344                const p = Math.min(b / S, 1);
345                if (e.style.setProperty("--progress", p.toFixed(4)),
346                p >= 1) {
347                    if (c = (c + 1) % o.length,
348                    c === 0) {
349                        o.forEach(m => {
350                            m.classList.remove("active", "completed", "progressing"),
351                            m.style.setProperty("--progress", "0")
352                        }
353                        );
354                        const a = document.querySelector(".advantages-nav-container");
355                        a && window.innerWidth <= 833 && a.scrollTo({
356                            left: 0,
357                            behavior: "smooth"
358                        })
359                    }
360                    l.slideTo(c),
361                    w(c),
362                    i();
363                    return
364                }
365                h = requestAnimationFrame(t)
366            }
367            ;
368            h = requestAnimationFrame(t)
369        }
370        function u() {
371            document.hidden ? (y = !1,
372            clearInterval(r),
373            s = Date.now() - g) : (y = !0,
374            i())
375        }
376        function f() {
377            y = !0,
378            i()
379        }
380        function L() {
381            y = !1,
382            clearInterval(r),
383            s = Date.now() - g
384        }
385        document.addEventListener("visibilitychange", u),
386        window.addEventListener("focus", f),
387        window.addEventListener("blur", L),
388        o.length > 0 && (o.forEach(e => {
389            const t = e.querySelector("span");
390            if (t) {
391                const p = t.textContent.trim();
392                t.setAttribute("data-label", p),
393                t.setAttribute("data-text", p)
394            }
395            e.style.setProperty("--progress", "0")
396        }
397        ),
398        w(0),
399        i()),
400        o.forEach( (e, t) => {
401            e.addEventListener("click", function() {
402                clearInterval(r),
403                c = t,
404                w(c),
405                l.slideTo(t),
406                i()
407            })
408        }
409        ),
410        l.on("slideChange", function() {
411            const e = l.activeIndex;
412            clearInterval(r),
413            c = e,
414            w(e),
415            i()
416        });
417        let v;
418        window.addEventListener("resize", function() {
419            clearTimeout(v),
420            v = setTimeout(function() {
421                const e = n();
422                window.innerWidth >= 1440 ? l.params.spaceBetween = e * 24 : (window.innerWidth >= 834,
423                l.params.spaceBetween = e * 16),
424                l.update()
425            }, 250)
426        })
427    })
428}
429)();

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.