PageSourceSearch

https://www.blackpearl.com.tw/js/custome.js

js blackpearl.com.tw collected 2026-10-08 15:31:17 UTC 43,684 bytes, 1,154 lines download raw bytes

1
2
3//setPoint
4//if has mbPanel.js then setPoint=mbPanel.js config, else set here
5var setPoint=(setPoint==undefined)?786:setPoint;
6
7var mobileType=mobileViewPoint(setPoint);
8function mobileViewPoint(viewPoint){
9    viewPoint=(viewPoint>0)?viewPoint:768;
10    viewPoint='(max-width: '+viewPoint+'px)';
11    viewPoint=window.matchMedia(viewPoint).matches;
12    return viewPoint;
13}
14
15
16
17
18
19$(function() {
20
21
22
23    //===================================================================
24    // header 
25    //===================================================================
26      
27        $(window).on('load resize',function(){
28            if(!$(".header.disabled").length){
29                if($(".header").length){
30                    var headPos=$(".header").offset().top+$(".header").outerHeight();
31                    var headH=$(".header").outerHeight();
32                    var headOver=$(".header").data("overlay");
33                    $("body").css("padding-top",0);
34                    if(headOver!=true || $(".banner").length<1){                            
35                        $("body").css("padding-top",headH);
36                    }
37                }
38            }
39        });
40
41
42
43
44
45        //捲動視窗toggleClass
46        var headerHeight =!$(".header").length?0:$(".header").height();
47        var bannerPosT   =!$(".banner").length?0:$(".banner").offset().top;
48        $(window).scroll(function(){
49            var bannerHeight =($(".slideBanner").length>0)?($(".slideBanner .slideItem").first().height()):($(".banner").height());
50            if($(".headerType4").length>0){bannerHeight+=$(".navMenuBlock").height();}
51            var showScrollHead=(bannerPosT+bannerHeight);
52            if($(window).scrollTop()>showScrollHead){
53                $(".header").addClass("scroll");
54            }else{
55                $(".header").removeClass("scroll");
56            }
57            return false;
58        });
59
60
61        //!!!fix Header navMenu subMenu pos (項目過多 or 超過螢幕時次選單位置)
62
63        if($(".hamburger").css("display")=="none"){  
64
65            $("body").on('mouseenter',".navMenu .moreMenu:not(.multiMenu)",function(){
66
67
68                // console.log("hoverin");  
69
70                var menuViewSpace=40; //不貼邊
71
72                var $subMenu=$(this).children("ul");         
73                var subMenuHeight=$subMenu.height();
74                var subMenuWidth=$subMenu.width();
75                var headerHeight =!$(".header").length?0:$(".header").height();
76                var menuView=$(window).height()-headerHeight-menuViewSpace;
77                var subMenuPosT=$(this).position().top;
78                var subMenuPosL=$(this).parent().offset().left+$(this).parent().width();
79
80
81
82                //選單顯示超過螢幕換左邊 (normal)
83                var menuPosL=$subMenu.offset().left+(subMenuWidth*2);            
84                if(menuPosL>$(window).width()){
85                    $subMenu.css({"transition":"none","left":"-100%","right":"auto"});
86                }
87
88
89
90
91                //超過螢幕高
92                if(subMenuHeight>menuView){
93                    $subMenu.addClass("overEdge");
94                    $subMenu.css({                        
95                        "max-height":menuView,
96                    });
97                }
98
99
100                //上層超過螢幕高
101                if($(this).parent(".overEdge").length){ 
102
103                    // subMenuPosT=$(this).position().top+$(this).parents(".navMenu").height();
104                    subMenuPosT=$(this).position().top+$('header').height();
105                    subMenuPosL-=20;  
106                    subMenuPosB='auto';
107
108                    //次層選單顯示超過螢幕換左邊
109                    if(subMenuPosL+(subMenuWidth*2)>$(window).width()){subMenuPosL=$(this).parent().offset().left-subMenuWidth;}
110
111                    //次層選單顯示超過燭幕高
112                    if((subMenuPosT+subMenuHeight)>$(window).height()){
113                        subMenuPosT='auto';
114                        subMenuPosB=menuViewSpace;
115                    }
116
117                    $subMenu.css({
118                        "position":"fixed",
119                        "top":subMenuPosT,
120                        "bottom":subMenuPosB,
121                        "left":subMenuPosL,
122                        "right":"auto",
123                        "width":subMenuWidth,
124                        "transition":"none",
125                        "z-index":"20",
126
127                    });
128
129
130                }    
131
132                //次選單位置超過螢幕高 (上層沒有超過螢幕高)
133                if($(this).parents(".moreMenu").length && $(this).parent().hasClass('overEdge') == false ){                    
134                    
135                    if((subMenuPosT+subMenuHeight)>menuView){
136                        //次層選單顯示超過螢幕換左邊
137                        if(subMenuPosL+(subMenuWidth*2)>$(window).width()){subMenuPosL=$(this).parent().offset().left-subMenuWidth;}
138
139                        $subMenu.css({
140                            "position":"fixed",
141                            "top":"auto",
142                            "bottom":menuViewSpace,
143                            "left":subMenuPosL,
144                            "right":"auto",
145                            "transition":"none",
146                            "z-index":"20",
147                        });
148                    }                    
149                }
150                
151
152                              
153              }); 
154            $("body").on('mouseleave',".navMenu .moreMenu:not(.multiMenu)",function(){
155                // console.log("hoverout");
156                var $subMenu=$(this).children("ul");
157                 $subMenu.removeClass("overEdge");
158                 $subMenu.attr("style","");
159             });
160
161            // multimenu
162
163                //load or resize fix menu
164                $(window).on('load resize',function(){$(".navMenu .moreMenu.multiMenu").each(function(){fixMultiMenuPos($(this)); $(this).css({'position':'','overflow':''}); }); });
165                //hover to fixmenu
166                $("body").on('mouseenter',".navMenu .moreMenu.multiMenu",function(){fixMultiMenuPos($(this));});
167                $("body").on('mouseleave',".navMenu .moreMenu.multiMenu",function(){$(this).css({'position':'','overflow':''});});
168
169                function fixMultiMenuPos($target){
170
171                    var $tmp_targert=($target.length) ? $target.children("ul") : $(".navMenu .moreMenu.multiMenu>ul");
172                        $tmp_targert.css({'max-width':'none','padding':'1em 0'});
173                        $tmp_targert.children("li").css({'max-width':'none'});                        
174
175                    var tmp_length=$tmp_targert.children("li").length;
176                    var tmp_width=$tmp_targert.children("li").first().outerWidth();               
177
178                    var $tmp_screen = $('.header .navBar');
179                    
180                    //ul寬 = li項目數量 x li寬
181                    tmp_widthSet=(tmp_width*tmp_length);
182                    $tmp_targert.css('width',tmp_widthSet);
183
184
185                    //設定位置對齊在母層左邊
186                    $tmp_targert.closest('.multiMenu').css({'position':'relative','overflow':'visible'});
187                    $tmp_targert.css({'left':'0','right':'0','transform':'none'});
188
189
190                    //超過靠右
191                    if(tmp_widthSet+$tmp_targert.offset().left > $tmp_screen.innerWidth()+$tmp_screen.offset().left){
192                        
193                        $tmp_targert.closest('.multiMenu').css({'position':'','overflow':''});
194                        $tmp_targert.css({'right':'0','left':'auto'});
195                    }
196                    
197                    //置中
198                    if(tmp_widthSet>$tmp_screen.innerWidth()){
199
200                        //如果 > screen width , ul寬 = 最大橫排個數 
201                        tmp_maxitem=Math.floor($tmp_screen.innerWidth() / tmp_width);
202                        tmp_widthSet= (tmp_maxitem*tmp_width);
203                        $tmp_targert.css('width',tmp_widthSet);
204
205                        $tmp_targert.parent('.multiMenu').css({'position':'','overflow':''});
206                        $tmp_targert.css({'right':'','left':'','transform':''});
207
208                        //將子項寬改設為% (避免win捲軸產生斷行)
209                        $tmp_targert.children("li").css('max-width',Math.floor((100/tmp_maxitem)+'%'));
210                    }
211                        
212
213                    //如果 h > window h70% , 寬+32 (有捲軸)
214                    if( ( $tmp_targert.height() > $(window).height()*.8) ){
215                        tmp_widthSet = (tmp_widthSet+32);
216                        $tmp_targert.css('width',tmp_widthSet);
217                    }
218
219
220
221
222
223                    
224                }
225
226
227
228
229            //only for safrai or have slick block
230                function dofixMenuAction() {
231                    var fixMenuAction=false;
232                    if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1){ fixMenuAction=true; }
233                    if($(".slick-slider").length){ fixMenuAction=true;}
234                    return fixMenuAction;
235                }           
236
237                
238                var fixMenu=dofixMenuAction();          
239                if(fixMenu) {
240                    $("body").on('mouseenter',".navMenu .moreMenu:not(.multiMenu)",function(){      
241                           if($(this).parent(".overEdge").length){ 
242                               var $subMenu=$(this).children("ul");
243                               $subMenu.clone().appendTo($(this).parent(".overEdge").parent()).addClass("NavMenuCloneItem");
244                               $subMenu.hide();
245                               return false;
246                           }
247                    });
248                    $("body").on('mouseleave',".navMenu .moreMenu:not(.multiMenu)",function(){
249                           var $subMenu=$(this).children("ul");
250                           if($(this).parent(".overEdge").length){ 
251                                $subMenu.show();
252                               return false;
253                            }
254                    });
255                    $("body").on('mouseenter',".NavMenuCloneItem",function(){
256                        $(this).addClass('over');
257                           $(".NavMenuCloneItem:not(.over)").remove();
258                    });
259                    $("body").on('mouseleave',".NavMenuCloneItem.over",function(){
260                        $(this).remove();
261                    });
262                    $("body").on('mouseenter',".navMenu>li",function(){
263                           $(".NavMenuCloneItem").remove();
264                    });
265                }
266            // end  safrai or have slick block
267            
268
269        }//end fix header navMenu subMenu pos
270
271
272
273
274
275
276
277
278        //hamburger click open menu
279        $(".hamburger").click(function(){$(".hamburger,.navMenu").toggleClass("open");});
280        
281
282        //rwd hamburger & navmenu  (縮放視窗判斷漢堡及選單隱藏)
283        $(window).on('load resize',function(){
284            if($(".hamburger").css("display")=="none"){
285                $(".hamburger,.navMenu").removeClass("open");
286            }
287        });
288
289        
290        //子選單手機版時點擊展開(不直接轉頁)
291        $(".navMenu .moreMenu a,.topLinkMenu .moreMenu a").click(function(){
292            if($(".hamburger").css("display")!="none"){
293                if($(this).siblings("ul").length<1){
294                    window.location.href=$(this).attr("href");
295                }else{
296                    $(this).parent().siblings().find(".open").removeClass("open"); //先關閉其他子選單
297                    $(this).siblings("ul").toggleClass("open");
298                   return false;
299
300                }
301            }
302        });
303        //手機版,點下方選單,上方選單隱藏
304        $(".topLinkMenu .moreMenu a").click(function(){
305             $(".hamburger,.navMenu").removeClass("open");
306        });
307        //手機版,點上方選單,下方選單隱藏
308        $(".hamburger").click(function(){
309             $(".topLinkMenu .moreMenu ul").removeClass("open");
310        });
311
312
313        //手機版,向下捲隱藏選單,向上捲顯示選單
314        var nowPos=0;
315        var tmpPos=0;
316        $(window).on('load resize scroll',function(){
317
318            $(".moreMenu ul").removeClass("open");
319            if(!($(".hamburger").css("display")=="none")){
320                nowPos=$(this).scrollTop();                
321                if(!$(".navMenu").hasClass("open") && nowPos>$(".header").height()){ //上、下選單皆未打開子選單且滾動超過header時才作用
322
323                    if(nowPos>tmpPos){
324                        // console.log("scrolldown");
325                        $(".header").stop().attr("data-scroll","down");
326                        // $(".header").stop().css("top","-100%");
327                        $(".topLink").css("bottom","-100%");
328                    }else{
329                        // console.log("srollup"); 
330                        $(".header").stop().attr("data-scroll","up");
331                        // $(".header").stop().css("top","");
332                        $(".topLink").css("bottom","");
333                    }
334                    tmpPos=nowPos;
335                    
336                }
337            }else{
338                
339                $(".header").attr("data-scroll","");
340                // $(".header").css("top","");
341                $(".topLink").css("bottom","");  
342                
343            }
344
345            return false;
346
347        });
348
349
350        //end Header
351
352
353
354    //===================================================================
355    // banner 
356    //===================================================================
357
358
359        if($(".banner.bgFix").length>0){
360            var bgFixH=$(".banner").height();
361
362            $(".banner.bgFix").css({
363                "transition":"none"
364            });  
365            $(".banner.bgFix img").css({
366                "min-height":bgFixH,
367                "min-width":"100%",
368            }); 
369             
370            function bannerH(nowPos){
371
372                new_bannerH=(nowPos<=0)?bgFixH:bgFixH-nowPos;
373                return new_bannerH;
374            }
375            $(window).scroll(function(){
376                nowPos=$(window).scrollTop();    
377                isScrollBottom = ( ( $(document).innerHeight()-$(window).height() ) - nowPos <= 5);
378                if(!isScrollBottom){
379                    // $(".banner.bgFix").css("height",bannerH(nowPos));
380                }
381                return false;
382            });
383        }  
384
385
386
387    //===================================================================
388    // 設定預設圖 class='itemImg noneImg'
389    //===================================================================
390        $(window).load(function() { 
391
392            $('img').each(function() {
393               imgPath=(typeof imgPath === 'undefined' || !imgPath)?'images/':imgPath;
394               var error = false;
395               var imgType=$(this).attr('src').split('.');
396                   imgType=imgType[imgType.length-1];
397
398               if (!this.complete) {error = true;console.log('complete error');}
399               if (imgType!='svg' && typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) {error = true;console.log('naturalwidth error');}
400               if (imgType=='svg') {
401                        var imgSrc=$(this)[0].src;                                         
402                        // $.get(imgSrc, function(svgxml){
403
404                        //         // console.log( 'svgxml: '+ typeof svgxml );
405                        //         var attrs = svgxml.documentElement.attributes;
406                            
407                        //         // console.log( 'attrs: '+ typeof attrs );
408                        //         // console.log( 'img: '+ attrs.width.value + 'x' + attrs.height.value );
409                        //         thisStatus = attrs.width.value;
410                              
411                                
412
413                        
414                        //     }).fail(function(){
415                        //         console.log('false'+imgSrc);
416                        //         console.log('---'+thisStatus);
417                        //         thisStatus = 'wwww';
418                        //     });
419
420               }
421
422               if(error){
423                    if($(this).parents('.itemImg').length>0){
424                        $(this).parents('.itemImg').addClass('noneImg');
425                    }else{
426                        // $(this).parent().addClass('noneImg');
427                        // $(this).parent().css('height',$(this).parent().outerWidth());
428                        $(this).addClass('noneImg');
429                        $(this).css({'width':'auto','height':'auto'});
430                    }
431                    imgPath=(typeof ml_key === 'undefined' || !ml_key)? imgPath :('images/'+ml_key+'/');
432                    this.src=imgPath+'default-img.svg';
433                    $(this).fadeIn();
434                }
435             });
436                        
437         });
438
439
440    //===================================================================
441    // 判斷圖大小 顯示 寬或高100% (被裁切的圖)
442    //===================================================================
443        $('.itemList:not(.waterPhotos) .itemImg img').hide();
444        $(window).load(function() { 
445            $('.itemList:not(.waterPhotos) .itemImg img').each(function() {
446                
447                if(this.complete){
448
449                    // 判斷外盒大小
450                    var boxW=$(this).parent(".itemImg").innerWidth();
451                    var boxH=$(this).parent(".itemImg").innerHeight();
452                    
453                    var imgW=$(this).outerWidth();
454                    var imgH=$(this).outerHeight();
455                    
456                    // 判斷圖本身短邊的100%
457                    if(imgW<imgH)      {setW="100%";setH="auto";}
458                    else if(imgW>imgH) {setW="auto";setH="100%";}
459                    else if(imgW==imgH){
460                        //外盒橫式或正方
461                        if   (boxW>=boxH){setW="100%";setH="auto";}
462                        //外盒真式
463                        else {setW="auto";setH="100%";}
464                    }
465
466                    $(this).css({"width":setW,"height":setH,"max-width":"none","max-height":"none" }).fadeIn();
467                    
468                }
469             });
470         });
471
472
473
474    //==================================================================
475    //打開或關閉目標  data-target
476    // .openBtn
477    // .closeBtn
478    // .toggleBtn
479    //===================================================================
480    
481        //open target
482        $(".openBtn").on('click touchend',function(){
483            $(".open").removeClass("open");
484            $($(this).data("target")).addClass("open");
485            $("body").css("overflow","hidden");
486            return false;
487        });
488
489        //close target
490        $(".closeBtn").on('click touchend',function(){
491            $($(this).data("target")).removeClass("open");
492            $("body").css("overflow","auto");
493            return false;
494        });
495
496        //toggle target
497        $(".toggleBtn").on('click touchend',function(){
498            $($(this).data("target")).toggleClass("open");
499            $("body").css("overflow","auto");
500            return false;
501        });
502
503
504
505    //===================================================================
506    //讓盒子高=視窗高(扣除置頂及置底高度)
507    //NoOverTop、NoOverBottom 浮動置頂(底)不壓到其他DIV    
508    //===================================================================
509
510
511        $(window).on('load resize',function(){
512            $(".winH").each(function(){
513                var topH    = $($(this).attr('data-top')).height();
514                var bottomH = $($(this).attr('data-bottom')).height();
515                $(this).css('height',setWinH(topH,bottomH));
516            });
517        });
518
519        
520            
521        function setWinH(topH,bottomH) {
522            topH=(topH != null )?topH:0;
523            bottomH=(bottomH != null)?bottomH:0;
524            var winH=$(window).height();
525            var setH=winH-topH-bottomH;                
526            return setH;
527        };
528
529
530
531
532
533    //==================================================================
534    // sideAD 側邊廣告
535    //===================================================================
536    if( $('.sideAD').length ){
537        if(!mobileType){                
538            scrollToggle('.sideAD',300,'active',false);
539        }
540    }
541
542
543
544    //==================================================================
545    // #gotop 移動到最上面
546    //===================================================================
547
548        if($('#gotop').length){
549            $("#gotop").click(function() {
550                jQuery("html,body").animate({
551                    scrollTop: 0
552                }, 1000);
553            }); //end #gotop
554
555            if(!mobileType){scrollToggle('#gotop',300,'active',true); }
556            if(mobileType){scrollUpDownToggle('#gotop','active',true); }
557        }
558
559
560
561    //==================================================================
562    // scrollTo 移動到target
563    //===================================================================
564
565        if($('[data-scrollTo]').length){
566            $('[data-scrollTo]').on('click',function(e) {    
567                var $target= $($(this).attr('data-scrollTo'));      
568                if ($target.length){
569                    var targetTop=$target.offset().top-100;
570                    jQuery("html,body").animate({
571                        scrollTop: targetTop
572                    }, 500);
573                    return false;                    
574                }
575            }); //end scrollTo
576        }
577
578
579    //==================================================================
580    // #showCart 側邊結帳icon
581    //===================================================================
582
583        if($('#showCart').length){
584
585            if(!mobileType){scrollToggle('#showCart',500,'active',true); }
586            if(mobileType){scrollUpDownToggle('#showCart','active',true); }
587        }
588
589
590    //===================================================================
591    //文字垂直輪播 ( class=.marquee)  (需搭配css)
592    //===================================================================
593     
594        var marqueeTarget = ".marquee";
595        
596        if($(marqueeTarget).length){
597            
598            if(!mobileType){
599                var $marqueeBlock = $(marqueeTarget+" ul"),
600                    $marqueeItem = $marqueeBlock.append($marqueeBlock.html()).children(),
601                    marqueeHeight = $('.marquee').height() * -1,
602                    scrollSpeed = 600,
603                    timer,
604                    speed = 3000 + scrollSpeed;
605
606                
607                $marqueeItem.hover(function(){
608                    clearTimeout(timer);
609                }, function(){
610                    timer = setTimeout(marqueeAD, speed);
611                });
612
613                $('a').focus(function(){
614                    this.blur();
615                });
616
617                function marqueeAD(){
618                    var nowPos = $marqueeBlock.position().top / marqueeHeight;
619                    nowPos = (nowPos + 1) % $marqueeItem.length;
620                    $marqueeBlock.animate({
621                        top: nowPos * marqueeHeight
622                    }, scrollSpeed, function(){                
623                        if(nowPos == $marqueeItem.length / 2){
624                            $marqueeBlock.css('top', 0);
625                        }
626                    });
627                    timer = setTimeout(marqueeAD, speed);
628                }
629                timer = setTimeout(marqueeAD, speed);
630            }
631            
632        } //end marquee
633
634
635
636       
637    //===================================================================
638    // tabList (頁籤切換)
639    //===================================================================
640       
641        $(".tabLabel").click(function(){
642            $(this).siblings(".tabLabel.active").removeClass("active");
643            $(this).addClass("active");
644            jQuery("html,body").animate({
645                scrollTop: $(this).offset().top-$(this).height()*2
646            }, 300);
647        });
648        //end tabList
649
650
651
652
653    //===================================================================
654    //限字數
655    //===================================================================
656        $('[data-txtlen]:not([data-txtlen=""])').each(function(){
657            $(this).text(txtlen($(this).text(),$(this).data("txtlen")));
658        });
659        function txtlen(txt,len){
660            if(txt.length>len){
661                return txt.substr(0,len)+'...';            
662            }
663        }
664
665
666
667
668
669
670    //===================================================================
671    //form 
672    //===================================================================
673
674        function numCal(calType,nowVal){          
675
676            if(calType=="-"){
677                var newVal=parseInt(nowVal)-1;
678                newVal=(newVal<=0)?1:newVal;
679            }
680            if(calType=="+"){
681                var newVal=parseInt(nowVal)+1;
682            }
683
684            return newVal;
685        }
686
687        //if not at v3 environment work
688        if (typeof ml_key === 'undefined' || !ml_key){
689
690            $(".numSet .minus").click(function(){
691                var nowVal=$(this).siblings("input").val();
692                $(this).siblings("input").val(numCal("-",nowVal));
693                $(this).siblings("input").trigger("change");
694                return false;
695                
696            });
697
698            $(".numSet .add").click(function(){
699                var nowVal=$(this).siblings("input").val();
700                $(this).siblings("input").val(numCal("+",nowVal));
701                $(this).siblings("input").trigger("change");
702                return false;
703                
704            });
705        }
706
707
708        //fix input date (with jquery-ui-datepicker)
709        var datefield=document.createElement("input")
710            datefield.setAttribute("type", "date")
711        if (datefield.type!="date"){
712            jQuery(function($){
713                $('input[type="date"]').datepicker();
714            })
715        }
716
717
718        // if($(".stickyFilter").length){
719        //     $(window).on('load scroll resize',function(){
720        //         $('body').css('padding-top',$('.header').height()+$('.stickyFilter').height());
721        //         $('.stickyFilter').css('top',$(".header").height());
722        //     });
723
724        // }
725
726
727
728
729
730
731    //===================================================================
732    //google map 
733    //=================================================================== 
734        if($(".googleMap iframe").length){
735            $(".googleMap iframe").css("pointer-events","none");
736            $(".googleMap").click(function(){
737                $(this).find("iframe").css("pointer-events","");
738            });
739            $(".googleMap").mouseleave(function(){
740                $(this).find("iframe").css("pointer-events","none");
741            });
742        }
743
744
745
746    //===================================================================
747    // google translate 
748    //=================================================================== 
749   
750        if($(".googleTranslate").length){
751
752            $("body").bind("DOMSubtreeModified", function() {
753              $target=$("body>*").first();
754              $modifyTarget=(mobileType) ? $(".mbPanel_funNav.navTop,.mbPanel_side") : $(".header");
755              if($target.attr('class')=="skiptranslate" && $target.attr('style') !='display: none;'){ 
756                  $modifyTarget.css("top","40px");
757              }else{
758                  $modifyTarget.css("top","");
759              }
760            });
761
762            //for firefox at toplink
763            if(navigator.userAgent.indexOf('Firefox') != -1){
764                if($(".googleTranslate").parents(".moreMenu").length){
765                    $(".googleTranslate").parents(".moreMenu").css("overflow","visible");
766                }
767            }
768        }
769
770
771
772
773
774
775
776    //===================================================================
777    //footer site map 
778    // fotter type3 , mobile size => title link return false
779    //=================================================================== 
780       var footerSiteMapType3="footer .siteMap.type3";
781       if($(footerSiteMapType3).length){
782            if(mobileType){
783                $(footerSiteMapType3).children("li").children("a").attr("href","javascript:void(0)");
784            }
785       }
786    //===================================================================
787    //GDPR 
788    //===================================================================
789        if ( $('.GDPR').length ){
790            var gdprBlock = $('.GDPR');
791            var gdprBtn  = $('.GDPR__btn');
792            setTimeout(function(){
793                gdprBlock.addClass('active');
794            },1000);
795            gdprBtn.on('click',function(){
796                $.get('gdprcookie.php',function(){
797                    gdprBlock.removeClass('active');
798                    setTimeout(function(){
799                        gdprBlock.remove();
800                    },1000);
801                });
802            });
803        }
804
805
806
807
808
809});//end $(function)
810
811
812
813
814
815    //==================================================================
816    // 判斷瀏覽器
817    // if(Sys.ie)
818    // if(Sys.firefox)
819    // if(Sys.chrome)
820    // if(Sys.opera)
821    // if(Sys.safari)
822    //==================================================================
823        var Sys = {};
824        var ua = navigator.userAgent.toLowerCase();
825        var s;
826        (s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] :
827        (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
828        (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
829        (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
830        (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
831        (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;        
832        
833        
834
835    //==================================================================    
836    //fix input number (ie)    
837    //==================================================================
838
839        IEInputFix();        
840        function IEInputFix(){            
841            if(Sys.ie){
842               $('input[type="number"]')
843               .attr('disabled',true)
844               .css({
845                    'line-height':'100%',
846                    'border':'1px solid #999',
847                    'color':'#333',
848                })
849               .wrap('<span class="numSet"></span>')
850               .after('<button type="button" class="add">+</button>')
851               .before('<button type="button" class="minus">-</button>');
852            }
853        }
854
855
856    //==================================================================
857    // 讀ajax
858    // file,檔案
859    // method,模式
860    // val,值
861    // block 重讀的區塊
862    // callback 
863    //==================================================================
864
865      function ajaxload(file,method,val,block,callback){
866        var method=(method==null)?"":"method="+method;
867        var val=(val==null)?"":"val="+val;
868        var dataurl=file+"?"+method+'&'+val;
869        $.ajax({
870          url: dataurl,
871          cache: false,
872          success: function(data){
873            // console.log(data);
874            $(block).html(data);
875            if(callback){
876                callback();
877            };
878          } 
879        });
880      }
881
882
883
884
885    //==================================================================
886    // 判斷目前向上或向下滾動
887    // winScrollStatus = set scorll status ( down / up / unscroll)
888    //==================================================================
889        var winScrollStatus='unScroll';
890        var win_now_pos = 0;
891        var win_tmp_pos = 0;
892        $(window).on('scroll load resize',function() {
893            win_now_pos=$(this).scrollTop();
894            if ( win_now_pos > win_tmp_pos ) {
895                winScrollStatus = 'scrollDown';
896            }else if( win_now_pos < win_tmp_pos ){
897                winScrollStatus = 'scrollUp';
898            }else if( win_now_pos = win_tmp_pos = 0){
899                winScrollStatus = 'unScroll';
900            }
901            win_tmp_pos = win_now_pos;
902        });
903        
904    
905
906
907
908
909    //==================================================================
910    // 視窗捲動超過設定值,目標顯示或隱藏
911    // scrollToggle (scroll after scrollTop then show or hide)
912    // target = show/hide target
913    // actPos = show/hide scrollTop
914    // activeClass = when show/hide add/remove Class
915    // jsShowHide = use js show() / hide()
916    //==================================================================
917
918        function scrollToggle(target,actPos,activeClass,jsShowHide){
919
920            $(window).on('scroll load resize',function() {
921                
922                if ( ($(window).scrollTop() > actPos) && (!$(target).hasClass(activeClass)) ) {
923                    $(target).addClass(activeClass);
924                    if(jsShowHide){$(target).stop().fadeIn(1000);}
925                    return false;
926                } else if( ($(window).scrollTop() <= actPos) ){
927                    $(target).removeClass(activeClass);
928                    if(jsShowHide){$(target).stop().fadeOut(100);}
929                    return false;
930                }
931
932            });
933            
934        }// end function scrollToggle
935
936
937
938        
939
940        
941    //==================================================================
942    // 視窗捲動向上/向下,目標 顯示/隱藏
943    // scrollUpDownToggle ( scroll down/up -> add/remove class or show()/hide()  )
944    // target = toggle target
945    // activeClass = scroll up/down -> add/remove class
946    // jsShowHid = use js toggle
947    //==================================================================
948        function scrollUpDownToggle(target,activeClass,jsShowHide){
949            $(window).on('scroll load resize',function() {
950                var isActed=$(target).hasClass(activeClass);
951                // console.log(winScrollStatus);
952
953                switch(winScrollStatus){
954
955                    default:
956                    case 'unScroll':
957                        $(target).stop().removeClass(activeClass);
958                        if(jsShowHide){$(target).stop().hide();}
959                        break;
960
961                    case 'scrollDown':
962                        if(isActed){
963                            $(target).stop().removeClass(activeClass);
964                            if(jsShowHide){$(target).stop().fadeOut();}
965                        }
966                        break;
967
968                    case 'scrollUp':
969                        if(!isActed){
970                            $(target).stop().addClass(activeClass);
971                            if(jsShowHide){$(target).stop().fadeIn();}
972                        }
973                        break;
974
975                } // end switch
976                return false;
977            });
978        }// end function scrollUpDownToggle
979
980        
981            
982
983
984
985
986
987
988
989   
990    //!!!!!!!!!如有亮燈+收合選單,先call亮燈,再call收合,ex:產品側邊收合選單
991
992
993    //===================================================================
994    //選單亮燈 
995    //data-active="" 指定加active的tag
996    //data-novalue="" 亮燈時是否判斷url後方的參數,設true,不判斷參數
997    //data-multimenu="" 多層選單,設true,子選單active,父選單也會active
998    //data-defactive="active" 在html已有預設active的項目
999    //SAMPLE CODE <div class="navlight" data-active="li" data-multimenu="true" data-novalue="true">
1000    //===================================================================
1001        navlight(".navlight");
1002       
1003        function navlight(navtarget){
1004
1005            $(navtarget).each(function(){
1006                var novalue=$(this).data("novalue");
1007                var multimenu=$(this).data("multimenu");
1008                var activetarget=$(this).data("active"); 
1009                var defactive=$(this).data("defactive");  
1010                var defactiveid=$(this).data("defactiveid");  
1011                var navtargets=$(this).find(activetarget);        
1012                var nowpage = window.location.pathname.split('/');
1013                var nowpage_novalue=window.location.href.split('/');   
1014                var nowpage_values =window.location.href.split('?');   
1015                var actived=(defactive=='active')?true:false;     
1016                
1017                nowpage=(novalue)?nowpage_novalue[nowpage_novalue.length-1]:nowpage[nowpage.length-1]+"?"+nowpage_values[1];  
1018               
1019                $(navtargets).each(function(i){           
1020                     
1021                    navurl=$(this).find("a").attr("href");
1022                    //沒有預設active
1023                    if(actived==false){
1024                        $(navtargets).removeClass("active");
1025                        if(navurl==nowpage){                            
1026                            $(this).addClass("active");
1027                            if(multimenu){$(this).parentsUntil($(navtarget),activetarget).addClass("active"); }
1028                            actived=true;
1029                        }              
1030                    }else if(defactive=='active'){
1031
1032                        if( $(this).attr('id') == defactiveid ){
1033                            $(this).addClass('active');
1034                        }
1035
1036                        if($(this).hasClass('active')){                            
1037                            $(this).parentsUntil($(navtarget),activetarget).addClass("active");
1038                        }
1039                    }
1040                    
1041                });
1042
1043            });
1044
1045        }//END function navlight
1046        
1047
1048
1049
1050
1051
1052
1053
1054
1055    //===================================================================
1056    //收合選單 
1057    // 1.可無限階層,如有子選單則收合,若無則link(轉頁)
1058    // 2.active複選:凡是href=url的項目皆會active,並展開
1059    // 3.如html無設定active,預設展開第一筆
1060    //class=togglearea
1061    //data-item  每筆資料
1062    //data-title 標題(點擊展開內容)
1063    //data-content 收合的內容 (預設隱藏,第一筆展開,或在html加active展開)
1064    //data-nodefault="true" 取消預設展開第一筆
1065    //SAMPLE CODE <div class="faqlist togglearea" data-item=".faq_item" data-title=".faq_title" data-content=".faq_content"> 
1066    //用在收合選單(有子選單):
1067    //data-item="li" data-title="li>a" data-content="ul" data-nodefault="true"
1068    //----同層選單縮合data-content="ul"
1069    //----同層選單不縮合 data-content="li>ul"
1070    //===================================================================
1071
1072        $(".togglearea").each(function(){
1073            togglearea($(this));               
1074        });
1075        function togglearea($target){      
1076            var items=$target.data("item");
1077            var title=$target.data("title");
1078            var content=$target.data("content");
1079            var nodefault=$target.data("nodefault");
1080            var prevent=$target.data("prevent");
1081            //$target.addClass("no_css_transition");               //移除css animation        
1082            $target.find(content).hide();                          //隱藏所有選單內容
1083            if ($target.find(items).hasClass("active")){
1084                 $target.find(items+".active").siblings().find(content).hide();         //隱藏同層的其他內容
1085                 $target.find(items+".active").children(content).show();                //如有active則展開該項 
1086            }
1087            else if (!nodefault){
1088                 $target.find(items+":first-child").children(content).show();                           //若無active展開第一項內容
1089                 $target.find(items+":first-child").children(content).parent().addClass("active");}     //並加active
1090            
1091            if(prevent === false || prevent==undefined){
1092                $target.find(title).click(function(){        
1093                        
1094                    if($(this).closest(items).hasClass("active")){                
1095                        $target.find(items).removeClass("active");
1096                    }else{
1097                        $target.find(items).removeClass("active");                
1098                        $(this).closest(items).addClass("active");
1099                    }
1100                            
1101                       
1102                    if($(this).next(content).length>0){
1103                        $(this).parent().siblings().find(content).slideUp(200); //同層的收合
1104                        $(this).next(content).stop().slideToggle(300);
1105
1106                        return false;
1107                    }
1108                });                
1109            }
1110
1111        }//END function togglearea 
1112
1113
1114
1115    //===================================================================
1116    // 用js產生影格動畫 (keyframe)
1117    // <div class="playFrame" data-playFrame="js" data-playFrameData='{"frames":6,"playtime":"1s","animateName":""}'> 
1118    //     <img src="images/default/scrolldown_frame.svg"> 
1119    // </div>
1120    // playFrame(物仲,設定JSON,index);
1121    //===================================================================
1122        
1123        $(function(){
1124            $('[data-playFrame="js"]').each(function(index){                
1125                var playFrameData = $(this).attr('data-playFrameData') || '{"frames":"","playtime":""}';       
1126                    playFrameData = JSON.parse(playFrameData);                       
1127                playFrame($(this),playFrameData,index);                
1128            });     
1129        });
1130        function playFrame($obj,playFrameData,index){
1131
1132            var frames      = playFrameData['frames'] || 30; //影格數
1133            var playtime    = playFrameData['playtime'] || '1s'; //動畫時間
1134            var animateName = playFrameData['animateName'] || index; //動畫名稱
1135
1136            var $img=$obj.children('img');  // 原圖
1137            var imgSrc=$img.attr('src');    // 圖路徑
1138            var imgFullW=playFrameData['w']*playFrameData['frames'] || $obj.width();      // 所有影格圖寬
1139
1140            var imgW=playFrameData['w'] || imgFullW / frames;     // 單張影格寬
1141            var imgH=playFrameData['h'] || $obj.height();         // 單張影格高
1142
1143            $img.css({'opacity':0});
1144            $obj.css({                  
1145                'display':'block',                  
1146                'width':imgW + 'px',
1147                'height':imgH + 'px',
1148                'background':'url('+imgSrc+')',
1149                'background-position':(-imgFullW)+'px',                    
1150                        'animation':'playFrame_animation_'+animateName+' '+playtime+' steps('+(frames)+') infinite',
1151                '-webkit-animation':'playFrame_animation_'+animateName+' '+playtime+' steps('+(frames)+') infinite',
1152            });
1153            $obj.after('<style>@keyframes playFrame_animation_'+animateName+' {to{ background-position: '+(-imgFullW)+'px;} from { background-position: 0;} } </style>');
1154        }

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.