PageSourceSearch

https://www.luxnetcorp.com.tw/assets/frontend/javascript/active.js

js luxnetcorp.com.tw collected 2026-10-04 13:25:44 UTC 125,897 bytes, 3,065 lines download raw bytes

1// 寬版設定
2// $(window).on('load', function() {
3//    $('.page-container').attr('class', 'container-fluid page-container');
4//    window.closeLoading() //執行完js,Loading 再消失
5// });
6(function (window, $) {
7    $(() => {
8        function debounce(func, wait) {
9            let timeout;
10            return function () {
11                const context = this;
12                const args = arguments;
13                const later = function () {
14                    timeout = null;
15                    func.apply(context, args);
16                };
17                clearTimeout(timeout);
18                timeout = setTimeout(later, wait);
19            };
20        }
21        // 數字順序計算
22        const number = document.querySelectorAll(".adress-number-box");
23        let count = 1;
24        for (let i = 0; i < number.length; i++) {
25            number[i].append(count);
26            count++;
27        }
28        $(".swiper").each(function (i, o) {
29            $(this).attr("id", `swiperslide${i}`);
30        });
31
32        // SwiperLoopFix修復不滿item不滿slidesPerView數目
33        const SwiperLoopFix = (_t) => {
34            if (_t.el.querySelector(".swiper-wrapper") && _t.el.querySelectorAll(".swiper-slide")) {
35                const t = _t;
36                let c = true;
37                const k = [];
38                let s = "";
39                Array.from(t.el.querySelectorAll(".swiper-slide")).map((ele) => {
40                    const el = `<div class="${ele.classList.value}">${ele.innerHTML}</div>`;
41                    s += el;
42                });
43                if (typeof t.params.breakpoints !== "undefined") {
44                    Object.keys(t.params.breakpoints).filter((e, i) => {
45                        k[i] = e;
46                    });
47                }
48
49                function n() {
50                    if (typeof t.params.breakpoints !== "undefined") {
51                        let idx = 0;
52                        let dv = Number.MAX_VALUE;
53                        const arr = k;
54                        const num = document.body.clientWidth;
55                        for (let i = 0; i < arr.length; i++) {
56                            const nv = Math.abs(arr[i] - num);
57                            if (nv <= dv) {
58                                if (nv === dv && arr[i] < arr[idx]) {
59                                    continue;
60                                }
61                                num > arr[i] ? ((idx = i), (dv = nv)) : "";
62                            }
63                        }
64                        return t.params.breakpoints[`${arr[idx]}`].slidesPerView;
65                    }
66                    return "";
67                }
68
69                const a = () => {
70                    const v = n() || t.params.slidesPerView || 1;
71                    const l = t.el.querySelectorAll(".swiper-slide:not(.swiper-slide-duplicate)").length;
72                    if (l < v && c) {
73                        const f = v - l;
74                        c = false;
75                        for (let i = 0; i < f; i++) {
76                            t.el.querySelector(".swiper-wrapper").innerHTML += s;
77                            i == f - 1 ? (c = true) : "";
78                        }
79                    }
80                };
81                a();
82                window.addEventListener("resize", () => {
83                    a();
84                });
85            }
86        };
87
88        // 手機版本選單
89        $(".mobile-nav-btn").click(() => {
90            $("html").toggleClass("overflow");
91        });
92        $(window).on("resize", function () {
93            if (window.innerWidth > 992) {
94                $("html").removeClass("overflow");
95            }
96        });
97
98        /*= ============ version_news_01 的圖片輪播 ============= */
99        const UpSvg =
100            '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M352 352c-8.188 0-16.38-3.125-22.62-9.375L192 205.3l-137.4 137.4c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25C368.4 348.9 360.2 352 352 352z"/></svg>';
101        // Scroll Up
102        $.scrollUp({
103            scrollText: `${UpSvg}`,
104            easingType: "linear",
105            scrollSpeed: 900,
106            animation: "slide",
107        });
108
109        // 選單按鈕Start
110
111        if ($(".js-nav-btnopen").length > 0) {
112            $(() => {
113                const $open = $(".js-nav-btnopen .open"); // 漢堡按鈕"開"
114                const $close = $(".js-nav-btnopen .off , .ladingpage_mobile_li"); // 漢堡按鈕“關”
115                const $icon = $(".icon_Community"); // 右側社群icon
116
117                $open.on("click", () => {
118                    $close.removeClass("d-none"); // 移除有d-nono的class
119                    $open.addClass("d-none"); // 開增加"d-none"的class
120                    $(".mobileMenu_nav").fadeIn(); // 選單淡入
121                    $("body").css("overflow", "hidden"); // 背景卡住避免產生捲軸
122                    $(".js-nav-btnopen").addClass("nav-aa-color");
123                    $icon.hide(); // 右側icon隱藏
124                });
125                $close.on("click", () => {
126                    $open.removeClass("d-none");
127                    $close.addClass("d-none");
128                    $(".mobileMenu_nav").fadeOut(); // 選單淡出
129                    $(".js-nav-btnopen").removeClass("nav-aa-color");
130                    $icon.show(); // 右側icon顯示
131                });
132            });
133
134            $(".btn-addmenu").on("click", function () {
135                $(this).children().toggleClass("d-none"); // +變換-號,被選擇的元素(.js-close進行切換)
136                $(this).parent(".menu_div").next().slideToggle(); // button的父層的底下,同層為ul
137            });
138
139            //
140            const h_navtool = $("#wn__header").outerHeight(true); // 判斷高度含magin的間距
141            $(".mobileMenu_nav").css("padding-top", h_navtool); // 取得#wn__header的高,決定pt的間距
142
143            $(".mobileMenu_nav").scroll(function () {
144                if ($(this).scrollTop() > 0) {
145                    $(".js-nav-btnopen").addClass("nav-color");
146                } else {
147                    $(".js-nav-btnopen").removeClass("nav-color");
148                }
149            });
150
151            // 選單按鈕End
152        }
153
154        // 訂單隱藏
155        if ($(".js-cart-btn").length > 0) {
156            $(".js-cart-btn").click(function () {
157                const btn = this;
158                $(".js-cart-open").slideToggle(400, "swing", function () {
159                    if ($(this).is(":hidden")) {
160                        btn.classList.remove("active");
161                    } else {
162                        btn.classList.add("active");
163                    }
164                });
165            });
166        }
167
168        // 右側icon
169        if ($(".js-btn-icon_Community").length > 0) {
170            $(".js-btn-icon_Community").click(() => {
171                $(".js-icon_Community").toggleClass("active");
172            });
173        }
174
175        // Sticky Header
176        (function stickyHeader() {
177            const target = document.querySelector("body");
178            const sentry = document.querySelector(".sticky_sentry");
179            // 要修改is-sticky出現的高度,修改_variables.scs的$sticky-position
180            const observer = new IntersectionObserver(
181                ([entry]) => {
182                    if (!entry.isIntersecting) {
183                        // 哨兵離開視口
184                        target.classList.add("is-sticky");
185                    } else {
186                        // 哨兵進入視口
187                        target.classList.remove("is-sticky");
188                    }
189                },
190                { root: null, threshold: 0 } // 使用全視口,檢測哨兵進出
191            );
192
193            observer.observe(sentry);
193 // 觀察哨兵元素
194        })();
195
196        // Cartbox Toggler
197        (function cartboxToggler() {
198            const trigger = $(".block__active");
199            const container = $(".block_content");
200
201            trigger.on("click", (e) => {
202                e.preventDefault();
203                container.toggleClass("is-visible");
204            });
205            $(".close__wrap").on("click", () => {
206                container.removeClass("is-visible");
207            });
208        })();
209
210        // Search Toggler
211        if ($(".search__active").length > 0) {
212            (function searchToggler() {
213                const trigger = $(".search__active");
214                const container = $(".search_active_x");
215
216                trigger.on("click", (e) => {
217                    e.preventDefault();
218                    container.toggleClass("is-visible");
219                });
220                $(".close__wrap").on("click", () => {
221                    container.removeClass("is-visible");
222                });
223                $(".close").on("click", () => {
224                    container.removeClass("is-visible");
225                });
226            })();
227        }
228
229        if ($(".shop_search").length > 0) {
230            window.onload = function () {
231                const myDiv = document.getElementsByClassName("shop_search")[0];
232                document.addEventListener("click", (e) => {
233                    if ($(e.target).parents(".search_active_x").length != 1 && e.target != $(".search_active_x")[0]) {
234                        $(".search_active_x").removeClass("is-visible");
235                    }
236                });
237                myDiv.addEventListener("click", (event) => {
238                    $(".setting__block,.setting_lang_block,.block-minicart").removeClass("is-visible");
239                    event = event || window.event;
240                    event.stopPropagation();
241                });
242            };
243        }
244
245        function navtoolShop() {
246            $(".navtool-shop .dropdown-toggle, .close-div").on("click", () => {
247                if (window.innerWidth < 576) {
248                    $(".icon_Community").toggle();
249                }
250            });
251        }
252        navtoolShop();
253        $(window).on("resize", function () {
254            navtoolShop();
255        });
256
257        // Cart Setting Toggler
258        (function cartSettingToggler() {
259            const trigger = $(".cartbox_active");
260            const container = $(".minicart__active");
261            const settingTrigger = $(".setting__active");
262            const settingContainer = $(".setting__block");
263            const settingLang = $(".setting_lang_active");
264            const settingLangContainer = $(".setting_lang_block");
265
266            trigger.on("click", (e) => {
267                e.preventDefault();
268                container.toggleClass("is-visible");
269            });
270
271            $(".micart__close").on("click", () => {
272                container.removeClass("is-visible");
273            });
274
275            settingTrigger.on("click", (e) => {
276                e.preventDefault();
277                settingContainer.toggleClass("is-visible");
278            });
279            settingLang.on("click", (e) => {
280                e.preventDefault();
281                settingLangContainer.toggleClass("is-visible");
282            });
283        })();
284
285        // Setting Option
286        (function settingOption() {
287            const settingItem = $(".currency-trigger");
288
289            settingItem.on("click", function () {
290                $(this).siblings(".switcher-dropdown").toggleClass("is-visible");
291            });
292        })();
293        $(window).on("click", (e) => {
294            if ($(e.target).parents(".cartbox_active").length != 1 && e.target != $(".cartbox_active")[0]) {
295                if ($(".block-minicart").hasClass("is-visible")) {
296                    if ($(e.target).parents(".block-minicart").length > 0 || e.target == $(".block-minicart")[0]) {
297                    } else {
298                        $(".block-minicart").removeClass("is-visible");
299                    }
300                }
301            }
302            if ($(e.target).parents(".setting__active").length != 1 && e.target != $(".setting__active")[0]) {
303                if ($(".setting__block").hasClass("is-visible")) {
304                    if ($(e.target).parents(".setting__block").length > 0 || e.target == $(".setting__block")[0]) {
305                    } else {
306                        $(".setting__block").removeClass("is-visible");
307                    }
308                }
309            }
310            if ($(e.target).parents(".setting_lang_active").length != 1 && e.target != $(".setting_lang_active")[0]) {
311                if ($(".setting_lang_block").hasClass("is-visible")) {
312                    if (
313                        $(e.target).parents(".setting_lang_block").length > 0 ||
314                        e.target == $(".setting_lang_block")[0]
315                    ) {
316                    } else {
317                        $(".setting_lang_block").removeClass("is-visible");
318                    }
319                }
320            }
321        });
322
323        // INDEX BANNER
324        if ($(".Swiper_MainBanner .swiper-slide").length > 0) {
325            const indexBanner = new Swiper(".Swiper_MainBanner", {
326                // centeredSlides: true, // 居中幻燈片
327                grabCursor: true, // 滑鼠摸到輪播圖樣是
328                slidesPerView: 1, // 初始質輪播初始質
329                spaceBetween: 0, // 輪播圖之間的間隔
330                loop: false, // 無限循環
331                lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
331™¤
332                autoplay: {
333                    delay: 5000, // 自動撥放
334                },
335                // 響應式斷點
336                breakpoints: {
337                    320: {
338                        noSwiping: false,
339                    },
340                    768: {
341                        noSwiping: true,
342                    },
343                    911: {
344                        slidesPerView: 1,
345                        spaceBetween: 0,
346                    },
347                },
348                // 導覽列
349                pagination: {
350                    el: ".index-Banner-pagination",
351                    clickable: true,
352                },
353                on: {
354                    beforeInit() {
355                        // 請勿把它變成箭頭函式
356                        this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
357                    },
358                },
359            });
360        }
361
362        // 修復內頁商品輪播
363        function hotProducItemSet(el, num) {
364            return $(el).length > num;
365        }
366
367        const hot_producItem = new Swiper(".hot_producItem", {
368            grabCursor: true, // 滑鼠摸到輪播圖樣是
369            slidesPerView: 3, // 初始質輪播初始質
370            spaceBetween: 10, // 輪播圖之間的間隔
371            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
372            loop: true, // 無限循環
373            autoplay: {
374                delay: 5000, // 自動撥放
375            },
376            observer: true,
377            observeParents: true,
378
379            breakpoints: {
380                // 響應式斷點
381                0: {
382                    slidesPerView: 2,
383                    loop: hotProducItemSet(".hot_producItem .swiper-slide", 1), // 無限循環
384                },
385                576: {
386                    slidesPerView: 2,
387                    loop: hotProducItemSet(".hot_producItem .swiper-slide", 2), // 無限循環
388                },
389                768: {
390                    slidesPerView: 3,
391                    loop: hotProducItemSet(".hot_producItem .swiper-slide", 3), // 無限循環
392                },
393            },
394
395            // 導覽列
396            pagination: {
397                el: ".hot_producItem .index-Banner-pagination",
398                clickable: true,
399            },
400        });
401
402        // 相關頁面分類
403        const relativeSwipers = [
404            ".contentCategoryRelatedSwiper",
405            ".reverseContentCategoryRelatedSwiper",
406            ".contentRelatedSwiper",
407            ".reverseContentRelatedSwiper",
408            ".productCategoryRelatedSwiper",
409            ".reverseProductCategoryRelatedSwiper",
410        ];
411        $(relativeSwipers).each((i, o) => {
412            if ($(o).length > 0) {
413                const swiper = new Swiper(o, {
414                    grabCursor: true, // 滑鼠摸到輪播圖樣是
415                    slidesPerView: 3, // 初始質輪播初始質
416                    spaceBetween: 20, // 輪播圖之間的間隔
417                    observer: true,
418                    observeParents: true,
419
420                    breakpoints: {
421                        // 響應式斷點
422                        0: {
423                            slidesPerView: 2,
424                        },
425                        576: {
426                            slidesPerView: 2,
427                        },
428                        768: {
429                            slidesPerView: 3,
430                        },
431                    },
432
433                    // 導覽列
434                    pagination: {
435                        el: `${o} .index-Banner-pagination`,
436                        clickable: true,
437                    },
438                });
439            }
440        });
441
442        // 商品內頁頁籤
443        const nav_tabs_slide = new Swiper(".nav_tabs_slide", {
444            grabCursor: true, // 滑鼠摸到輪播圖樣是
445            spaceBetween: 10, // 輪播圖之間的間隔
446            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
447            loop: false, // 無限循環
448            // autoplay: {
449            //     delay: 5000, // 自動撥放
450            // },
451            observer: true,
452            observeParents: true,
453
454            breakpoints: {
455                // 響應式斷點
456                0: {
457                    slidesPerView: 2,
458                },
459                576: {
460                    slidesPerView: 2,
461                },
462                768: {
463                    slidesPerView: 3,
464                },
465                991: {
466                    slidesPerView: 3,
467                },
468                1200: {
469                    slidesPerView: 5,
470                },
471            },
472
473            // 如果需要前进后退按钮
474            navigation: {
475                nextEl: ".nav_tabs_slide .index-Banner-button-next",
476                prevEl: ".nav_tabs_slide .index-Banner-button-prev",
477            },
478            on: {
479                beforeInit() {
480                    // 請勿把它變成箭頭函式
481                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
482                },
483            },
484        });
485
486        // 模組
487        // version_catalog
488        const version_catalog_13_slide = new Swiper(".version_catalog_13_slide", {
489            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
489™¤
490            spaceBetween: 10, // 輪播圖之間的間隔
491            // 如果需要前进后退按钮
492            navigation: {
493                nextEl: ".version_catalog_13 .index-Banner-button-next",
494                prevEl: ".version_catalog_13 .index-Banner-button-prev",
495            },
496            // 導覽列
497            pagination: {
498                el: ".version_catalog_13 .index-Banner-pagination",
499                clickable: true,
500            },
501            breakpoints: {
502                320: {
503                    slidesPerView: 1,
504                    noSwiping: false,
505                },
506                768: {
507                    slidesPerView: 2,
508                    noSwiping: true,
509                },
510                991: {
511                    slidesPerView: 3,
512                },
513                1280: {
514                    slidesPerView: 4,
515                },
516            },
517        });
518
519        const version_catalog_04_slide = new Swiper(".version_catalog_04_slide", {
520            slidesPerView: 3, // 初始質輪播初始質
521            spaceBetween: 0, // 輪播圖之間的間隔
522            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
523            loop: true, // 無限循環
524            observer: true,
525            observeParents: true,
526
527            // 如果需要前进后退按钮
528            navigation: {
529                nextEl: ".version_catalog_04_slide .index-Banner-button-next",
530                prevEl: ".version_catalog_04_slide .index-Banner-button-prev",
531            },
532            // 響應式斷點
533            breakpoints: {
534                0: {
535                    slidesPerView: 1,
536                },
537                320: {
538                    noSwiping: false,
539                },
540                576: {
541                    slidesPerView: 1,
542                    noSwiping: true,
543                },
544                768: {
545                    slidesPerView: 2,
546                },
547                991: {
548                    slidesPerView: 3,
549                },
550            },
551            // 導覽列
552            pagination: {
553                el: ".index-Banner-pagination",
554                clickable: true,
555            },
556            on: {
557                beforeInit() {
558                    // 請勿把它變成箭頭函式
559                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
560                },
561            },
562        });
563
564        const version_catalog_11_slide = new Swiper(".version_catalog_11_slide", {
565            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
566            slidesPerView: 3, // 初始質輪播初始質
567            spaceBetween: 10, // 輪播圖之間的間隔
568            loop: true, // 無限循環
569
570            // 導覽列
571            pagination: {
572                el: ".index-Banner-pagination",
573                clickable: true,
574            },
575            // 如果需要前进后退按钮
576            navigation: {
577                nextEl: ".version_catalog_11_slide .index-Banner-button-next",
578                prevEl: ".version_catalog_11_slide .index-Banner-button-prev",
579            },
580            // 響應式斷點
581            breakpoints: {
582                0: {
583                    slidesPerView: 1,
584                },
585                320: {
586                    noSwiping: false,
587                },
588                768: {
589                    noSwiping: true,
590                },
591                991: {
592                    slidesPerView: 2,
593                },
594                1199: {
595                    slidesPerView: 3,
596                },
597            },
598            on: {
599                beforeInit() {
600                    // 請勿把它變成箭頭函式
601                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
602                },
603            },
604        });
605
606        // version_list
607        const version_list_01_slide = new Swiper(".version_list_01_slide", {
608            // grabCursor: true, // 滑鼠摸到輪播圖樣是
609            slidesPerView: 5, // 初始質輪播初始質
610            spaceBetween: 10, // 輪播圖之間的間隔
611            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
611™¤
612            loop: true, // 無限循環
613            autoplay: {
614                delay: 5000, // 自動撥放
615            },
616            observer: true,
617            observeParents: true,
618            breakpoints: {
619                // 響應式斷點
620                0: {
621                    slidesPerView: 1,
622                    spaceBetween: 10,
623                },
624                576: {
625                    slidesPerView: 2,
626                    spaceBetween: 10,
627                },
628                768: {
629                    slidesPerView: 3,
630                    spaceBetween: 10,
631                },
632                991: {
633                    slidesPerView: 4,
634                    spaceBetween: 10,
635                },
636            },
637            // 導覽列
638            pagination: {
639                el: ".index-Banner-pagination",
640                clickable: true,
641            },
642            // 如果需要前进后退按钮
643            navigation: {
644                nextEl: ".version_list_01_slide .index-Banner-button-next",
645                prevEl: ".version_list_01_slide .index-Banner-button-prev",
646            },
647            on: {
648                beforeInit() {
649                    // 請勿把它變成箭頭函式
650                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
651                },
652            },
653        });
654
655        // version_pages
656        const version_pages_01_slide = new Swiper(".version_pages_01_slide", {
657            grabCursor: true, // 滑鼠摸到輪播圖樣是
658            slidesPerView: 5, // 初始質輪播初始質
659            spaceBetween: 10, // 輪播圖之間的間隔
660            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
661            loop: true, // 無限循環
662            autoplay: {
663                delay: 5000, // 自動撥放
664            },
665            observer: true,
666            observeParents: true,
667
668            breakpoints: {
669                // 響應式斷點
670                0: {
671                    slidesPerView: 2,
672                    noSwiping: false,
673                },
674                576: {
675                    slidesPerView: 2,
676                    noSwiping: true,
677                },
678                768: {
679                    slidesPerView: 3,
680                },
681                1199: {
682                    slidesPerView: 4,
683                },
684                1500: {
685                    slidesPerView: 5,
686                },
687            },
688
689            // 導覽列
690            pagination: {
691                el: ".index-Banner-pagination",
692                clickable: true,
693            },
694            // 如果需要前进后退按钮
695            navigation: {
696                nextEl: ".version_pages_01_slide .index-Banner-button-next",
697                prevEl: ".version_pages_01_slide .index-Banner-button-prev",
698            },
699            on: {
700                beforeInit() {
701                    // 請勿把它變成箭頭函式
702                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
703                },
704            },
705        });
706
707        if (hasItem($(".version_pages_02_slide"))) {
708            $(".version_pages_02_slide").each(function () {
709                const that = this;
710                const id = $(this).attr("id");
711
712                const slide = new Swiper(that, {
713                    grabCursor: true, // 滑鼠摸到輪播圖樣是
714                    slidesPerView: 5, // 初始質輪播初始質
715                    spaceBetween: 10, // 輪播圖之間的間隔
716                    lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
717                    loop: true, // 無限循環
718                    // autoplay: {
719                    //     delay: 5000, // 自動撥放
720                    // },
721                    observer: true,
722                    observeParents: true,
723
724                    navigation: {
725                        nextEl: `#${id} .index-Banner-button-next`,
726                        prevEl: `#${id} .index-Banner-button-prev`,
727                    },
728                    pagination: {
729                        el: `#${id} .index-Banner-pagination`,
730                    },
731                    on: {
732                        beforeInit() {
733                            // 請勿把它變成箭頭函式
734                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
735                        },
736                    },
737                    breakpoints: {
738                        // 響應式斷點
739                        0: {
740                            slidesPerView: 2,
741                        },
742                        320: {
743                            noSwiping: false,
744                        },
745                        576: {
746                            slidesPerView: 2,
747                            noSwiping: true,
748                        },
749                        768: {
750                            slidesPerView: 3,
751                        },
752                        991: {
753                            slidesPerView: 4,
754                        },
755                    },
756                });
757            });
758        }
759
760        const version_pages_10_inside_slide = new Swiper(".version_pages_10_inside_slide", {
761            grabCursor: true, // 滑鼠摸到輪播圖樣是
762            slidesPerView: 1, // 初始質輪播初始質
763            // spaceBetween: 10, // 輪播圖之間的間隔
764            // centeredSlides: true,
765            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
765™¤
766            loop: true, // 無限循環
767            watchSlidesVisibility: true,
768            // autoplay: {
769            //     delay: 5000, // 自動撥放
770            // },
771
772            observer: true,
773            observeParents: true,
774
775            // breakpoints: { // 響應式斷點
776            //     0: {
777            //         slidesPerView: 1,
778            //     },
779            //     991: {
780            //         slidesPerView: 1,
781            //     },
782            // },
783
784            // 導覽列
785            pagination: {
786                el: ".index-Banner-pagination",
787                clickable: true,
788            },
789            breakpoints: {
790                320: {
791                    noSwiping: false,
792                },
793                768: {
794                    noSwiping: true,
795                },
796            },
797        });
798
799        const version_pages_10_slide = new Swiper(".version_pages_10_slide", {
800            grabCursor: true, // 滑鼠摸到輪播圖樣是
801            slidesPerView: 3, // 初始質輪播初始質
802            spaceBetween: 10, // 輪播圖之間的間隔
803            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
804            loop: true, // 無限循環
805            // autoplay: {
806            //     delay: 5000, // 自動撥放
807            // },
808
809            thumbs: {
810                swiper: version_pages_10_inside_slide,
811            },
812
813            centeredSlides: true,
814            observer: true,
815            observeParents: true,
816
817            breakpoints: {
818                // 響應式斷點
819                0: {
820                    slidesPerView: 1,
821                },
822                576: {
823                    slidesPerView: 2,
824                },
825                768: {
826                    slidesPerView: 3,
827                },
828                991: {
829                    slidesPerView: 3,
830                },
831            },
832
833            // 如果需要前进后退按钮
834            navigation: {
835                nextEl: ".version_pages_10_slide .index-Banner-button-next",
836                prevEl: ".version_pages_10_slide .index-Banner-button-prev",
837            },
838            on: {
839                beforeInit() {
840                    // 請勿把它變成箭頭函式
841                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
842                },
843            },
844        });
845
846        const version_pages_13_slide = new Swiper(".version_pages_13_slide", {
847            grabCursor: true, // 滑鼠摸到輪播圖樣是
848            slidesPerView: 5, // 初始質輪播初始質
849            spaceBetween: 30, // 輪播圖之間的間隔
850            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
851            loop: true, // 無限循環
852            // autoplay: {
853            //     delay: 5000, // 自動撥放
854            // },
855            observer: true,
856            observeParents: true,
857
858            breakpoints: {
859                // 響應式斷點
860                0: {
861                    slidesPerView: 1,
862                    noSwiping: false,
863                },
864                576: {
865                    slidesPerView: 1,
866                    noSwiping: true,
867                },
868                768: {
869                    slidesPerView: 1,
870                },
871                991: {
872                    slidesPerView: 2,
873                },
874            },
875
876            // 導覽列
877            pagination: {
878                el: ".index-Banner-pagination",
879                clickable: true,
880            },
881            // 如果需要前进后退按钮
882            navigation: {
883                nextEl: ".version_pages_13_slide .index-Banner-button-next",
884                prevEl: ".version_pages_13_slide .index-Banner-button-prev",
885            },
886            on: {
887                beforeInit() {
888                    // 請勿把它變成箭頭函式
889                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
890                },
891            },
892        });
893
894        // version_photo
895        const version_photo_20_slide = new Swiper(".version_photo_20_slide", {
896            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
896™¤
897            slidesPerView: 3, // 初始質輪播初始質
898            spaceBetween: 10, // 輪播圖之間的間隔
899            loop: true, // 無限循環
900            // 導覽列
901            pagination: {
902                el: ".version_photo_20 .index-Banner-pagination",
903                clickable: true,
904            },
905            // 如果需要前进后退按钮
906            navigation: {
907                nextEl: ".version_photo_20_slide .index-Banner-button-next",
908                prevEl: ".version_photo_20_slide .index-Banner-button-prev",
909            },
910            // 響應式斷點
911            breakpoints: {
912                0: {
913                    slidesPerView: 2,
914                },
915                576: {
916                    slidesPerView: 2,
917                },
918                768: {
919                    slidesPerView: 3,
920                },
921                991: {
922                    slidesPerView: 3,
923                },
924            },
925        });
926
927        const version_photo_01_slide = new Swiper(".version_photo_01_slide", {
928            grabCursor: true, // 滑鼠摸到輪播圖樣是
929            slidesPerView: 5, // 初始質輪播初始質
930            spaceBetween: 0, // 輪播圖之間的間隔
931            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
932            loop: true, // 無限循環
933            autoplay: {
934                delay: 5000, // 自動撥放
935            },
936            observer: true,
937            observeParents: true,
938
939            breakpoints: {
940                // 響應式斷點
941                0: {
942                    slidesPerView: 1,
943                },
944                576: {
945                    slidesPerView: 2,
946                },
947                768: {
948                    slidesPerView: 4,
949                },
950                991: {
951                    slidesPerView: 6,
952                },
953            },
954
955            // 導覽列
956            pagination: {
957                el: ".index-Banner-pagination",
958                clickable: true,
959            },
960            // 如果需要前进后退按钮
961            navigation: {
962                nextEl: ".version_photo_01_slide .index-Banner-button-next",
963                prevEl: ".version_photo_01_slide .index-Banner-button-prev",
964            },
965            on: {
966                beforeInit() {
967                    // 請勿把它變成箭頭函式
968                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
969                },
970            },
971        });
972
973        const version_photo_04_slide = new Swiper(".version_photo_04_slide", {
974            grabCursor: true, // 滑鼠摸到輪播圖樣是
975            slidesPerView: 5, // 初始質輪播初始質
976            spaceBetween: 0, // 輪播圖之間的間隔
977            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
978            loop: true, // 無限循環
979            autoplay: {
980                delay: 5000, // 自動撥放
981            },
982            observer: true,
983            observeParents: true,
984
985            breakpoints: {
986                // 響應式斷點
987                0: {
988                    slidesPerView: 1,
989                },
990                576: {
991                    slidesPerView: 2,
992                },
993                768: {
994                    slidesPerView: 3,
995                },
996                991: {
997                    slidesPerView: 6,
998                },
999            },
1000
1001            // 導覽列
1002            pagination: {
1003                el: ".index-Banner-pagination",
1004                clickable: true,
1005            },
1006            // 如果需要前进后退按钮
1007            navigation: {
1008                nextEl: ".version_photo_04_slide .index-Banner-button-next",
1009                prevEl: ".version_photo_04_slide .index-Banner-button-prev",
1010            },
1011            on: {
1012                beforeInit() {
1013                    // 請勿把它變成箭頭函式
1014                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
1015                },
1016            },
1017        });
1018
1019        const version_photo_14_slide = new Swiper(".version_photo_14_slide", {
1020            grabCursor: true, // 滑鼠摸到輪播圖樣是
1021            slidesPerView: 5, // 初始質輪播初始質
1022            spaceBetween: 0, // 輪播圖之間的間隔
1023            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的classç§»é
1023™¤
1024            loop: true, // 無限循環
1025            autoplay: {
1026                delay: 5000, // 自動撥放
1027            },
1028            observer: true,
1029            observeParents: true,
1030
1031            breakpoints: {
1032                // 響應式斷點
1033                0: {
1034                    slidesPerView: 1,
1035                    noSwiping: false,
1036                },
1037                576: {
1038                    slidesPerView: 2,
1039                    noSwiping: true,
1040                },
1041                768: {
1042                    slidesPerView: 2,
1043                },
1044                991: {
1045                    slidesPerView: 4,
1046                },
1047            },
1048
1049            // 導覽列
1050            pagination: {
1051                el: ".index-Banner-pagination",
1052                clickable: true,
1053            },
1054            // 如果需要前进后退按钮
1055            navigation: {
1056                nextEl: ".version_photo_14_slide .index-Banner-button-next",
1057                prevEl: ".version_photo_14_slide .index-Banner-button-prev",
1058            },
1059            on: {
1060                beforeInit() {
1061                    // 請勿把它變成箭頭函式
1062                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
1063                },
1064            },
1065        });
1066
1067        const version_text_06_slide = new Swiper(".version_text_06_slide", {
1068            grabCursor: true, // 滑鼠摸到輪播圖樣是
1069            spaceBetween: 20, // 輪播圖之間的間隔
1070            lazy: true, // 延遲加載,關掉:請把輪播內的swiper-lazy的class移除
1071            loop: true, // 無限循環
1072            autoplay: {
1073                delay: 5000, // 自動撥放
1074            },
1075            observer: true,
1076            observeParents: true,
1077
1078            breakpoints: {
1079                // 響應式斷點
1080                0: {
1081                    slidesPerView: 1,
1082                    noSwiping: false,
1083                },
1084                576: {
1085                    slidesPerView: 1,
1086                    noSwiping: true,
1087                },
1088                768: {
1089                    slidesPerView: 2,
1090                },
1091                1199: {
1092                    slidesPerView: 3,
1093                },
1094                1540: {
1095                    slidesPerView: 4,
1096                },
1097            },
1098            // 導覽列
1099            pagination: {
1100                el: ".version_text_06_slide .index-Banner-pagination",
1101                clickable: true,
1102            },
1103            on: {
1104                beforeInit() {
1105                    // 請勿把它變成箭頭函式
1106                    this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
1107                },
1108            },
1109        });
1110
1111        /*= ======== Video影片 =========== */
1112        const video_frame_w = $(".img_static").outerWidth();
1113        const video_frame_h = $(".img_static").outerHeight();
1114
1115        $("#cms_play").on("click", function () {
1116            $(this).hide("fast");
1117            $(".img_static").fadeOut("fast");
1118            let $dataVideo = $(this).data("video");
1119            const youtubeVideoIdLength = 11;
1120            let newId = "";
1121            if ($dataVideo.length <= youtubeVideoIdLength) {
1122                return $dataVideo;
1123            }
1124            if ($dataVideo.indexOf("watch?v=") > 0) {
1125                newId = $dataVideo.substr($dataVideo.indexOf("watch?v=") + 8, youtubeVideoIdLength);
1126            } else if ($dataVideo.indexOf("youtu.be/") > 0) {
1127                newId = $dataVideo.substr($dataVideo.indexOf("youtu.be/") + 9, youtubeVideoIdLength);
1128            } else if ($dataVideo.indexOf("/embed/") > 0) {
1129                newId = $dataVideo.substr($dataVideo.indexOf("/embed/") + 7, youtubeVideoIdLength);
1130            } else {
1131                newId = $dataVideo.substr($dataVideo.lastIndexOf("/") + 1, $dataVideo.length);
1132                if (newId.length > youtubeVideoIdLength) {
1133                    newId = newId.substr(0, youtubeVideoIdLength);
1134                }
1135            }
1136            let defaultiIframe = "https://www.youtube.com/embed/" + newId + "?rel=0";
1137
1138            $(".static_video").append(
1139                `
1140                <iframe width="${video_frame_w}px" height="${video_frame_h}px" src="${defaultiIframe}&rel=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture;
1140 web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
1141                `
1142            );
1143        });
1144
1145        // 範本 14 - Lightbox
1146        $(".default-demo").slickLightbox();
1147
1148        // 社群icon一開始不顯示
1149        let icon_show = false;
1150        $(window).scroll(function () {
1151            if (!icon_show && $(this).scrollTop() > 550) {
1152                $(".icon_Community").addClass("show");
1153                icon_show = true;
1154            }
1155        });
1156
1157        // Banner 以選單底部置頂
1158        function BannerTop() {
1159            const headerH = $("#wn__header").height();
1160            $("#mobile_banner,#mainbanner,.banner_col").css("marginTop", headerH);
1161        }
1162
1163        BannerTop();
1164        $(window).on("resize", function () {
1165            BannerTop();
1166        });
1167
1168        function LazyMap() {
1169            if (document.querySelector(".googleUrl") == null) {
1170                return false;
1171            }
1172            $(".googleUrl").each(function () {
1173                const iframeData = $(this).data("url");
1174                const tmpDiv = document.createElement("div");
1175                tmpDiv.innerHTML = iframeData;
1176                const url = tmpDiv.firstElementChild.src || tmpDiv.firstElementChild.dataset.src;
1177                const iframe = $(this).find("iframe");
1178                iframe.attr({
1179                    "data-src": url,
1180                    frameborder: 0,
1181                    allowfullscreen: true,
1182                    "aria-hidden": false,
1183                    tabindex: 0,
1184                    height: "200px",
1185                    width: "100%",
1186                });
1187                iframe.addClass("lazyload");
1188
1189                $(this).append(iframe);
1190                window.lazyLoad.update();
1191                $(this).removeAttr("data-url");
1192                tmpDiv.innerHTML = "";
1193
1194                // 判斷demo39
1195                if ($(".googleUrl").hasClass("Demo-39")) {
1196                    document.getElementsByClassName("Demo-39")[0].style.height = "100%";
1197                    document.getElementsByClassName("Demo-39")[0].style.overflow = "hidden";
1198                }
1199            });
1200        }
1201        LazyMap();
1202
1203        // 領先指標
1204        if ($.circleProgress && $("#index_progressbar").length) {
1205            // 設0不啟用圓圈
1206            $.circleProgress.defaults.size = 0;
1207            let is_circleProgress = false;
1208            $(window).on("scroll", () => {
1209                if (
1210                    $("#index_progressbar").offset().top + 200 - $(window).height() < $(window).scrollTop() &&
1211                    is_circleProgress === false
1212                ) {
1213                    $(".title_num")
1214                        .circleProgress({
1215                            value: 1,
1216                        })
1217                        .on("circle-animation-progress", function (event, progress) {
1218                            const span = $(this).find("strong");
1219                            const value = $(span).attr("data-num");
1220                            $(span).html(parseInt(value * progress));
1221                        });
1222
1223                    $(".circle_num")
1224                        .circleProgress({
1225                            value: 1,
1226                            // thickness: 25,
1227                            // startAngle: -Math.PI * 1.75
1228                            animation: {
1229                                duration: 2100,
1230                            },
1231                        })
1232                        .on("circle-animation-progress", function (event, progress) {
1233                            const span = $(this).find("strong");
1234                            const value = $(span).attr("data-num");
1235                            if (value.includes(",")) {
1236                                const v = value.replaceAll(",", "");
1237                                $(span).html(parseInt(v * progress).toLocaleString());
1238                            } else if (value.includes("%")) {
1239                                const v = value.replaceAll("%", "");
1240                                $(span).html(`${parseInt(v * progress)}%`);
1241                            } else if (value.includes(".")) {
1242                                $(span).html(parseFloat(value * progress).toFixed(2));
1243                            } else {
1244                                $(span).html(parseInt(value * progress));
1245                            }
1246                        });
1247
1248                    is_circleProgress = true;
1249                }
1250            });
1251        }
1252
1253        // 選單上滑影藏、下滑出現特效
1254        function navtoolNone() {
1255            let navtool = Math.round($("#wn__header").height());
1256            let NowNavtool = navtool;
1257            let thisScroll = 0;
1258            let beforeScroll = 0;
1259            let navSwitch = true;
1260            let Switch = true;
1261            $(window).scroll(function () {
1262                NowNavtool = Math.round($("#wn__header").height());
1263                if (navtool !== NowNavtool) {
1264                    navtool = Math.round($("#wn__header").height());
1265                }
1266
1267                thisScroll = $(this).scrollTop();
1268                beforeScroll < thisScroll ? (Switch = beforeScroll > Math.abs(navtool)) : (Switch = false);
1269
1270                if (Switch) {
1271                    if (navSwitch) {
1272                        // 當往下時
1273                        navSwitch = false;
1274                        $("#wn__header").css("top", -navtool);
1275                    }
1276                } else if (!navSwitch) {
1277                    // 當往上時
1278                    navSwitch = true;
1279                    $("#wn__header").css("top", 0);
1280                }
1281                setTimeout(() => {
1282                    beforeScroll = thisScroll;
1283                }, 0);
1284            });
1285        }
1286        // navtoolNone()
1287
1288        // 一頁式商店
1289        if ($(".lading_menu_wrap").length > 0) {
1290            // 定義 debounce 函數
1291            $(window)
1292                .on(
1293                    "resize",
1294                    debounce(() => {
1295                        $(".lading_menu_container").addClass("calcing");
1296                        let menuWidth = $(".lading_menu").width();
1297                        let liwidths = 0;
1298                        const liArray = [];
1299                        $(".lading_menu li").each(function () {
1300                            $(this).css("min-width", "auto");
1301                            const w = $(this).outerWidth(true) + 10;
1302                            liwidths += w;
1303                            liArray.push(w);
1304                            $(this).css("min-width", `${w}px`);
1305                        });
1306                        // $('#nav-menu').width() > 0; // 代表還沒變漢堡選單
1307                        if ($("#nav-menu").width() > 0) {
1308                            // 如果錨點一開始就比選單寬 不做偏移、寬度處理
1309                            if (liwidths > $("#nav-menu").outerWidth()) {
1310                            } else {
1311                                // 如果錨點比選單窄將錨點選單對齊到中間
1312                                // menuWidth = $('.lading_menu_container').width($('#nav-menu').outerWidth());
1313                                // const navMenu = document.querySelector('#nav-menu');
1314                                // const navMenuRect = navMenu.getBoundingClientRect();
1315                                // $('.lading_menu_container').css('margin-left', navMenuRect.left);
1316                            }
1317                        } else {
1318                            menuWidth = $(".lading_menu_container").width();
1319                            $(".lading_menu_container").css("margin-left", 0);
1320                        }
1321                        if (liwidths > menuWidth) {
1322                            $(".lading_menu").addClass("lading_menu_scroll");
1323                        } else {
1324                            $(".lading_menu").removeClass("lading_menu_scroll");
1325                        }
1326                        $(".lading_menu_container").removeClass("calcing");
1327                        setTimeout(() => {
1328                            const h_navtool = $("#wn__header").outerHeight(true) || 0; // 判斷高度含magin的間距
1329                            const lading_h = $(".lading_menu").outerHeight(true) || 0;
1330                            $(".lading_menu").css("top", h_navtool);
1331                            $(".banner_col").css("margin-top", lading_h + h_navtool);
1332                        }, 200);
1333
1334                        $(".arrow_prev").click(() => {
1335                            let menuWidth = $(".lading_menu").outerWidth(true);
1336                            const distance = $(".lading_menu_container").scrollLeft();
1337                            if (distance > 0) {
1338                                if (distance > menuWidth) {
1339                                    const distance2 = distance - menuWidth;
1340                                    let breakFlag = false;
1341                                    let needScroll = 0;
1342                                    liArray.forEach((item, index, arr) => {
1343                                        if (breakFlag) return;
1344                                        if (menuWidth + distance2 - item > 0) {
1345                                            menuWidth -= item;
1346                                            if (menuWidth + distance2 - arr[index + 1] > 0) {
1347                                                needScroll += item;
1348                                            }
1349                                        } else {
1350                                            breakFlag = true;
1351                                        }
1352                                    });
1353                                    $(".lading_menu_container").animate(
1354                                        {
1355                                            scrollLeft: needScroll,
1356                                        },
1357                                        0
1358                                    );
1359                                } else {
1360                                    $(".lading_menu_container").animate(
1361                                        {
1362                                            scrollLeft: 0,
1363                                        },
1364                                        0
1365                                    );
1366                                }
1367                            }
1368                        });
1369                        $(".arrow_next").click(() => {
1370                            let menuWidth = $(".lading_menu").outerWidth(true);
1371                            const distance = $(".lading_menu_container").scrollLeft();
1372                            let breakFlag = false;
1373                            let needScroll = 0;
1374                            liArray.forEach((item, index, arr) => {
1375                                if (breakFlag) return;
1376                                if (menuWidth + distance - item > 0) {
1377                                    menuWidth -= item;
1378                                    // 如果下一次的距離比menuWidth大 就不要再加了
1379                                    if (menuWidth + distance - arr[index + 1] > 0) {
1380                                        needScroll += item;
1381                                    }
1382                                } else {
1383                                    breakFlag = true;
1384                                }
1385                            });
1386                            $(".lading_menu_container").animate(
1387                                {
1388                                    scrollLeft: needScroll,
1389                                },
1390                                0
1391                            );
1392                        });
1393                        $(".lading_logo").on("click", (e) => {
1394                            e.preventDefault();
1395                            $("html, body").stop().animate(
1396                                {
1397                                    scrollTop: 0,
1398                                },
1399                                600
1400                            );
1401                        });
1402                    }, 250)
1403                )
1404                .trigger("resize");
1405        }
1406
1407        // 選單項目過多時切換漢堡選單功能
1408        function menuTextCalc() {
1409            let overHeight = false;
1410
1411            $(".meninmenu > li > a, .meninmenu > li > .gtut_first_menu_div").each(function () {
1412                let $element = $(this);
1413                let h = Math.floor($element.height());
1414                let fz = Math.floor(parseFloat($element.css("font-size")));
1415                let lh = Math.floor(parseFloat($element.css("line-height")));
1416                // 檢查高度是否超出允許範圍
1417                let isFixedLineHeight = lh > fz;
1418                let maxAllowedHeight = isFixedLineHeight ? lh : fz * 2;
1419
1420                if (h > maxAllowedHeight * 1.01) {
1421                    overHeight = true;
1422                    return false; // 提早退出遍歷,因為已確定條件成立
1423                }
1424            });
1425            $(".gtut_main_menu_wrap").toggleClass("gtut_menu_gotop", overHeight);
1426            $(".gtut_hamburger_btn").css("display", overHeight ? "flex" : "none");
1427            BannerTop();
1428        }
1429        $(window)
1430            .on(
1431                "resize",
1432                debounce(() => {
1433                    let barw = window.innerWidth - document.documentElement.clientWidth;
1434                    let initWindowWidth = $(window).innerWidth() + barw;
1435                    if (initWindowWidth > 1199) {
1436                        menuTextCalc();
1437                    } else {
1438                        $(".gtut_hamburger_btn").css("display", "flex");
1439                    }
1440                }, 350)
1441            )
1442            .trigger("resize");
1443
1444        $(".row-in-gtutblock").each((i, o) => {
1445            const hasColor = $(o).data("has-bg-color") || 0;
1446            const hasImg = $(o).data("has-bg-image") || 0;
1447            const color = $(o).data("bg");
1448            const bg_img = $(o).data("image");
1449
1450            // 檢查是否有背景圖片或顏色,並加上.bg_div類別
1451            if (hasColor || hasImg) {
1452                const para = document.createElement("div");
1453                $(para).addClass("bg_div");
1454
1455                // 如果有背景圖片,則設定背景圖片及其他屬性
1456                if (bg_img && hasImg) {
1457                    $(para).css("background-image", `url(${bg_img})`);
1458                    const bg_repeat = $(o).data("bg-repeat");
1459                    const bg_position = $(o).data("bg-position");
1460                    const bg_size = $(o).data("bg-size");
1461                    // 設置背景屬性(如果有對應的值)
1462                    if (bg_repeat) {
1463                        $(para).css("background-repeat", bg_repeat);
1464                    }
1465                    if (bg_position) {
1466                        $(para).css("background-position", bg_position);
1467                    }
1468                    if (bg_size) {
1469                        $(para).css("background-size", bg_size);
1470                    }
1471                }
1472
1473                // 如果有背景顏色,則設定背景顏色
1474                if (color && hasColor) {
1475                    $(para).css("background-color", color);
1476                }
1477
1478                // 把 para 加入到區塊中
1479                $(o).prepend($(para));
1480            }
1481            // 內容區塊內有 .content_bg 的,將 data-bg 顏色加到 style 內
1482            let bg = $(o).find(".content_bg");
1483            if (bg.length >= 1) {
1484                for (let index = 0; index < bg.length; index++) {
1485                    const el = bg[index];
1486                    const hasColor2 = $(el).data("has-bg-color") || 0;
1487                    const hasImg2 = $(el).data("has-bg-image") || 0;
1488                    const color = $(el).data("bg");
1489                    const bg_img = $(el).data("image");
1490                    if (hasColor2 || hasImg2) {
1491                        if (bg_img && hasImg2) {
1492                            $(el).css("background-image", `url(${bg_img})`);
1493                            const bg_repeat = $(el).data("bg-repeat");
1494                            const bg_position = $(el).data("bg-position");
1495                            const bg_size = $(el).data("bg-size");
1496                            // 設置背景屬性(如果有對應的值)
1497                            if (bg_repeat) {
1498                                $(el).css("background-repeat", bg_repeat);
1499                            }
1500                            if (bg_position) {
1501                                $(el).css("background-position", bg_position);
1502                            }
1503                            if (bg_size) {
1504                                $(el).css("background-size", bg_size);
1505                            }
1506                        }
1507
1508                        // 如果有背景顏色,則設定背景顏色
1509                        if (color && hasColor2) {
1510                            $(el).css("background-color", color);
1511                        }
1512                    }
1513                }
1514            }
1515            // 內容區塊內有 .content_bg_parent 的,將 data-bg 顏色加到小孩 bg、icon 的 style 內
1516            let bgParent = $(o)
1517                .find(".content_bg_parent")
1518                .find(
1519                    ".bg, .icon, .label ,.white_card ,.card , .bg_img_block, .recommen03_inner .right_side,.bg_img,.text_bg,.gtut_image_carousel05 .comment_block"
1520                );
1521            if (bgParent.length >= 1) {
1522                for (let index = 0; index < bgParent.length; index++) {
1523                    const el = bgParent[index];
1524                    const hasColor3 = $(el).parents(".content_bg_parent").data("has-bg-color") || 0;
1525                    const hasImg3 = $(el).parents(".content_bg_parent").data("has-bg-image") || 0;
1526                    const color = $(el).parents(".content_bg_parent").data("bg");
1527                    const bg_img = $(el).parents(".content_bg_parent").data("image");
1528                    if (hasColor3 > 0 || hasImg3 > 0) {
1529                        if (hasImg3 > 0) {
1530                            $(el).css("background-image", `url(${bg_img})`);
1531                            const bg_repeat = $(el).parents(".content_bg_parent").data("bg-repeat");
1532                            const bg_position = $(el).parents(".content_bg_parent").data("bg-position");
1533                            const bg_size = $(el).parents(".content_bg_parent").data("bg-size");
1534                            // 設置背景屬性(如果有對應的值)
1535                            if (bg_repeat) {
1536                                $(el).css("background-repeat", bg_repeat);
1537                            }
1538                            if (bg_position) {
1539                                $(el).css("background-position", bg_position);
1540                            }
1541                            if (bg_size) {
1542                                $(el).css("background-size", bg_size);
1543                            }
1544                        }
1545                        // 如果有背景顏色,則設定背景顏色
1546                        if (hasColor3 > 0) {
1547                            $(el).css("background-color", color);
1548                        }
1549                    }
1550                }
1551            }
1552        });
1553        if ($(".container_content_has_sidebar").length > 0) {
1554            $(".bg_div , .bg").each((i, o) => {
1555                $(o).parents(".container_content_has_sidebar").addClass("has_sidebar_padding");
1556            });
1557        }
1558        // 一頁式商店
1559        // 重點頁模組
1560        function hasItem(item) {
1561            if (item.length > 0) {
1562                return true;
1563            }
1564            return false;
1565        }
1566
1567        function transformVideoId(id) {
1568            const youtubeVideoIdLength = 11;
1569            let newId = "";
1570            if (id.length <= youtubeVideoIdLength) {
1571                return id;
1572            }
1573            if (id.indexOf("watch?v=") > 0) {
1574                newId = id.substr(id.indexOf("watch?v=") + 8, youtubeVideoIdLength);
1575            } else if (id.indexOf("youtu.be/") > 0) {
1576                newId = id.substr(id.indexOf("youtu.be/") + 9, youtubeVideoIdLength);
1577            } else if (id.indexOf("/embed/") > 0) {
1578                newId = id.substr(id.indexOf("/embed/") + 7, youtubeVideoIdLength);
1579            } else {
1580                newId = id.substr(id.lastIndexOf("/") + 1, id.length);
1581                if (newId.length > youtubeVideoIdLength) {
1582                    newId = newId.substr(0, youtubeVideoIdLength);
1583                }
1584            }
1585            return newId;
1586        }
1587        if (hasItem($(".gtut_keypoint_page_video01 ,.gtut_keypoint_page_video02, .gtut_keypoint_page_video03"))) {
1588            /*= ============ youtube Toggler ============== */
1589            $(".gtut_keypoint_page_video01 ,.gtut_keypoint_page_video02,.gtut_keypoint_page_video03")
1590                .find(".image")
1591                .on("click", function (e) {
1592                    const src = $(this).find("img").attr("longdesc");
1593                    if (src == undefined) {
1594                        src = $(this).attr("data-theVideo");
1595                    }
1596                    const id = transformVideoId(src);
1597                    const url = `https://www.youtube.com/embed/${id}`;
1598                    $(".video_box").addClass("show");
1599                    $(".video_box iframe").attr("src", url);
1600                    $(".video_box .close").on("click", () => {
1601                        $(".video_box iframe").attr("src", url);
1602                        $(".video_box").removeClass("show");
1603                    });
1604                });
1605        }
1606        if (hasItem($(".gtut_keypoint_page_video02"))) {
1607            $(".item_list .thumb_image").on("click", function (e) {
1608                $(".item_list .thumb_image").removeClass("active");
1609                $(this).addClass("active");
1610                let src = $(this).find("img").attr("longdesc");
1611                if (src == undefined) {
1612                    src = $(this).attr("data-theVideo");
1613                }
1614                $(".gtut_keypoint_page_video02 .image img").attr("longdesc", src);
1615                $(".gtut_keypoint_page_video02 .image img").attr("src", $(this).find("img").attr("src"));
1616            });
1617        }
1618        if (hasItem($(".table_mobile"))) {
1619            $(".table_mobile").each(function () {
1620                const table = this;
1621                let text;
1622                $(table)
1623                    .find("th")
1624                    .each((index, item) => {
1625                        text = $(item).text().trim();
1626                        $(table)
1627                            .find("tr")
1628                            .find(`td:nth-child(${index + 1})`)
1629                            .each((i, it) => {
1630                                $(it).attr("data-th", text);
1631                            });
1632                    });
1633            });
1634        }
1635        if (hasItem($(".gtut_keypoint_page_logo02"))) {
1636            const marqueeLogoGroup = $(".logo_group").first().width() * -1;
1637            const marqueeTextGroup = $(".marquee_text_group span").first().width();
1638            const durationTime = $(".logo_group span").length * 4;
1639            $(".logo_group img").each(function () {
1640                var $img = $(this);
1641                var dataSrc = $img.attr("data-src");
1642                if (dataSrc) {
1643                    $img.attr("src", dataSrc);
1644                }
1645            });
1646            $(".marquee_logo_group").append($(".logo_group").first().clone(true));
1647            const marqueeLogoGroupAn = gsap.to(".marquee_logo_group", {
1648                duration: durationTime,
1649                x: marqueeLogoGroup,
1650                repeat: -1,
1651                ease: Power0.easeNone,
1652            });
1653            marqueeLogoGroupAn.play();
1654            const marqueeTextGroupAn = gsap.to(".marquee_text_group", {
1655                duration: 50,
1656                x: marqueeTextGroup,
1657                repeat: -1,
1658                ease: Power0.easeNone,
1659            });
1660            marqueeTextGroupAn.play();
1661            $(".marquee_logo_group").hover(
1662                (e) => {
1663                    marqueeLogoGroupAn.pause();
1664                    e.stopPropagation();
1665                },
1666                (e) => {
1667                    marqueeLogoGroupAn.play();
1668                    e.stopPropagation();
1669                }
1670            );
1671        }
1672
1673        if (hasItem($(".gtut_keypoint_page_slide01_slide"))) {
1674            $(".gtut_keypoint_page_slide01_slide").each(function () {
1675                const that = this;
1676                const id = $(this).attr("id");
1677
1678                const slide = new Swiper(that, {
1679                    slidesPerView: 3,
1680                    centeredSlides: true,
1681                    loop: true,
1682                    speed: 900,
1683                    parallax: true,
1684                    spaceBetween: 20,
1685                    lazy: true,
1686                    navigation: {
1687                        nextEl: `#${id} .swiper-button-next`,
1688                        prevEl: `#${id} .swiper-button-prev`,
1689                    },
1690                    pagination: {
1691                        el: `#${id} .swiper-pagination`,
1692                        type: "fraction",
1693                    },
1694                    on: {
1695                        init() {
1696                            setTimeout(() => {
1697                                const h = $(that).find(".swiper-slide-active").find(".slide_inner")[0].offsetHeight;
1698                                $(that).find(".swiper-wrapper").css("height", h);
1699                            }, 600);
1700                        },
1701                        resize() {
1702                            setTimeout(() => {
1703                                const h = $(that).find(".swiper-slide-active").find(".slide_inner")[0].offsetHeight;
1704                                $(that).find(".swiper-wrapper").css("height", h);
1705                            }, 600);
1706                        },
1707                    },
1708                    breakpoints: {
1709                        0: {
1710                            noSwiping: false,
1711                        },
1712                        320: {
1713                            noSwiping: false,
1714                            slidesPerView: 1,
1715                            centeredSlides: false,
1716                        },
1717                        576: {
1718                            noSwiping: true,
1719                        },
1720                        768: {
1721                            slidesPerView: 2,
1722                            centeredSlides: false,
1723                        },
1724                        991: {
1725                            slidesPerView: 3,
1726                            centeredSlides: true,
1727                        },
1728                    },
1729                });
1730            });
1731        }
1732
1733        if (hasItem($(".gtut_keypoint_page_slide02_slide_01")) && hasItem($(".gtut_keypoint_page_slide02_slide_02"))) {
1734            $(".gtut_keypoint_page_slide02_slide_01").each(function (i, o) {
1735                const that = this;
1736                const id = $(this).attr("id");
1737                // 找到爸爸,再找到兄弟id
1738                const father = $(this).parents(".gtut_keypoint_page_slide02").attr("id");
1739                const brother = $(this)
1740                    .parents(".gtut_keypoint_page_slide02")
1741                    .find(".gtut_keypoint_page_slide02_slide_02");
1742                const slide02_2 = new Swiper($(brother)[0], {
1743                    effect: "fade",
1744                    loop: true,
1745                    lazy: true,
1746                });
1747                const slide02_1 = new Swiper(that, {
1748                    loop: true, // 循环模式选项
1749                    speed: 900,
1750                    spaceBetween: 20,
1751                    lazy: true,
1752                    controller: {
1753                        control: slide02_2,
1754                    },
1755                    // 如果需要前进后退按钮
1756                    navigation: {
1757                        nextEl: `#${father} .swiper-button-next`,
1758                        prevEl: `#${father} .swiper-button-prev`,
1759                    },
1760                    breakpoints: {
1761                        0: {
1762                            noSwiping: false,
1763                        },
1764                        576: {
1765                            noSwiping: true,
1766                        },
1767                    },
1768                });
1769                slide02_1.controller.control = slide02_2;
1770                slide02_2.controller.control = slide02_1;
1771            });
1772        }
1773        if (hasItem($(".gtut_keypoint_page_slide04_slide"))) {
1774            $(".gtut_keypoint_page_slide04_slide").each(function (i, o) {
1775                const that = this;
1776                const id = $(this).attr("id");
1777                const slide04 = new Swiper(that, {
1778                    loop: true, // 循环模式选项
1779                    speed: 900,
1780                    parallax: true,
1781                    spaceBetween: 100,
1782                    lazy: true,
1783                    // 如果需要前进后退按钮
1784                    navigation: {
1785                        nextEl: `#${id} .swiper-button-next`,
1786                        prevEl: `#${id} .swiper-button-prev`,
1787                    },
1788                    pagination: {
1789                        el: `#${id} .swiper-pagination`,
1790                        type: "fraction",
1791                    },
1792                    breakpoints: {
1793                        0: {
1794                            noSwiping: false,
1795                        },
1796                        576: {
1797                            noSwiping: true,
1798                        },
1799                    },
1800                });
1801            });
1802        }
1803        if (hasItem($(".gtut_keypoint_page_slide06_slide"))) {
1804            $(".gtut_keypoint_page_slide06_slide").each(function (i, o) {
1805                const that = this;
1806                const id = $(this).attr("id");
1807                const father = $(this).parents(".gtut_keypoint_page_slide06").attr("id");
1808                const slide06 = new Swiper(that, {
1809                    slidesPerView: 1,
1810                    spaceBetween: 40,
1811                    lazy: true,
1812                    loop: true, // 循环模式选项
1813                    speed: 900,
1814                    // 如果需要前进后退按钮
1815                    navigation: {
1816                        nextEl: `#${father} .swiper-button-next`,
1817                        prevEl: `#${father} .swiper-button-prev`,
1818                    },
1819                    pagination: {
1820                        el: `#${father} .swiper-pagination`,
1821                        type: "fraction",
1822                    },
1823                    breakpoints: {
1824                        0: {
1825                            noSwiping: false,
1826                        },
1827                        576: {
1828                            noSwiping: true,
1829                        },
1830                        991: {
1831                            slidesPerView: 2,
1832                            spaceBetween: 0,
1833                        },
1834                    },
1835                });
1836            });
1837        }
1838        if (hasItem($(".gtut_keypoint_page_recommen01_slide"))) {
1839            $(".gtut_keypoint_page_recommen01_slide").each(function (i, o) {
1840                const that = this;
1841                const id = $(this).attr("id");
1842                const father = $(this).parents(".gtut_keypoint_page_recommen01").attr("id");
1843                const recommen01 = new Swiper(that, {
1844                    slidesPerView: 1,
1845                    spaceBetween: 20,
1846                    lazy: true,
1847                    loop: true, // 循环模式选项
1848                    speed: 900,
1849                    pagination: {
1850                        el: `#${father} .swiper-pagination`,
1851                    },
1852
1853                    breakpoints: {
1854                        0: {
1855                            noSwiping: false,
1856                        },
1857                        320: {
1858                            slidesPerView: 1,
1859                        },
1860                        768: {
1861                            slidesPerView: 2,
1862                        },
1863                        991: {
1864                            slidesPerView: 3,
1865                        },
1866                        1280: {
1867                            slidesPerView: 4,
1868                        },
1869                    },
1870                });
1871            });
1872        }
1873
1874        // 重點頁模組
1875
1876        // 加購選項btn
1877        $(".product_additional_ption_more_btn").on("click", () => {
1878            $(".hide_white").addClass("showAll");
1879        });
1880        // 加購選項btn
1881
1882        (function fullSubMenu() {
1883            function updateSubMenu() {
1884                let out_menu_height = $("#wn__header").outerHeight();
1885                if ($(".version_menu_03").length > 0) {
1886                    out_menu_height = $(".gtut_menu_inner").outerHeight();
1887                }
1888                if ($(".version_menu_04").length > 0) {
1889                    out_menu_height = $(".gtut_main_menu_wrap").outerHeight();
1890                }
1891
1892                $("li.full_submenu_first").removeClass("can_hover");
1893                $("li.full_submenu_first").each(function () {
1894                    const w = $(window).innerWidth();
1895                    const offsetX = $(this).offset().left;
1896                    const area = this.getBoundingClientRect();
1897                    const sub_menu_top = $(this).outerHeight();
1898                    const h = $(window).height();
1899                    const menu_height = "30vh";
1900
1901                    $(this).children(".full_submenu").css({
1902         
1902               width: w,
1903                        left: -offsetX,
1904                        top: out_menu_height,
1905                        "min-height": menu_height,
1906                    });
1907                });
1908
1909                $("li.full_submenu_first").addClass("can_hover");
1910            }
1911
1912            // 頁面加載後立即執行
1913            setTimeout(() => {
1914                updateSubMenu();
1915            }, 200);
1916
1917            // RWD 觸發時,監聽視窗尺寸變動,並加上 debounce
1918            $(window).on("resize", debounce(updateSubMenu, 550));
1919
1920            // 監聽 is-sticky 類別變化,觸發一次
1921            const targetNode = document.body;
1922            const observer = new MutationObserver(function (mutationsList) {
1923                mutationsList.forEach((mutation) => {
1924                    if (mutation.type === "attributes" && mutation.attributeName === "class") {
1925                        if ($("body").hasClass("is-sticky")) {
1926                            setTimeout(updateSubMenu, 700);
1927                        } else {
1928                            setTimeout(updateSubMenu, 700);
1929                        }
1930                    }
1931                });
1932            });
1933
1934            const config = { attributes: true };
1935            observer.observe(targetNode, config);
1936        })();
1937
1938        function loadScript(url, callback, callbackError) {
1939            // 檢查是否已經載入過相同的 URL
1940            let existingScript = document.querySelector('script[src="' + url + '"]');
1941            if (existingScript) {
1942                // 如果已經存在,直接執行 callback
1943                callback();
1944                return;
1945            }
1946
1947            // 建立新的 <script> 元素
1948            let script = document.createElement("script");
1949            script.type = "text/javascript";
1950            script.src = url;
1951
1952            // 設定載入完成的回調函式
1953            script.onload = function () {
1954                callback();
1955            };
1956
1957            // 設定載入失敗的回調函式
1958            script.onerror = function (error) {
1959                if (null !== callbackError) callbackError(error);
1960            };
1961
1962            // 將 <script> 加入到 <head> 中
1963            document.getElementsByTagName("head")[0].appendChild(script);
1964        }
1965        // version_banner_01 yt影片撥放
1966        if (hasItem($(".version_banner_01"))) {
1967            let played = false;
1968            if (played) {
1969                return false;
1970            } else {
1971                let versionTextElement = $(".version_banner_01");
1972                let isVisible = versionTextElement.offset().top < $(this).scrollTop() + $(window).height() + 200;
1973                if (isVisible) {
1974                    loadScript("/assets/frontend/javascript/plugins/gtut_youtube_banner_player.js", function () {
1975                        const player = new gtutYoutubeBannerPlayer(".version_banner_01_1", "gtut_yt_player_1", {
1976                            //預設影片自動撥放、無限循環、使用封面圖
1977                            useCoverImg: true, //是否使用影片封面圖,true:需在yotubue上傳封面圖或後台上傳封面圖片
1978                            autoPlay: true, //打開後會自動撥放
1979                            loop: true, //關閉後會出現影片控制項
1980                            bleed: true, //打開後影片會放大20%(出血),僅在autoplay跟loop都是true的情境才生效
1981                        });
1982                    });
1983                    played = true;
1984                }
1985            }
1986        }
1987
1988        // version_text_07 yt影片撥放
1989        if (hasItem($(".version_text_07"))) {
1990            let played = false;
1991            $(window).on(
1992                "scroll",
1993                debounce(() => {
1994                    if (played) {
1995                        return false;
1996                    } else {
1997                        let versionTextElement = $(".version_text_07");
1998                        let isVisible =
1999                            versionTextElement.offset().top < $(this).scrollTop() + $(window).height() + 200;
2000                        if (isVisible) {
2001                            loadScript(
2002                                "/assets/frontend/javascript/plugins/gtut_youtube_player_text07.js",
2003                                function () {
2004                                    const player = new GtutYoutubeText07Player(
2005                                        ".version_text_07_1",
2006                                        "gtut_yt_text_player7_1"
2007                                    );
2008                                }
2009                            );
2010                            played = true;
2011                        }
2012                    }
2013                }, 350)
2014            );
2015
2016            $(window)
2017                .on(
2018                    "resize",
2019                    debounce(() => {
2020                        if ($(window).innerWidth() > 991) {
2021                            let h = $(".version_text_07").innerHeight();
2022                            let h2 = $(".version_text_07 .bg_video").innerHeight();
2023                            let tp = ((h2 - h) / 2) * -1;
2024                            $(".version_text_07 .bg_video").css("top", tp);
2025                            $(".version_text_07 .version_text_yt_overlay").removeClass("mobile_overlay");
2026                        } else {
2027                            $(".version_text_07 .version_text_yt_overlay").addClass("mobile_overlay");
2028                            $(".version_text_07 .bg_video").css("top", 0);
2029                        }
2030                    }, 350)
2031                )
2032                .trigger("resize");
2033        }
2034
2035        if (hasItem($(".version_text_08"))) {
2036            let played = false;
2037            $(window).on(
2038                "scroll",
2039                debounce(() => {
2040                    if (played) {
2041                        return false;
2042                    } else {
2043                        let versionTextElement = $(".version_text_08_1");
2044                        let isVisible =
2045                            versionTextElement.offset().top < $(this).scrollTop() + $(window).height() + 200;
2046                        if (isVisible) {
2047                            loadScript(
2048                                "/assets/frontend/javascript/plugins/gtut_youtube_player_text08.js",
2049                                function () {
2050                                    const player = new GtutYoutubeText08Player(
2051                                        ".version_text_08_1",
2052                                        "gtut_yt_text_player8_1"
2053                                    );
2054                                }
2055                            );
2056                            played = true;
2057                        }
2058                    }
2059                }, 350)
2060            );
2061        }
2062
2063        function photo_25_yt() {
2064            if ($(".version_photo_25 iframe , .version_photo_05 iframe").length) {
2065                let list = document.querySelectorAll(".version_photo_25 ,.version_photo_05");
2066                list.forEach((i) => {
2067                    let $iframe = $(i).find("iframe");
2068                    let $dataVideo = $iframe.data("src");
2069                    const youtubeVideoIdLength = 11;
2070                    let newId = "";
2071                    if ($dataVideo.length <= youtubeVideoIdLength) {
2072                        return $dataVideo;
2073                    }
2074                    if ($dataVideo.indexOf("watch?v=") > 0) {
2075                        newId = $dataVideo.substr($dataVideo.indexOf("watch?v=") + 8, youtubeVideoIdLength);
2076                    } else if ($dataVideo.indexOf("youtu.be/") > 0) {
2077                        newId = $dataVideo.substr($dataVideo.indexOf("youtu.be/") + 9, youtubeVideoIdLength);
2078                    } else if ($dataVideo.indexOf("/embed/") > 0) {
2079                        newId = $dataVideo.substr($dataVideo.indexOf("/embed/") + 7, youtubeVideoIdLength);
2080                    } else {
2081                        newId = $dataVideo.substr($dataVideo.lastIndexOf("/") + 1, $dataVideo.length);
2082                        if (newId.length > youtubeVideoIdLength) {
2083                            newId = newId.substr(0, youtubeVideoIdLength);
2084                        }
2085                    }
2086                    let defaultiIframe = "https://www.youtube.com/embed/" + newId + "?rel=0";
2087                    $iframe.attr("data-src", defaultiIframe);
2088                    $iframe.addClass("lazyload");
2089                    window.lazyLoad.update();
2090                });
2091            } else {
2092                return false;
2093            }
2094        }
2095        photo_25_yt();
2096
2097        function fastTagsTop() {
2098            const headerH = $("#wn__header").height();
2099            $(".gtut_full_width_search_box").css("top", headerH);
2100        }
2101
2102        fastTagsTop();
2103        $(window).on("resize", function () {
2104            fastTagsTop();
2105        });
2106
2107        // 重點頁QA模組
2108        if (hasItem($(".gtut_keypoint_page_qanda01"))) {
2109            var questions = document.querySelectorAll(".qaitem .q");
2110
2111            // 為每個問題元素添加點擊事件監聽器
2112            questions.forEach(function (question) {
2113                question.addEventListener("click", function () {
2114                    var qaItem = this.parentElement;
2115
2116                    // 切換open類別之前,動態調整max-height以實現平滑展開
2117                    var answer = qaItem.querySelector(".a");
2118                    if (qaItem.classList.contains("open")) {
2119                        // 如果已經是展開狀態,則在移除open類之前設置max-height
2120                        // answer.style.maxHeight = answer.scrollHeight + "px";
2121                        window.setTimeout(() => {
2122                            qaItem.classList.toggle("open");
2123                        }, 10); // 延遲切換以允許max-height生效
2124                    } else {
2125                        // 首次展開,需要先切換open,然後設置max-height以達到過渡效果
2126                        qaItem.classList.toggle("open");
2127                        // answer.style.maxHeight = answer.scrollHeight + "px";
2128                    }
2129
2130                    // 當動畫完成後,如果是收起狀態,則移除max-height設定,以便於下一次計算
2131                    window.setTimeout(() => {
2132                        if (!qaItem.classList.contains("open")) {
2133                            // answer.style.maxHeight = "";
2134                        }
2135                    }, 50); // 這裡的延遲時間應該與CSS中的過渡時間相匹配
2136                });
2137            });
2138        }
2139
2140        //產品頁籤手勢
2141        if (hasItem($(".pro_details_nav"))) {
2142            if (!sessionStorage.getItem("gtut_tab_gesture_shown")) {
2143                function gestureFadeOut() {
2144                    $(".gtut_tab_gesture").fadeOut();
2145                }
2146                document.querySelector(".pro_details_nav").addEventListener("mousemove", gestureFadeOut);
2147                document.querySelector(".pro_details_nav").addEventListener("touchmove", gestureFadeOut);
2148
2149                if ($(".gtut_tab_gesture").length > 0) {
2150                    const gtut_tab_gesture = $(".gtut_tab_gesture");
2151                    if (window.innerWidth < 991) {
2152                        gtut_tab_gesture.addClass("open");
2153                    } else {
2154                        gtut_tab_gesture.removeClass("open");
2155                    }
2156
2157                    $(window).resize(function () {
2158                        if (window.innerWidth < 991) {
2159                            gtut_tab_gesture.addClass("open");
2160                        } else {
2161                            gtut_tab_gesture.removeClass("open");
2162                        }
2163                    });
2164                }
2165
2166                // 記錄 sessionStorage
2167                sessionStorage.setItem("gtut_tab_gesture_shown", "true");
2168            }
2169        }
2170        if (hasItem($(".ladingpage_anchor_menu"))) {
2171            //若有.ladingpage_anchor_menu的頁面進入後執行swiper的lazy.load方法
2172            let allSwiper = document.querySelectorAll(".swiper");
2173            allSwiper.forEach((item, i) => {
2174                // item.swiper.lazy.load()
2175                $(item)
2176                    .find("img")
2177                    .each(function (index, img) {
2178                        let $img = $(img);
2179                        let src = img.getAttribute("data-src");
2180                        $img.attr("src", src);
2181                    });
2182            });
2183            //等swiper圖片載入完畢後加入.can_anchor使錨點可作用
2184            const anchors = document.querySelectorAll(".ladingpage_anchor_menu");
2185            window.addEventListener("load", function () {
2186                anchors.forEach((anchor) => {
2187                    anchor.classList.add("can_anchor");
2188                });
2189            });
2190
2191            let firstClick = true;
2192            let hock = "";
2193            function scrollToAnchor() {
2194                let h_navtool = $("#wn__header").outerHeight(true) || 0; // 判斷高度含magin的間距
2195                let lading_h = $(".lading_menu").outerHeight(true) || 0;
2196                const offset = lading_h + h_navtool;
2197                let thisScroll = $(hock).offset() ? $(hock).offset().top : 0;
2198                $("html, body")
2199                    .stop()
2200                    .animate({ scrollTop: thisScroll - offset }, 600);
2201            }
2202
2203            //點擊ladingpage_anchor_menu執行畫面移至錨點功能
2204            $(".ladingpage_anchor_menu").on("click", function (e) {
2205                e.preventDefault();
2206                hock = $(this).attr("href");
2207                // 如果 href 是 '#' 而且没有其他的 ID,直接返回
2208                if (hock === "#" || hock === "") {
2209                    return;
2210                }
2211                if (firstClick) {
2212                    window.lazyLoad.loadAll();
2213                    firstClick = false;
2214                    let that = this;
2215                    setTimeout(() => {
2216                        $(that).trigger("click");
2217                    }, 300);
2218                } else {
2219                    scrollToAnchor();
2220                }
2221            });
2222        }
2223        //產品頁籤手勢
2224        if (hasItem($(".pro_details_nav"))) {
2225            if (!sessionStorage.getItem("gtut_tab_gesture_shown")) {
2226                function gestureFadeOut() {
2227                    $(".gtut_tab_gesture").fadeOut();
2228                }
2229                document.querySelector(".pro_details_nav").addEventListener("mousemove", gestureFadeOut);
2230                document.querySelector(".pro_details_nav").addEventListener("touchmove", gestureFadeOut);
2231
2232                if ($(".gtut_tab_gesture").length > 0) {
2233                    const gtut_tab_gesture = $(".gtut_tab_gesture");
2234                    if (window.innerWidth < 991) {
2235                        gtut_tab_gesture.addClass("open");
2236                    } else {
2237                        gtut_tab_gesture.removeClass("open");
2238                    }
2239
2240                    $(window).resize(function () {
2241                        if (window.innerWidth < 991) {
2242                            gtut_tab_gesture.addClass("open");
2243                        } else {
2244                            gtut_tab_gesture.removeClass("open");
2245                        }
2246                    });
2247                }
2248
2249                // 記錄 sessionStorage
2250                sessionStorage.setItem("gtut_tab_gesture_shown", "true");
2251            }
2252        }
2253        function openVideoModal(url) {
2254            $(".video_box").addClass("show");
2255            $(".video_box iframe").attr("src", url);
2256            $(".video_box .close").on("click", () => {
2257                $(".video_box iframe").attr("src", url);
2258                $(".video_box").removeClass("show");
2259            });
2260        }
2261        if (hasItem($(".gtut_carousel01"))) {
2262            $(".gtut_carousel01_slide").each(function (index, o) {
2263                let hasYT = $(o).find(".video-container");
2264                let ytPlayerList = [];
2265                if (hasYT) {
2266                    loadScript("https://www.youtube.com/iframe_api", function () {
2267                        setTimeout(() => {
2268                            $(o)
2269                                .find(".video-container")
2270                                .each(function (i, el) {
2271                                    let ytId = transformVideoId($(el).data("video"));
2272                                    let player = $(el).find(".video-iframe");
2273                                    let ytplayer = new YT.Player(player[0], {
2274                                        playerVars: {
2275                                            autoplay: 0,
2276                                            controls: 1,
2277                                            rel: 0,
2278                                            showinfo: 1,
2279                                            playsinline: 1, //在iOS的播放器中全屏播放,0:全屏(默認),1:內嵌
2280                                        },
2281                                        videoId: ytId,
2282                                    });
2283                                    ytPlayerList.push(ytplayer);
2284                                });
2285                        }, 1000);
2286                    });
2287                }
2288                const that = this;
2289                const id = $(this).attr("id");
2290                const father = $(this).parents(".row-in-gtutblock").attr("id");
2291                let loop = true;
2292                if ($(that).find(".swiper-slide").length == 1) {
2293                    loop = false;
2294                    // 隱藏左右箭頭
2295                    $(`#${father} .swiperBtnStyleR, #${father} .swiperBtnStyleL`).hide();
2296                    // 隱藏導航點
2297                    $(`#${father} .swiperPaginationStyle`).hide();
2298                }
2299                const slide01 = new Swiper(that, {
2300                    slidesPerView: 1,
2301                    spaceBetween: 40,
2302                    lazy: {
2303                        loadPrevNext: true,
2304                    },
2305                    loop: loop,
2306                    speed: 900,
2307                    pagination: {
2308                        el: `#${father} .swiperPaginationStyle`,
2309                        clickable: true,
2310                    },
2311                    navigation: {
2312                        nextEl: `#${father} .swiperBtnStyleR`,
2313                        prevEl: `#${father} .swiperBtnStyleL`,
2314                    },
2315                    breakpoints: {
2316                        320: {
2317                            noSwiping: false,
2318                        },
2319                        768: {
2320                            noSwiping: true,
2321                        },
2322                    },
2323                })
2324                    .on("slideChange", function (e) {
2325                        // console.log('e', e.activeIndex, slide01);
2326                        if (hasYT) {
2327                            ytPlayerList.forEach(function (item) {
2328                                item.stopVideo();
2329                            });
2330                        }
2331                    })
2332                    .on("touchStart", function (e) {
2333                        if (hasYT) {
2334                            $(`#${father} iframe`).css("pointer-events", "none");
2335                        }
2336                    })
2337                    .on("touchEnd", function (e) {
2338                        if (hasYT) {
2339                            $(`#${father} iframe`).css("pointer-events", "auto");
2340                        }
2341                    });
2342            });
2343        }
2344
2345        if (hasItem($(".gtut_carousel02"))) {
2346            $(".gtut_carousel02_slide").each(function (index, o) {
2347                let hasYT = $(o).find(".yt_cover");
2348                if (hasYT) {
2349                    $(o)
2350                        .find(".yt_cover")
2351                        .each(function (i, el) {
2352                            let ytId = transformVideoId($(el).data("video"));
2353                            let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2354                            let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2355                            if ($(el).attr("longdesc")) {
2356                                imgUrl = $(el).attr("longdesc");
2357                            }
2358                            $(el).attr("src", imgUrl);
2359
2360                            $(el).on("click", function () {
2361                                openVideoModal(ytUrl);
2362                            });
2363                        });
2364                }
2365                const that = this;
2366                const id = $(this).attr("id");
2367                const father = $(this).parents(".row-in-gtutblock").attr("id");
2368                const granFather = $(this).parents(".container-fluid");
2369                let loop = true;
2370                if ($(that).find(".swiper-slide").length == 1) {
2371                    loop = false;
2372                    // 隱藏左右箭頭
2373                    $(`#${father} .swiperBtnStyleR, #${father} .swiperBtnStyleL`).hide();
2374                    // 隱藏導航點
2375                    $(`#${father} .swiperPaginationStyle`).hide();
2376                }
2377                $(granFather).removeClass("container-fluid").removeClass("custom_container").addClass("fluid_slide");
2378                const slide02 = new Swiper(that, {
2379                    slidesPerView: 1,
2380                    spaceBetween: 40,
2381                    lazy: {
2382                        loadPrevNext: true,
2383                    },
2384                    loop: loop,
2385                    speed: 900,
2386                    pagination: {
2387                        el: `#${father} .swiperPaginationStyle`,
2388                        clickable: true,
2389                    },
2390                    navigation: {
2391                        nextEl: `#${father} .swiperBtnStyleR`,
2392                        prevEl: `#${father} .swiperBtnStyleL`,
2393                    },
2394                    breakpoints: {
2395                        320: {
2396                            noSwiping: false,
2397                        },
2398                        768: {
2399                            noSwiping: true,
2400                        },
2401                    },
2402                });
2403            });
2404        }
2405        if (hasItem($(".gtut_carousel03"))) {
2406            $(".gtut_carousel03_slide").each(function (index, o) {
2407                let hasYT = $(o).find(".yt_cover");
2408                const that = this;
2409                const id = $(this).attr("id");
2410                const father = $(this).parents(".row-in-gtutblock").attr("id");
2411                const slide03 = new Swiper(that, {
2412                    slidesPerView: 2,
2413                    spaceBetween: 20,
2414                    lazy: {
2415                        loadPrevNext: true,
2416                    },
2417                    loop: true,
2418                    speed: 900,
2419                    pagination: {
2420                        el: `#${father} .swiperPaginationStyle`,
2421                        clickable: true,
2422                    },
2423                    navigation: {
2424                        nextEl: `#${father} .swiperBtnStyleR`,
2425                        prevEl: `#${father} .swiperBtnStyleL`,
2426                    },
2427                    breakpoints: {
2428                        320: {
2429                            slidesPerView: 1,
2430                            noSwiping: false,
2431                        },
2432                        768: {
2433                            slidesPerView: 2,
2434                            noSwiping: true,
2435                        },
2436                        991: {
2437                            slidesPerView: 2,
2438                        },
2439                        1280: {
2440                            slidesPerView: 2,
2441                        },
2442                    },
2443                    on: {
2444                        beforeInit() {
2445                            // 請勿把它變成箭頭函式
2446                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2447                        },
2448                        init() {
2449                            if (hasYT) {
2450                                $(o)
2451                                    .find(".yt_cover")
2452                                    .each(function (i, el) {
2453                                        let ytId = transformVideoId($(el).data("video"));
2454                                        let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2455                                        let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2456                                        if ($(el).attr("longdesc")) {
2457                                            imgUrl = $(el).attr("longdesc");
2458                                        }
2459                                        $(el).attr("src", imgUrl);
2460
2461                                        $(el).on("click", function () {
2462                                            openVideoModal(ytUrl);
2463                                        });
2464                                    });
2465                            }
2466                        },
2467                    },
2468                });
2469            });
2470        }
2471        if (hasItem($(".gtut_carousel04"))) {
2472            $(".gtut_carousel04_slide").each(function (index, o) {
2473                let hasYT = $(o).find(".yt_cover");
2474
2475                const that = this;
2476                const id = $(this).attr("id");
2477                const father = $(this).parents(".row-in-gtutblock").attr("id");
2478                const slide04 = new Swiper(that, {
2479                    slidesPerView: 4,
2480                    spaceBetween: 20,
2481                    lazy: {
2482                        loadPrevNext: true,
2483                    },
2484                    loop: true,
2485                    speed: 900,
2486                    pagination: {
2487                        el: `#${father} .swiperPaginationStyle`,
2488                        clickable: true,
2489                    },
2490                    navigation: {
2491                        nextEl: `#${father} .swiperBtnStyleR`,
2492                        prevEl: `#${father} .swiperBtnStyleL`,
2493                    },
2494                    breakpoints: {
2495                        320: {
2496                            slidesPerView: 1,
2497                            noSwiping: false,
2498                        },
2499                        768: {
2500                            slidesPerView: 2,
2501                            noSwiping: true,
2502                        },
2503                        991: {
2504                            slidesPerView: 3,
2505                        },
2506                        1280: {
2507                            slidesPerView: 3,
2508                        },
2509                    },
2510                    on: {
2511                        beforeInit() {
2512                            // 請勿把它變成箭頭函式
2513                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2514                        },
2515                        init() {
2516                            if (hasYT) {
2517                                $(o)
2518                                    .find(".yt_cover")
2519                                    .each(function (i, el) {
2520                                        let ytId = transformVideoId($(el).data("video"));
2521                                        let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2522                                        let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2523                                        if ($(el).attr("longdesc")) {
2524                                            imgUrl = $(el).attr("longdesc");
2525                                        }
2526                                        $(el).attr("src", imgUrl);
2527
2528                                        $(el).on("click", function () {
2529                                            openVideoModal(ytUrl);
2530                                        });
2531                                    });
2532                            }
2533                        },
2534                    },
2535                });
2536            });
2537        }
2538        if (hasItem($(".gtut_carousel05"))) {
2539            $(".gtut_carousel05_slide").each(function (index, o) {
2540                let hasYT = $(o).find(".yt_cover");
2541                const that = this;
2542                const id = $(this).attr("id");
2543                const father = $(this).parents(".row-in-gtutblock").attr("id");
2544                const slide05 = new Swiper(that, {
2545                    slidesPerView: 4,
2546                    spaceBetween: 20,
2547                    centeredSlides: true,
2548                    lazy: {
2549                        loadPrevNext: true,
2550                    },
2551                    loop: true,
2552                    speed: 900,
2553                    pagination: {
2554                        el: `#${father} .swiperPaginationStyle`,
2555                        type: "fraction",
2556                    },
2557                    navigation: {
2558                        nextEl: `#${father} .swiperBtnStyleR`,
2559                        prevEl: `#${father} .swiperBtnStyleL`,
2560                    },
2561                    breakpoints: {
2562                        320: {
2563                            slidesPerView: 1,
2564                            noSwiping: false,
2565                        },
2566                        768: {
2567                            slidesPerView: 2,
2568                            noSwiping: true,
2569                        },
2570                        991: {
2571                            slidesPerView: 3,
2572                        },
2573                        1280: {
2574                            slidesPerView: 3,
2575                        },
2576                    },
2577                    on: {
2578                        beforeInit() {
2579                            // 請勿把它變成箭頭函式
2580                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2581                        },
2582                        init() {
2583                            if (hasYT) {
2584                                $(o)
2585                                    .find(".yt_cover")
2586                                    .each(function (i, el) {
2587                                        let ytId = transformVideoId($(el).data("video"));
2588                                        let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2589                                        let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2590                                        if ($(el).attr("longdesc")) {
2591                                            imgUrl = $(el).attr("longdesc");
2592                                        }
2593                                        $(el).attr("src", imgUrl);
2594
2595                                        $(el).on("click", function () {
2596                                            openVideoModal(ytUrl);
2597                                        });
2598                                    });
2599                            }
2600                        },
2601                    },
2602                });
2603            });
2604        }
2605
2606        if (hasItem($(".gtut_carousel06"))) {
2607            $(".gtut_carousel06_slide").each(function (index, o) {
2608                let hasYT = $(o).find(".yt_cover");
2609                const that = this;
2610                const id = $(this).attr("id");
2611                const father = $(this).parents(".row-in-gtutblock").attr("id");
2612                const slide06 = new Swiper(that, {
2613                    slidesPerView: 4,
2614                    spaceBetween: 20,
2615                    lazy: {
2616                        loadPrevNext: true,
2617                    },
2618                    loop: true,
2619                    speed: 900,
2620                    pagination: {
2621                        el: `#${father} .swiperPaginationStyle`,
2622                        clickable: true,
2623                    },
2624                    navigation: {
2625                        nextEl: `#${father} .swiperBtnStyleR`,
2626                        prevEl: `#${father} .swiperBtnStyleL`,
2627                    },
2628                    breakpoints: {
2629                        320: {
2630                            slidesPerView: 1,
2631                            noSwiping: false,
2632                        },
2633                        768: {
2634                            slidesPerView: 2,
2635                            noSwiping: true,
2636                        },
2637                        991: {
2638                            slidesPerView: 3,
2639                        },
2640                        1280: {
2641                            slidesPerView: 4,
2642                        },
2643                    },
2644                    on: {
2645                        beforeInit() {
2646                            // 請勿把它變成箭頭函式
2647                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2648                        },
2649                        init() {
2650                            if (hasYT) {
2651                                $(o)
2652                                    .find(".yt_cover")
2653                                    .each(function (i, el) {
2654                                        let ytId = transformVideoId($(el).data("video"));
2655                                        let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2656                                        let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2657                                        if ($(el).attr("longdesc")) {
2658                                            imgUrl = $(el).attr("longdesc");
2659                                        }
2660                                        $(el).attr("src", imgUrl);
2661
2662                                        $(el).on("click", function () {
2663                                            openVideoModal(ytUrl);
2664                                        });
2665                                    });
2666                            }
2667                        },
2668                    },
2669                });
2670            });
2671        }
2672        if (hasItem($(".gtut_carousel07"))) {
2673            $(".gtut_carousel07_slide").each(function (index, o) {
2674                let hasYT = $(o).find(".yt_cover");
2675                if (hasYT) {
2676                    $(o)
2677                        .find(".yt_cover")
2678                        .each(function (i, el) {
2679                            let ytId = transformVideoId($(el).data("video"));
2680                            let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2681                            let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2682                            if ($(el).attr("longdesc")) {
2683                                imgUrl = $(el).attr("longdesc");
2684                            }
2685                            $(el).attr("src", imgUrl);
2686
2687                            $(el).on("click", function () {
2688                                openVideoModal(ytUrl);
2689                            });
2690                        });
2691                }
2692                const that = this;
2693                const id = $(this).attr("id");
2694                const father = $(this).parents(".row-in-gtutblock").attr("id");
2695                let loop = true;
2696                if ($(that).find(".swiper-slide").length == 1) {
2697                    loop = false;
2698                    // 隱藏左右箭頭
2699                    $(`#${father} .swiper-button-next, #${father} .swiper-button-prev`).hide();
2700                    // 隱藏導航點
2701                    $(`#${father} .swiper-pagination`).hide();
2702                }
2703                const slide07 = new Swiper(that, {
2704                    slidesPerView: 1,
2705                    spaceBetween: 20,
2706                    lazy: {
2707                        loadPrevNext: true,
2708                    },
2709                    loop: loop,
2710                    speed: 900,
2711                    pagination: {
2712                        el: `#${father} .swiper-pagination`,
2713                        type: "fraction",
2714                    },
2715                    navigation: {
2716                        nextEl: `#${father} .swiper-button-next`,
2717                        prevEl: `#${father} .swiper-button-prev`,
2718                    },
2719                    breakpoints: {
2720                        320: {
2721                            noSwiping: false,
2722                        },
2723                        768: {
2724                            noSwiping: true,
2725                        },
2726                    },
2727                });
2728            });
2729        }
2730        if (hasItem($(".gtut_carousel08"))) {
2731            $(".gtut_carousel08_slide").each(function (index, o) {
2732                let hasYT = $(o).find(".yt_cover");
2733                const that = this;
2734                const id = $(this).attr("id");
2735                const father = $(this).parents(".row-in-gtutblock").attr("id");
2736                const slide07 = new Swiper(that, {
2737                    slidesPerView: 1,
2738                    spaceBetween: 40,
2739                    lazy: {
2740                        loadPrevNext: true,
2741                    },
2742                    loop: true, // 循环模式选项
2743                    speed: 900,
2744                    // 如果需要前进后退按钮
2745                    navigation: {
2746                        nextEl: `#${father} .swiper-button-next`,
2747                        prevEl: `#${father} .swiper-button-prev`,
2748                    },
2749                    pagination: {
2750                        el: `#${father} .swiper-pagination`,
2751                        type: "fraction",
2752                    },
2753                    breakpoints: {
2754                        320: {
2755                            noSwiping: false,
2756                        },
2757                        768: {
2758                            noSwiping: true,
2759                        },
2760                        991: {
2761                            slidesPerView: 2,
2762                            spaceBetween: 0,
2763                        },
2764                    },
2765                    on: {
2766                        beforeInit() {
2767                            // 請勿把它變成箭頭函式
2768                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2769                        },
2770                        init() {
2771                            if (hasYT) {
2772                                $(o)
2773                                    .find(".yt_cover")
2774                                    .each(function (i, el) {
2775                                        let ytId = transformVideoId($(el).data("video"));
2776                                        let imgUrl = `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`;
2777                                        let ytUrl = `https://www.youtube.com/embed/${ytId}?rel=0`;
2778                                        if ($(el).attr("longdesc")) {
2779                                            imgUrl = $(el).attr("longdesc");
2780                                        }
2781                                        $(el).attr("src", imgUrl);
2782
2783                                        $(el).on("click", function () {
2784                                            openVideoModal(ytUrl);
2785                                        });
2786                                    });
2787                            }
2788                        },
2789                    },
2790                });
2791            });
2792        }
2793        if (hasItem($(".gtut_image_carousel01"))) {
2794            $(".gtut_image_carousel01_slide").each(function (i, o) {
2795                const that = this;
2796                const id = $(this).attr("id");
2797                const father = $(this).parents(".row-in-gtutblock").attr("id");
2798                let loop = true;
2799                if ($(that).find(".swiper-slide").length == 1) {
2800                    loop = false;
2801                    // 隱藏左右箭頭
2802                    $(`#${father} .swiperBtnStyleR, #${father} .swiperBtnStyleL`).hide();
2803                    // 隱藏導航點
2804                    $(`#${father} .swiperPaginationStyle`).hide();
2805                }
2806                const slide01 = new Swiper(that, {
2807                    slidesPerView: 1,
2808                    spaceBetween: 40,
2809                    lazy: {
2810                        loadPrevNext: true,
2811                    },
2812                    loop: loop,
2813                    speed: 900,
2814                    pagination: {
2815                        el: `#${father} .swiperPaginationStyle`,
2816                        clickable: true,
2817                    },
2818                    breakpoints: {
2819                        320: {
2820                            noSwiping: false,
2821                        },
2822                        768: {
2823                            noSwiping: true,
2824                        },
2825                    },
2826                });
2827            });
2828        }
2829        if (hasItem($(".gtut_image_carousel02"))) {
2830            $(".gtut_image_carousel02_slide").each(function (i, o) {
2831                const that = this;
2832                const id = $(this).attr("id");
2833                const father = $(this).parents(".row-in-gtutblock").attr("id");
2834                const slide02 = new Swiper(that, {
2835                    slidesPerView: 4,
2836                    spaceBetween: 20,
2837                    lazy: {
2838                        loadPrevNext: true,
2839                    },
2840                    loop: true,
2841                    speed: 900,
2842                    pagination: {
2843                        el: `#${father} .swiperPaginationStyle`,
2844                        clickable: true,
2845                    },
2846                    navigation: {
2847                        nextEl: `#${father} .swiperBtnStyleR`,
2848                        prevEl: `#${father} .swiperBtnStyleL`,
2849                    },
2850                    breakpoints: {
2851                        320: {
2852                            slidesPerView: 2,
2853                            noSwiping: false,
2854                        },
2855                        768: {
2856                            slidesPerView: 2,
2857                            noSwiping: true,
2858                        },
2859                        991: {
2860                            slidesPerView: 3,
2861                        },
2862                        1280: {
2863                            slidesPerView: 4,
2864                        },
2865                    },
2866                    on: {
2867                        beforeInit() {
2868                            // 請勿把它變成箭頭函式
2869                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2870                        },
2871                    },
2872                });
2873            });
2874        }
2875
2876        if (hasItem($(".gtut_image_carousel03"))) {
2877            $(".gtut_image_carousel03_slide").each(function (i, o) {
2878                const that = this;
2879                const id = $(this).attr("id");
2880                const father = $(this).parents(".row-in-gtutblock").attr("id");
2881                const slide02 = new Swiper(that, {
2882                    slidesPerView: 3.5,
2883                    spaceBetween: 20,
2884                    lazy: {
2885                        loadPrevNext: true,
2886                    },
2887                    loop: true,
2888                    speed: 900,
2889                    pagination: {
2890                        el: `#${father} .swiperPaginationStyle`,
2891                        clickable: true,
2892                    },
2893                    breakpoints: {
2894                        320: {
2895                            slidesPerView: 1.6,
2896                            noSwiping: false,
2897                        },
2898                        768: {
2899                            slidesPerView: 2.2,
2900                            noSwiping: true,
2901                        },
2902                        991: {
2903                            slidesPerView: 2.8,
2904                        },
2905                        1280: {
2906                            slidesPerView: 3.5,
2907                        },
2908                    },
2909                    on: {
2910                        beforeInit() {
2911                            // 請勿把它變成箭頭函式
2912                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2913                        },
2914                    },
2915                });
2916            });
2917        }
2918
2919        if (hasItem($(".gtut_image_carousel04"))) {
2920            $(".gtut_image_carousel04_slide").each(function (i, o) {
2921                const that = this;
2922                const id = $(this).attr("id");
2923                const father = $(this).parents(".row-in-gtutblock").attr("id");
2924                const slide02 = new Swiper(that, {
2925                    slidesPerView: 5,
2926                    spaceBetween: 20,
2927                    lazy: {
2928                        loadPrevNext: true,
2929                    },
2930                    loop: true,
2931                    speed: 900,
2932                    pagination: {
2933                        el: `#${father} .swiperPaginationStyle`,
2934                        clickable: true,
2935                    },
2936                    breakpoints: {
2937                        320: {
2938                            slidesPerView: 2,
2939                            noSwiping: false,
2940                        },
2941                        768: {
2942                            slidesPerView: 3,
2943                            noSwiping: true,
2944                        },
2945                        991: {
2946                            slidesPerView: 4,
2947                        },
2948                        1280: {
2949                            slidesPerView: 5,
2950                        },
2951                    },
2952                    on: {
2953                        beforeInit() {
2954                            // 請勿把它變成箭頭函式
2955                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2956                        },
2957                    },
2958                });
2959            });
2960        }
2961        if (hasItem($(".gtut_image_carousel05"))) {
2962            $(".gtut_image_carousel05_slide").each(function (i, o) {
2963                const that = this;
2964                const id = $(this).attr("id");
2965                const father = $(this).parents(".row-in-gtutblock").attr("id");
2966                const gtut_image_carousel05 = new Swiper(that, {
2967                    slidesPerView: 1,
2968                    spaceBetween: 20,
2969                    lazy: true,
2970                    loop: true, // 循环模式选项
2971                    speed: 900,
2972                    pagination: {
2973                        el: `#${father} .swiper-pagination`,
2974                    },
2975
2976                    breakpoints: {
2977                        320: {
2978                            slidesPerView: 1,
2979                            noSwiping: false,
2980                        },
2981                        768: {
2982                            slidesPerView: 2,
2983                            noSwiping: true,
2984                        },
2985                        991: {
2986                            slidesPerView: 3,
2987                        },
2988                        1280: {
2989                            slidesPerView: 4,
2990                        },
2991                    },
2992                    on: {
2993                        beforeInit() {
2994                            // 請勿把它變成箭頭函式
2995                            this.params.loop ? SwiperLoopFix(this) : ""; // 修正 Swiper loop Bug
2996                        },
2997                    },
2998                });
2999                // 計算最高高度並同時應用
3000                let maxHeight = 0;
3001                const slides = $(that).find(".comment_block");
3002
3003                slides
3004                    .each(function () {
3005                        const $slide = $(this);
3006                        const slideHeight = $slide.outerHeight();
3007
3008                        // 更新最高高度
3009                        if (slideHeight > maxHeight) {
3010                            maxHeight = slideHeight;
3011                        }
3012                    })
3013                    .css("min-height", `${maxHeight}px`);
3013 // 在計算完成後,直接套用到所有 Slide
3014            });
3015        }
3016        if (hasItem($(".gtut_image_carousel06"))) {
3017            $(".gtut_image_carousel06_slide").each(function (i, o) {
3018                const that = this;
3019                const id = $(this).attr("id");
3020                const father = $(this).parents(".row-in-gtutblock").attr("id");
3021                let loop = true;
3022                if ($(that).find(".swiper-slide").length == 1) {
3023                    loop = false;
3024                    // 隱藏左右箭頭
3025                    $(`#${father} .swiper-button-next, #${father} .swiper-button-prev`).hide();
3026                    // 隱藏導航點
3027                    $(`#${father} .swiper-pagination`).hide();
3028                }
3029                const slide06 = new Swiper(that, {
3030                    slidesPerView: 1,
3031                    spaceBetween: 100,
3032                    parallax: true,
3033                    lazy: {
3034                        loadPrevNext: true,
3035                    },
3036                    loop: loop,
3037                    speed: 900,
3038                    navigation: {
3039                        nextEl: `#${father} .swiper-button-next`,
3040                        prevEl: `#${father} .swiper-button-prev`,
3041                    },
3042                    pagination: {
3043                        el: `#${father} .swiper-pagination`,
3044                        type: "fraction",
3045                    },
3046                    on: {
3047                        resize: function () {
3048                            let slide_side_w = $(that).parents(".slide_side").width();
3049                            let g_father = $(that).parents(".gtut_keypoint_page_slide04");
3050                            $(g_father).find(".gtut_keypoint_page_slide04_placeholder").width(slide_side_w);
3051                        },
3052                    },
3053                });
3054            });
3055        }
3056        $(".toggleCatalogBtn").on("click", function () {
3057            const $catalog = $(this).parents(".gtut_keypoint_page_mod").find(".catalogindex");
3058            const $icon = $(".catalogToggleIcon");
3059            $($catalog).parents(".gtut_keypoint_page_mod").toggleClass("catalog_closed");
3060            $catalog.slideToggle(300); // 動畫收合/展開
3061        });
3062
3063        $("#dataTable").DataTable();
3064    });
3065})(window, $);

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.