PageSourceSearch

https://www.pololaurenshirts.com/template/js/ak_main.js?v=20231214

js pololaurenshirts.com collected 2026-09-26 12:05:34 UTC 9,156 bytes, 265 lines download raw bytes

1$(function () {
2    // 第二層的tab-swiper
3    if ($(".main-tab-swiper").length > 0) {
4        var tab_swiper = new Swiper(".main-tab-swiper", {
5            slidesPerView: 'auto',
6            slidesPerGroup: 1,
7        });
8
9        // 到指定的slide
10        tab_swiper.slideTo($(".main-tab-swiper .active").index());
11
12        //main-tab-swipe hover
13        $(document).on('mouseover', '.main-tab-swiper h3', function () {
14            handleTabChange($(this));
15        });
16
17        $(document).on('mouseout', '.main-tab-swiper h3', function () {
18            $(this).removeClass('hover-active');
19            $('.tab-indicator').css({
20                width: '0px',
21            });
22        });
23
24        // tab動畫
25        function handleTabChange(tab) {
26            $('.tab-indicator').css({
27                width: tab.outerWidth(),
28                left: tab.position().left + parseInt(tab.css('marginLeft'), 10)
29            });
30            tab.addClass('hover-active');
31            tab.siblings().removeClass('hover-active');
32        }
33
34
35    }
36
37    // application-swiper
38    if ($(".application-swiper").length > 0) {
39        var application_swiper = new Swiper(".application-swiper", {
40            slidesPerView: 'auto',
41            slidesPerGroup: 1,
42            navigation: {
43                nextEl: '.main-application-block .next-btn',
44                prevEl: '.main-application-block .pre-btn',
45            },
46        });
47    }
48
49    // related-swiper
50    if ($(".related-swiper").length > 0) {
51        var related_swiper = new Swiper(".related-swiper", {
52            slidesPerView: 'auto',
53            slidesPerGroup: 1,
54            navigation: {
55                nextEl: '.main-related-info-block .next-btn',
56                prevEl: '.main-related-info-block .pre-btn',
57            },
58        });
59    }
60
61    // 跳窗影片
62    if ($('.popup-video').length > 0) {
63        $('.popup-video').magnificPopup({
64            type: 'iframe',
65            closeOnBgClick: false,
66            //btn無法用CSS覆蓋掉原本X的樣式
67            closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
68            callbacks: {
69                open: function () {
70                    // .load使遮罩隱藏,需有遮罩原因為IOS在影片尚未撥放時會破版
71                    var iframe = document.getElementsByTagName("iframe")[0];
72                    doc = iframe.contentDocument || iframe.contentWindow;
73                    if (doc.document) doc = doc.document;
74
75                    if (iframe.getAttribute("src").indexOf("youtube") > -1) {
76                        // youtube影片無破版問題
77                        $(".mfp-content").addClass("load");
78                    } else {
79                        // <video>在IOS有破版問題
80                        $(".mfp-content").on("click", function () {
81                            $(".mfp-content").addClass("load");
82                        });
83                        var _timer = setInterval(function () {
84
85                            var video = iframe.contentWindow.document.getElementsByTagName("video")[0];
86                            // 使IOS可以自動播放
87                            video.setAttribute("playsinline", "");
88                            video.setAttribute("mute", "");
89                            video.setAttribute("loop", "");
90                            video.play();
91                            if (video.currentTime > 0) {
92                                $(".mfp-content").addClass("load");
93                                clearInterval(_timer);
94                            }
95                        }, 500);
96                    }
97                }
98            }
99        });
100    }
101
102    // 原地播放影片
103    $(".video:not(.popup-video)").click(function (e) {
104        if (!$(this).closest(".video-wrap").hasClass("play")) {
105            $(this).attr("controls", true);
106            $(this).closest(".video-wrap").addClass("play");
107            videoControl(this)
108        }
109    });
110
111    function videoControl(video) {
112        //瀏覽器在影片撥放時,再按一次會使影片暫停,故此處不再多寫暫停的邏輯
113        if (video.paused) {
114            video.play();
115        }
116    }
117
118
119    //目前的裝置
120    var now_device = getDevice();
121    checkMore();
122
123    //resize
124    $(window).resize(function () {
125        now_device = getDevice();
126        checkMore();
127    });
128
129    //more-btn點擊後展開隱藏的內容
130    $(".more-btn").click(function () {
131        $(this).closest(".has-more-block").removeClass("more-unclicked");
132    });
133
134    //取得目前裝置
135    function getDevice() {
136        var device = "";
137        if (window.innerWidth > 1199) {
138            device = "pc";
139        } else if (window.innerWidth > 767) {
140            device = "tb";
141        } else {
142            device = "mb";
143        }
144        return device;
145    }
146
147    //檢查More Btn是否需要出現
148    function checkMore() {
149        var more_btn_block = $(".more-btn-block");
150
151        //手機版以外裝置不顯示
152        if (now_device == "mb") {
153            //不確定是否有可能一次出現多個more-btn於同一頁,故以迴圈方式處理
154            more_btn_block.map(function () {
155                var this_btn_block = $(this);
156                //最外面的父層
157                var this_has_more_block = this_btn_block.closest(".has-more-block");
158
159                // 判斷是否已點擊過more-btn
160                if (!this_has_more_block.hasClass("more-unclicked")) {
161                    // 已點擊過,按鈕隱藏
162                    this_btn_block.addClass("hidden");
163                } else {
164
165                    // 判斷是限制固定高度,還是只秀第一個子項目
166                    if (this_has_more_block.data('max-height') > 0) {
167                        //要限制高度的元素
168                        var this_more_content = this_has_more_block.find(".more-content");
169
170                        var content_h = 0;
171
172                        // 文字高度加總
173                        this_more_content.map(function () {
174                            content_h += $(this).prop("scrollHeight");
175                        });
176
177                        if (content_h > this_has_more_block.data('max-height')) {
178                            //未點擊過,且內容超過data-max-height
179                            this_btn_block.removeClass("hidden");
180                        }
181                    } else {
182                        // 只秀第一個子項目
183                        // 判斷是否超過1個以上的項目
184                        var content_count = this_has_more_block.find(".mb-show-1").children().length;
185
186                        if (content_count > 1) {
187                            //未點擊過,且子項目>1
188                            this_btn_block.removeClass("hidden");
189                        }
190                    }
191                }
192
193
194            });
195        } else {
196            more_btn_block.addClass("hidden");
197        }
198    }
199
200    // 開合事件
201    $(".open-close-item>.title").click(function () {
202        var this_item = $(this).closest(".open-close-item");
203        this_item.toggleClass("open");
204        this_item.find(".content").stop().slideToggle();
205    });
206
207 
208    if ($(".main-sticky-block").length > 0 && !$(".main-sticky-block").hasClass('.tb-clear')) {
209        
210        $("body").addClass("overflow-x-clear");
211    }
212    
213
214
215 stickyTbClear()
216
217$(window).on("resize",debounce(stickyTbClear));
218        
219
220    //left bar 開合
221    if($('.left-bar-type').length > 0){
222        if($('.left-bar-type .left-block > ul > li').hasClass('active')){
223            $('.left-bar-type .left-block ul > li.active > ul').show(0)
224        }
225
226        $('.left-bar-type .left-block > ul > li.has-item').on('click',function(e){
227            e.preventDefault();
228            if($(this).hasClass('active')){
229                $(this).removeClass('active')
230                $(this).find("ul").stop().slideUp("fast");
231            }else{
232                $(this).addClass('active')
233                $(this).find("ul").stop().slideDown("fast");
234            }
235        })
236
237        $('.left-bar-type .left-block ul > li').on('click',function(event){
238          
239            event.stopPropagation();
240        })
241    }
242});
243
244function debounce(fn, delay = 1000) {
245    let timer;
246    return function () {
247        window.clearTimeout(timer);
248        timer = setTimeout(() => {
249            fn.apply(this, arguments);
250            window.clearTimeout(timer);
251        }, delay);
252    }
253}
254
255function stickyTbClear(){
256    var screenWidth = $(window).width();
257    if ($(".main-sticky-block").length > 0 && $(".main-sticky-block").hasClass('tb-clear')) {
258        if(screenWidth < 1199){
259            $("body").removeClass("overflow-x-clear");
260        }else{
261            $("body").addClass("overflow-x-clear");
262        }
263        
264    }
265}

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.