PageSourceSearch

https://fpt.vn/2026/home/assets/js/showcase-scroll-swiper-home.js?v=v1.50.16

js fpt.vn collected 2026-09-24 09:39:52 UTC 2,269 bytes, 60 lines download raw bytes

1/* =============================================================================
2   SWIPER - PRODUCT SHOWCASE (scroll) — BẢN CLONE CHO TRANG /home
3   -----------------------------------------------------------------------------
4   Clone từ: public/frontend_layout_2025_vibecode/assets/plugin/swiper/showcase-scroll-swiper.js
5   Bản gốc GIỮ NGUYÊN, /vi vẫn chạy bằng bản gốc.
6
7   Khác bản gốc: bản gốc chụp danh sách phần tử một lần trong DOMContentLoaded nên
8   không thấy section nạp trễ. Bản này giữ một danh sách phần tử "đã nhận", được
9   bồi thêm mỗi lần window.homeInitShowcaseScrollSwiper(root) được gọi; init/destroy và handler resize
10   vẫn chạy y như cũ trên danh sách đó.
11   ============================================================================= */
12
13// Showcase Scroll Mode - Swiper Initialization
14(function () {
15  const swiperElements = [];
16  let swipers = [];
17
18  function init() {
19    // Destroy existing
20    swipers.forEach(s => s && s.destroy && s.destroy(true, true));
21    swipers = [];
22
23    // Only on mobile/tablet/medium desktop (not large desktop)
24    if (window.innerWidth > 1440) return;
25
26    swiperElements.forEach(function(el, index) {
27      try {
28        const swiper = new Swiper(el, {
29          slidesPerView: 'auto',
30          spaceBetween: 16,
31          freeMode: true,
32          grabCursor: true,
33          slidesOffsetBefore: 0,
34          slidesOffsetAfter: 0,
35        });
36
37        swipers.push(swiper);
38      } catch (e) {
39        // Silently handle errors
40      }
41    });
42  }
43
44    // Nhận thêm phần tử từ HTML vừa chèn rồi init lại
45    window.homeInitShowcaseScrollSwiper = function (root) {
46        var scope = (root && root.querySelectorAll) ? root : document;
47        var found = scope.querySelectorAll('.product-showcase-scroll .swiper-showcase-products');
48        var added = false;
49        Array.prototype.forEach.call(found, function (el) {
50            if (swiperElements.indexOf(el) === -1) { swiperElements.push(el); added = true; }
51        });
52        if (added) init();
53    };
54
55  let timer;
56  window.addEventListener('resize', () => {
57    clearTimeout(timer);
58    timer = setTimeout(init, 250);
59  });
60})();

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.