PageSourceSearch

https://www.likai.tw/Scripts/script.js

js likai.tw collected 2026-10-08 16:31:08 UTC 19,993 bytes, 597 lines download raw bytes

1/**傳送資料到iframe start**/
2function post_to_iframe(form) {
3    form.target = "ifmSubmit";
4    form.submit();
5}
6/**傳送資料到iframe end**/
7
8///////////// 
9// 
10// Cookie Functions - Bill Dortch (21-Jan-96) 
11// The following functions are released to the 
12// public domain. 
13// 
14function GookieVal(offset) {
15    var endstr = document.cookie.indexOf(";", offset);
16    if (endstr == -1)
17        endstr = document.cookie.length;
18    return decodeURI(document.cookie.substring(offset, endstr));
19}
20
21function Gookie(name) {
22    var arg = name + "=";
23    var alen = arg.length;
24    var clen = document.cookie.length;
25    var i = 0;
26    while (i < clen) {
27        var j = i + alen;
28        if (document.cookie.substring(i, j) == arg)
29            return GookieVal(j);
30        i = document.cookie.indexOf(" ", i) + 1;
31        if (i == 0) break;
32    }
33    return null;
34}
35
36function Sookie(name, value) {
37    var argv = Sookie.arguments;
38    var argc = Sookie.arguments.length;
39    var expires = (argc > 2) ? argv[2] : null;
40    var path = (argc > 3) ? argv[3] : '/';
41    var domain = (argc > 4) ? argv[4] : null;
42    var secure = (argc > 5) ? argv[5] : false;
43    document.cookie = name + "=" + escape(value) +
44        ((expires == null) ? "" : ("; expires=" +
45            expires.toGMTString())) +
46        ((path == null) ? "" : ("; path=" + path)) +
47        ((domain == null) ? "" : ("; domain=" + domain)) +
48        ((secure == true) ? "; secure" : "");
49}
50
51function Dookie(name) {
52    var exp = new Date();
53    exp.setTime(exp.getTime() - 1);
54    var cval = Gookie(name);
55    document.cookie = name + "=";
56}
57// 
58// End of cookie functions 
59////////// 
60
61//頭檔分辨下拉用.
62function showobj(objID, moreClass) {
63    var obj = document.getElementById(objID);
64    if (obj) obj.className = moreClass;
65}
66
67//頭檔分辨下拉用.
68function hideobj(objID) {
69    var obj = document.getElementById(objID);
70    if (obj) obj.className = "hideobj";
71}
72
73//頭檔分辨下拉用
74function showorhide(objIDs, objStatus) {
75
76    if (objIDs != '') {
77        var tmpID = objIDs.split('|');
78    }
79    if (objStatus != '') {
80        var tmpSta = objStatus.split('|');
81    }
82    for (var key in tmpSta) {
83        if (tmpSta[key] == 1) {
84
85            showobj(tmpID[key], 'showobj')
86        } else {
87            hideobj(tmpID[key])
88        }
89
90    }
91
92}
93
94
95//function 不分頁的頁碼用
96function toPageTable(id, showid, objtable, objpage, flag) {
97    var k = id;
98
99    if (flag) {
100        for (var i = 1; i <= k; i++) {
101            if (document.getElementById(objtable + i).style.display == '') nowid = i;
102        }
103
104        if (flag == 'prev') {
105            if (nowid == 1) showid = 1;
106            else showid = nowid - 1;
107        } else {
108            if (nowid == k) showid = k;
109            else showid = parseInt(nowid, 10) + 1;
110        }
111    }
112    document.cookie = "PAGEID=" + showid;
113    document.getElementById(objtable + showid).style.display = '';
114    document.getElementById(objpage + showid).className = 'current';
115    for (var i = 1; i <= k; i++) {
116        if (i != showid) {
117            document.getElementById(objtable + i).style.display = 'none';
118            document.getElementById(objpage + i).className = '';
119        }
120    }
121}
122
123//for cart to delete products
124if ($('.delpdt').length > 0) {
125    $('#loadingIMG').hide();
126    $(".delpdt").click(function () {
127        var tmp = $(this).attr('title').split('_');
128        var delid = tmp[0];
129        var nowlg = tmp[1];
130        $.ajax({
131            type: "POST",
132            url: "/lib/func-jquery.php?mod=delitem",
133            data: {
134                delid: delid,
135                lg: nowlg
136            },
137            success: function (data) {
138                // 2018-12-24 setTimeout(history.back(), 2000); //20171108 產品加入詢價,在詢價車頁面刪掉品項,會跳到產品頁
139                // 2018-12-24 產品加入詢價,在詢價車頁面刪掉品項,應該要留在同一頁
140                var returnLink = location.pathname.substr(1);
141                setTimeout("location.href='/" + returnLink + "'", 1000);
142            },
143            beforeSend: function () {
144                $('#loadingIMG').show();
145            },
146        });
147
148    });
149}
150
151///banner圖輪播
152$(document).ready(function () {
153    //判斷IE
154    if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
155        $('#left_menu').addClass('ie-custom');
156    }
157
158    if ($('.image-popup-vertical-fit').length > 0) {
159        $('.image-popup-vertical-fit').magnificPopup({
160            type: 'image',
161            closeOnContentClick: true,
162            mainClass: 'mfp-img-mobile',
163            image: {
164                verticalFit: true
165            }
166
167        });
168    }
169
170    if ($('.popup-gallery').length > 0) {
171        $('.popup-gallery').magnificPopup({
172            delegate: 'a',
173            type: 'image',
174            tLoading: 'Loading image #%curr%...',
175            mainClass: 'mfp-img-mobile',
176            gallery: {
177                enabled: true,
178                navigateByImgClick: true,
179                preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
180                tCounter: ''
181            },
182            image: {
183                titleSrc: function (item) {
184                    return item.el.attr('title');
185                }
186            }
187        });
188    }
189
190    if ($('.grid-item a').length > 0) {
191        $('.grid-item a').magnificPopup({
192            type: 'image',
193            mainClass: 'mfp-with-zoom mfp-img-mobile gallery-grid-lightbox',
194            tLoading: 'Loading image...',
195            // gallery: {
196            //     enabled: true,
197            //     navigateByImgClick: true,
198            //     preload: [0, 1], 
199            //     tCounter: ''
200            // },
201            image: {
202                titleSrc: function (item) {
203                    return item.el.attr('title');
204                },
205                cursor: 'mfp-zoom-out-cur',
206            },
207            zoom: {
208                enabled: true,
209                duration: 300,
210                easing: 'ease-in-out',
211                opener: function (openerElement) {
212                    return openerElement.is('img') ? openerElement : openerElement.find('img');
213                }
214            },
215            closeMarkup: '<div class="close mfp-close"></div>'
216        });
217    }
218
219    //側欄目錄
220    var qserch = "<li>" + $("#qsearch").html() + "</li>";
221    var main_nav = $("#main_menu").html();
222    var member_info = "<li>" + $("#hello_member").html() + "</li>";
223    var lang_div = "<li>" + $('#language_ul').html() + "</li>";
224
225    // $('#left_menu > ul').append(qserch).append(member_info).append(main_nav).append(lang_div);
226    $('.site-menu .site-menu-list').append(main_nav);
227
228    $('.site-menu *').removeClass('nav-pills').removeClass('pull-right').removeClass('nav-pills').removeClass('dropdown').removeClass('dropdown-toggle').removeClass('dropdown-menu').removeAttr('data-toggle');
229    $('.site-menu .caret').remove();
230    $('.site-menu li.divider').remove();
231    // $('#left_menu > ul > li > ul').removeClass('nav-pills').removeClass('pull-right').addClass('nav nav-list');
232    // $('#left_menu > ul a').removeAttr('data-toggle').removeClass('dropdown-toggle').addClass('sb-toggle-submenu');
233    // $('#left_menu > ul > li > ul.dropdown-menu').removeClass('dropdown-menu').addClass('sb-submenu');
234    $(".site-menu-list").simplemenu({
235        directorylink: false,
236        customicon: '<div class="triangle_icon"></div>'
237    });
238
239
240    //mobile menu effect
241    $('.sb-toggle-left').on('click', function () {
242        if (!$('body').hasClass('open-menu')) {
243            $('.site-menu').fadeIn();
244            $('body').addClass('open-menu');
245        }
246    });
247
248
249
250    $('.site-menu .site-menu-close').on('click', function () {
251        var close_delay = window.innerWidth < 767 ? 400 : 800;
252        $('body').addClass('close_menu').delay(close_delay).queue(function (next) {
253            $('.site-menu').fadeOut(600);
254            $('body').removeClass('close_menu').removeClass('open-menu');
255            $('.site-menu-list li').removeClass('active').find('ul').slideUp();
256            next();
257        });
258    });
259
260
261    $("#kwd.form-control").bind('focus click', function () {
262        $(this).val('');
263    });
264
265    $("a").click(function () {
266        Dookie('QSHCID');
267    });
268
269    $("li[class^='incate'], li[class^='inmsg']").click(function () {
270        var cid = $(this).data('id');
271        Sookie('QSHCID', cid);
272        $("#side_menu ul[class^='collapse']").each(function () {
273            $(this).removeClass('in');
274        });
275    });
276
277    fakewaffle.responsiveTabs(['xs']);
278
279    $('.goback-btn').click(function () {
280        window.history.back();
281    });
282    $('.gotop-btn').click(function (event) {
283        event.preventDefault();
284        $('html,body').animate({
285            scrollTop: 0
286        }, 500, 'swing');
287    });
288
289
290    /* 首頁文字effect */
291    $('.swiper-slideimg').imagesLoaded({
292        background: true
293    }, function () {
294
295        var _index_word_wrap = $('.word-effect').outerWidth();
296        $('.word-effect img').width(_index_word_wrap);
297
298        //設定banner 高度
299        var _browser_height = $(window).height();
300        $('#maincarousel .swiper-slideimg').css({
301            "min-height": _browser_height + "px"
302        });
303
304        $('#maincarousel').addClass('resizeed');
305
306        $('#mainbanner').addClass('loaded');
307    });
308
309    var _index_word_wrap = $('.word-effect').outerWidth();
310    $('.word-effect img').width(_index_word_wrap);
311
312    /*scroll down */
313    $('.scroll-down').click(function () {
314        index_banner_height = $('#maincarousel').outerHeight();
315        $('html,body').animate({
316            scrollTop: index_banner_height - 96
317        }, 500, 'swing');
318    });
319
320    //head link wrapinner
321    $("#main_menu >li>a").wrapInner("<span class='inner'></span>");
322
323
324    //index-application
325    if ($('.application-swiper').length > 0) {
326
327        var application_swiper = new Swiper('.application-swiper', {
328            slidesPerView: 'auto',
329            centeredSlides: true,
330            loop: true,
331            spaceBetween: 60,
332            speed: 1600, //過場的時間 類似transition: all 10s ease;
333            watchSlidesProgress: true,
334            watchSlidesVisibility: true,
335            lazy: {
336                loadPrevNext: true,
337                loadPrevNextAmount: 3, //上一張下一張的加載數量,如果輸入為2,就是加載上2張下兩張
338                elementClass: 'swiper-lazy', //img 要加上得css
339                loadingClass: 'swiper-lazy-loading',
340                loadedClass: 'swiper-lazy-loaded',
341                preloaderClass: 'swiper-lazy-preloader'
342            },
343            pagination: {
344                el: '.swiper-pagination',
345                clickable: true,
346            },
347            navigation: {
348                nextEl: '.bump-swiper-button-next',
349                prevEl: '.bump-swiper-button-prev',
350            },
351            autoplay: {
352                delay: 4000, //autoplay 間隔時間    
353                stopOnLastSlide: false // 設定為true 可以再最後一張停下                                 
354            },
355            breakpoints: {
356                767: {
357
358                    spaceBetween: 20
359                },
360                1366: {
361                    spaceBetween: 30
362                }
363            },
364            on: {
365                init: function () {
366
367                    var current_title = $('.application-swiper .swiper-slide-active .title').text(),
368                        current_description = $('.application-swiper .swiper-slide-active .pic_description').text();
369                    $('#index_product>.description>.tilte').empty().append(current_title);
370                    $('#index_product>.description>.text').empty().append(current_description);
371                },
372                slideChangeTransitionStart: function () {
373                    $('#index_product .description').addClass('changing');
374                },
375                slideChangeTransitionEnd: function () {
376                    var current_title = $('.application-swiper .swiper-slide-active .title').text(),
377                        current_description = $('.application-swiper .swiper-slide-active .pic_description').text();
378                    $('#index_product>.description>.tilte').empty().append(current_title);
379                    $('#index_product>.description>.text').empty().append(current_description);
380                    $('#index_product .description').removeClass('changing');
381                },
382                progress: function () {
383                    for (var i = 0; i < this.slides.length; i++) {
384                        var _each_slideprogress = this.slides[i].progress;
385                        _this_effect = Math.abs(_each_slideprogress) * 13;
386                        this.slides[i].style.transform = "translateY(-" + _this_effect + "%)";
387                    }
388                },
389                touchStart: function () {
390                    for (var i = 0; i < this.slides.length; i++) {
391                        this.slides[i].style.transition = "";
392                    }
393                },
394                setTransition: function (speed) {
395                    for (var i = 0; i < this.slides.length; i++) {
396                        this.slides[i].style.transition = speed + "ms";
397                    }
398                }
399            }
400        });
401
402        $('.plus.left').on('click', function () {
403            application_swiper.slideNext();
404        });
405        $('.plus.right').on('click', function () {
406            application_swiper.slidePrev();
407        });
408    }
409
410    $('.tab-ctrl .tab-btn').on('click', function () {
411        if (!$(this).hasClass('active')) {
412            var _thetab_counter = $(this).index();
413            $(this).addClass('active').siblings().removeClass('active');
414
415
416            $(this).parents('.tab-ctrl').siblings('.tab-content').find('.tab-content--item').eq(_thetab_counter).fadeIn().addClass('active').siblings().removeClass('active').hide();
417            var _banner_target = $(this).data('target'),
418                _banner_links = $(this).data('banner');
419            $(_banner_target).addClass('changing').attr('style', 'background-image:url(' + _banner_links + ')');
420            $(_banner_target).imagesLoaded({
421                background: true
422            }, function (instance) {
423                $(_banner_target).removeClass('changing');
424                // console.log(_banner_target);
425                // console.log(instance);
426            });
427        }
428    }).eq(0).click();
429
430
431    if ($('.swiper-logo').length > 0) {
432
433        $('.swiper-logo').imagesLoaded({}, function () {
434            $('.logo-wrap').each(function () {
435                var _this_width = $(this).outerWidth();
436                $(this).parents('.swiper-slide').width(_this_width);
437            });
438
439            var swiper_logo = new Swiper('.swiper-logo', {
440                slidesPerView: 'auto',
441                loopedSlides: 7,
442                loop: true,
443                // centeredSlides: true,                
444                spaceBetween: 60,
445                disableOnInteraction: false,
446                speed: 800,
447                autoplay: {
448                    delay: 3000,
449                    disableOnInteraction: true
450                },
451                breakpoints: {
452                    1024: {
453                        slidesPerView: 4,
454                        spaceBetween: 40,
455                    },
456                    768: {
457                        slidesPerView: 3,
458                        spaceBetween: 30,
459                    },
460                    420: {
461                        slidesPerView: 2,
462                    }
463                }
464            });
465            // swiper_logo.slideTo(3, 1000);
466        });
467    }
468
469    var likaiwow = new WOW({
470        boxClass: 'wow',
471        animateClass: 'animated',
472        offset: 0,
473        mobile: false,
474        live: true,
475        callback: function (box) {
476            //   console.log(box); 
477            //   box.addClass('complated');                        
478        },
479        scrollContainer: null,
480        resetAnimation: false,
481    });
482    likaiwow.init();
483
484});
485
486$(window).on('load resize scroll', function () {
487    var window_top = $(this).scrollTop();
488
489    if (window_top > 60 && !$('body').hasClass('leavetop')) {
490        $('body').addClass('leavetop');
491    }
492
493    if (window_top < 60 && $('body').hasClass('leavetop')) {
494        $('body').removeClass('leavetop');
495    }
496
497    var _index_word_wrap = $('.word-effect').outerWidth();
498    $('.word-effect img').width(_index_word_wrap);
499
500    if ($('#index_company').length > 0) {
501        var wHeight_Offset = $(window).height() / 3,
502            _targe_top = $('#index_company').offset().top - wHeight_Offset,
503            _targe_bottom = $('#index_company').offset().top + $('#index_company').outerHeight() - wHeight_Offset;
504
505        if (window_top > _targe_top && window_top < _targe_bottom) {
506            if (!$('#index_company').hasClass('black-bg')) {
507                $('#index_company').addClass('black-bg');
508            }
509        } else {
510            if ($('#index_company').hasClass('black-bg')) {
511                $('#index_company').removeClass('black-bg');
512            }
513        }
514    }
515});
516if ($('.form_date').length > 0) {
517    /// 20131127 for date
518    $('.form_date').datetimepicker({
519        language: 'zh-TW',
520        weekStart: 1,
521        todayBtn: 1,
522        autoclose: 1,
523        todayHighlight: 1,
524        startView: 2,
525        minView: 2,
526        forceParse: 0
527    });
528}
529
530//for product show change image src & alt.
531if ($('.showpicstr').length > 0) {
532    $('.showpicstr').hover(function () {
533        var newlink = $(this).attr('href');
534        var newalt = $(this).attr('title');
535        var picsize = $(this).data('picsize');
536        var newsrc = newlink.replace("/sr/", picsize >= 1 ? "/pb/" : "/sr/");
537        $('#bimg_link').attr('href', newlink).attr('title', newalt);
538        $('#bimg_link img').attr('title', newalt);
539        $('#bimg').attr('src', newsrc);
540    });
541}
542
543if ($('.swiper-banner').length > 0) {
544    var mySwiper = new Swiper('.swiper-banner', {
545        pagination: $('.swiper-banner .swiper-slide a.swiper-slideimg').length > 1 ? '.page-banner' : false,
546        loop: $('.swiper-banner .swiper-slide').length > 1 ? true : false, //20170906
547        effect: 'fade',
548        fadeEffect: {
549            crossFade: true
550        }
551    });
552} //end swiper-banner
553
554if ($('.swiper-product').length > 0) {
555    var swiperProduct = new Swiper('.swiper-product', {
556        loop: $('.swiper-product .swiper-slide a').length > 1 ? true : false,
557        // speed: 1000,
558        direction: $('body').width() > 991 ? 'vertical' : 'horizontal',
559        pagination: {
560            el: '.swiper-pagination',
561            clickable: true,
562
563        },
564        lazy: {
565            loadPrevNext: true,
566            loadPrevNextAmount: 1, //上一張下一張的加載數量,如果輸入為2,就是加載上2張下兩張
567            elementClass: 'swiper-lazy', //img 要加上得css
568            loadingClass: 'swiper-lazy-loading',
569            loadedClass: 'swiper-lazy-loaded',
570            preloaderClass: 'swiper-lazy-preloader'
571        },
572        autoplay: {
573            delay: 3000, //autoplay 間隔時間
574            disableOnInteraction: true,
575            stopOnLastSlide: false // 設定為true 可以再最後一張停下
576        }
577    });
578} //end swiper-product
579
580//seems No effect.
581function changefaq(newid) {
582    var obj = $('#side_faq_form');
583    $('input[name^=categories]').val(newid);
584    $('#side_faq_form').submit();
585}
586
587//浮動按鈕
588    $('.quicklinkbtn').click(function(){
589        $(this).parents('.quicklink').toggleClass('open');
590    });
591
592    $(window).on('scroll resize',function(){
593        console.log('QQQ');
594        if($('.quicklink').hasClass('open')){
595            $('.quicklink').removeClass('open');
596        }
597    });

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.