PageSourceSearch

https://www.generalfloor.com/wp-content/plugins/roomvo-wp-block-product-variants/initcarousel.js?v=1.1

js generalfloor.com collected 2026-10-04 23:09:26 UTC 3,532 bytes, 96 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    new Swiper('.variant-swatch-swiper', {
3        freeMode: {
4            enabled: true,
5            sticky: true,
6        },
7        freeModeMomentumBounce: false,
8        spaceBetween: 0,
9        watchOverflow: true,
10        watchSlidesProgress: false,
11        centeredSlides: false,
12        slideToClickedSlide: true,
13        slidesPerView: 'auto',
14        navigation: {
15            nextEl: '.variant-swatch-swiper__button-next',
16            prevEl: '.variant-swatch-swiper__button-prev',
17        },
18    });
19
20    const sizeSwapEl = document.querySelectorAll('.variants-showcase__sizes-item');
21    const roomvoLiteContainer = document.querySelector('.roomvo-lite-container');
22    const sizeMarquee = document.querySelector('.variant-swatch__meta-size .variant-swatch__meta-item-size-value');
23
24    // build the img src array
25    let imgSrcArray = [];
26
27    sizeSwapEl.forEach(function(el, i) {
28        const _sku = el.getAttribute('data-product-sku');
29        const id= el.getAttribute('data-product-id');
30
31        imgSrcArray.push({
32            sku: _sku,
33            id: id,
34            imgSrc: []
35        });
36
37        el.addEventListener('click', function() {
38            const data = el.getAttribute('data-canonical-product-code');
39            const id = el.getAttribute('data-product-id');
40            roomvoLiteContainer.setAttribute('data-canonical-product-code', data);
41
42            // remove active class from all elements
43            sizeSwapEl.forEach(function(item) {
44                item.classList.remove('variants-showcase__sizes-item--active');
45            });
46
47            el.classList.add('variants-showcase__sizes-item--active');
48            
49            sizeMarquee.textContent = this.textContent;
50
51            const pdpCarousel = document.querySelector('.pdp-carousel-block .main-swiper');
52            const pdpCarouselThumb = document.querySelector('.pdp-carousel-block .swiper-thumbs');
53            const carouselHasRoomvoLite = pdpCarousel.querySelector('.swiper-slide-roomvo-lite');
54
55            // search the imgSrcArray for the id
56            const found = imgSrcArray.find(entry => entry.id === id);
57            const offset = carouselHasRoomvoLite ? 1 : 0;
58
59            // replace img from carousel and thumbs
60            if (found) {
61                let thumbSlides = pdpCarouselThumb.querySelectorAll('.swiper-slide');
62                let gallerySlides = pdpCarousel.querySelectorAll('.swiper-slide');
63            
64                for (let i = 0; i < found.imgSrc.length; i++) {
65                    const imgSrc = found.imgSrc[i];
66            
67                    const thumbImg = thumbSlides[i + offset]?.querySelector('img');
68                    const galleryImg = gallerySlides[i + offset]?.querySelector('img');
69            
70                    if (thumbImg) {
71                        thumbImg.setAttribute('src', imgSrc);
72                    }
73            
74                    if (galleryImg) {
75                        galleryImg.setAttribute('src', imgSrc);
76                    }
77                }
78            }            
79        });
80
81        i++;
82    });
83
84    async function fetchImagesAndFillArray() {
85    const fetches = imgSrcArray.map(async (entry, index) => {
86        const response = await fetch(`/wp-json/variants-showcase/v1/product-images/${entry.id}`);
87        const product = await response.json();
88
89        entry.imgSrc = product.imgSrc;
90    });
91
92    await Promise.all(fetches);
93    }
94
95    fetchImagesAndFillArray();
96});

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.