PageSourceSearch

https://zuomod.com/wp-content/mu-plugins/widgets/js/premium-categories-plugin.js?ver=30117f5c

js zuomod.com collected 2026-09-25 18:43:51 UTC 4,183 bytes, 108 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    const config = window.wizPremiumCategoriesConfig || {};
3
4    document.querySelectorAll('.premium-categories-plugin').forEach(function (root) {
5        const container = root.querySelector('.premium-categories-container');
6        if (!container) return;
7
8        const chevronLeft = root.querySelector('.premium-categories-chevron-left');
9        const chevronRight = root.querySelector('.premium-categories-chevron-right');
10
11        const columnGap = parseInt(getComputedStyle(container).getPropertyValue('column-gap')) || 0;
12        const itemWidth = config.item_width ? parseFloat(config.item_width) : 200;
13        const isInfiniteScroll = config.infinite_scroll === 'yes';
14
15        if (isInfiniteScroll) {
16            if (chevronLeft) chevronLeft.classList.add('hidden');
17            if (chevronRight) chevronRight.classList.add('hidden');
18
19            const items = Array.from(container.children);
20            const fragment = document.createDocumentFragment();
21
22            items.forEach(function (item) {
23                fragment.appendChild(item.cloneNode(true));
24            });
25
26            container.appendChild(fragment);
27
28            const autoScrollSpeed = config.auto_scroll_speed ? parseInt(config.auto_scroll_speed) : 20;
29            const pauseOnHover = config.pause_on_hover === 'yes';
30            let isHovering = false;
31            let animationFrameId;
32
33            function autoScroll() {
34                if (!isHovering) {
35                    container.scrollLeft += 1;
36                    checkScrollReset();
37                }
38                animationFrameId = setTimeout(autoScroll, autoScrollSpeed);
39            }
40
41            function checkScrollReset() {
42                const singleSetWidth = (items.length * itemWidth) + ((items.length) * columnGap);
43
44                if (container.scrollLeft >= singleSetWidth) {
45                    container.scrollLeft = container.scrollLeft - singleSetWidth;
46                } else if (container.scrollLeft <= 0) {
47                    container.scrollLeft = container.scrollLeft + singleSetWidth;
48                }
49            }
50
51            container.addEventListener('scroll', checkScrollReset);
52            autoScroll();
53
54            if (pauseOnHover) {
55                container.addEventListener('mouseenter', function () {
56                    isHovering = true;
57                });
58                container.addEventListener('mouseleave', function () {
59                    isHovering = false;
60                });
61            }
62        } else {
63            if (!chevronLeft || !chevronRight) return;
64
65            function updateChevrons() {
66                const scrollLeft = Math.ceil(container.scrollLeft);
67                const scrollWidth = container.scrollWidth;
68                const clientWidth = container.clientWidth;
69
70                if (scrollLeft <= 0) {
71                    chevronLeft.classList.add('hidden');
72                } else {
73                    chevronLeft.classList.remove('hidden');
74                }
75
76                if (scrollLeft + clientWidth >= scrollWidth) {
77                    chevronRight.classList.add('hidden');
78                } else {
79                    chevronRight.classList.remove('hidden');
80                }
81            }
82
83            container.addEventListener('scroll', updateChevrons);
84            updateChevrons();
85
86            if (typeof ResizeObserver !== 'undefined') {
87                const resizeObserver = new ResizeObserver(function () {
88                    updateChevrons();
89                });
90                resizeObserver.observe(container);
91            } else {
92                window.addEventListener('resize', updateChevrons);
93            }
94        }
95
96        if (chevronLeft) {
97            chevronLeft.addEventListener('click', function () {
98                container.scrollBy({ left: -(itemWidth + columnGap), behavior: 'smooth' });
99            });
100        }
101
102        if (chevronRight) {
103            chevronRight.addEventListener('click', function () {
104                container.scrollBy({ left: itemWidth + columnGap, behavior: 'smooth' });
105            });
106        }
107    });
108});

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.