PageSourceSearch

https://service.hbrtaiwan.com/public/assets/js/script.js

js hbrtaiwan.com collected 2026-09-24 08:55:51 UTC 15,593 bytes, 516 lines download raw bytes

1$(function () {
2    // dropdown-menu關閉設定
3    if ($('.dropdown-menuSet').length > 0) {
4        $('.dropdown-menuSet').on('click', function (e) {
5            e.stopPropagation();
6        });
7    }
8
9    if ($('.closeBtn').length > 0) {
10        $('.closeBtn').click(function () {
11            $(this).parents('.dropdownBoxSet').find('.dropdownToggle').dropdown('toggle')
12        });
13    }
14
15    //預設dropdown-menu是打開的
16    if ($('.dropdownDefaultOpen .dropdownToggle').length > 0) {
17        $(".dropdownDefaultOpen .dropdownToggle").dropdown("toggle");
18    }
19    //全站同意Cookie訊息
20    if ($('.cookie').length > 0) {
21        $('.cookie').click(function () {
22            $('.cookie').css("display", "none");
23        });
24    }
25
26    //載入更多按鈕 change loader
27    if ($('.moreBtn').length > 0) {
28        $('.moreBtn').click(function () {
29            $(this).addClass('addLoader')
30        });
31    }
32
33    //追踨按鈕
34    if ($('.followBtn').length > 0) {
35        $('.followBtn').click(function () {
36            $(this).toggleClass('followCheckBtn')
37        });
38    }
39
40    //主題分類訂閲
41    if ($('.sortBoxClick ul li i').length > 0) {
42        $('.sortBoxClick ul li i').click(function () {
43            $(this).parent().toggleClass('followCheckBtn')
44        });
45    }
46    //goTop
47    if ($('#gotop').length > 0) {
48        $("#gotop").click(function () {
49            jQuery("html,body").animate({
50                scrollTop: 0
51            }, 1000);
52        });
53        $(window).scroll(function () {
54            if ($(this).scrollTop() > 300) {
55                $('#gotop').fadeIn("fast");
56            } else {
57                $('#gotop').stop().fadeOut("fast");
58            }
59        });
60    }
61
62    //mobile search
63    if ($('.myMenu .modal-header .right li.search').length > 0) {
64        $(".myMenu .modal-header .right li.search").click(function () {
65            $(".myMenu .searchBox").toggle();
66        });
67    }
68
69    //收藏資料夾
70    if ($('.saveBox ul li ').length > 0) {
71        $(".saveBox ul li ").click(function () {
72            $(this).toggleClass('check');
73        });
74        $(".saveBox .lightBoxBtn ").click(function () {
75            $(this).parent().parent().addClass('goLibrary');
76            $(this).parent().find('.addForm').removeClass('formOpen')
77            $(this).parent().find('li.add').removeClass('addNew');
78            //$(this).parent().find('li.add').removeClass('check');
79        });
80    }
81
82    //收藏資料夾 - 新增資料夾
83    if ($('.saveBox ul li.add ').length > 0) {
84        $(".saveBox ul li.add ").click(function () {
85            $(this).addClass('addNew');
86            $(this).parent().parent().find('.addForm').addClass('formOpen')
87        });
88    }
89
90
91    //收藏資料夾個人圖書館隠藏
92    if ($('.clickItem li a').length > 0) {
93        $(".clickItem li a").click(function () {
94            $(".mySave .modal-body").removeClass("goLibrary");
95        });
96    }
97
98
99    //footer訂閱 scroll效果
100    var windowTop = 0;
101    $(window).scroll(function () {
102        var scrolls = $(this).scrollTop();
103        if (scrolls >= windowTop) {
104            $('body').addClass('hideUp');
105            windowTop = scrolls;
106        } else {
107            $('body').removeClass('hideUp');
108            windowTop = scrolls;
109        }
110        if (scrolls == 0) {
111            $('body').removeClass('hideUp');
112        }
113    });
114
115    //針對ie object-fit
116    if ($('.itemthumb img').length > 0) {
117        msieversion = function () {
118            var ua = window.navigator.userAgent;
119            var msie = ua.indexOf("MSIE ");
120
121            if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
122            {
123                //alert(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))));
124                $('.itemthumb').each(function () {
125                    var $container = $(this),
126                        imgUrl = $container.find('img').prop('src');
127                    if (imgUrl) {
128                        $container
129                            .css('backgroundImage', 'url(' + imgUrl + ')')
130                            .addClass('compat-object-fit');
131                    }
132                });
133            } else // If another browser, return 0
134            {
135                //alert('otherbrowser');
136            }
137
138            return false;
139        }
140        msieversion();
141    }
142
143    //兩欄左側小版樣式設定
144    if ($('.box ul li a').length > 0) {
145        $('.box ul li a').click(function () {
146            $(this).parents('li').toggleClass('active')
147        });
148    }
149    if ($('.reBtn').length > 0) {
150        $('.reBtn').click(function () {
151            $('body').addClass('modal-openB');
152        });
153    }
154    if ($('.studyBox aside .closeBtn').length > 0) {
155        $('.studyBox aside .closeBtn').click(function () {
156            $('body').removeClass('modal-openB');
157        });
158    }
159
160    //大版兩欄左側固定
161    if ($('body').hasClass('sideBar') === true) {
162        var Sticky = new hcSticky('aside', {
163            stickTo: 'main',
164            responsive: {
165                991: {
166                    disable: true
167                }
168            }
169        });
170    }
171
172
173    //文章Detail個人圖書館隠藏
174    if ($('.articleMenuItem  a.dropdownToggle').length > 0) {
175        $(".articleMenuItem  a.dropdownToggle").click(function () {
176            $(".mySave .modal-body").removeClass("goLibrary");
177        });
178    }
179
180    //文章Detail單篇購買輸入框
181    if ($('.inputNumber').length > 0) {
182        $('.inputNumber').bootstrapNumber();
183    }
184
185    //文章Detail字放大
186    if ($('.fontBtn').length > 0) {
187        $('.fontBtn').click(function () {
188            //影片用
189            if ($('.videoText').length > 0) {
190                $('.videoText').toggleClass('fontBig');
191            }
192            else {
193                $('.edit').toggleClass('fontBig');
194            }
195            $(this).toggleClass('fontBtnChange')
196        });
197    }
198
199    //文章Detail左側小版選單
200    if ($('.articleMenuItem .dropright a').length > 0) {
201        $('.articleMenuItem .dropright a').click(function () {
202            $('body').addClass('modal-openC');
203            $('.articleMenuItem .closeBtn').click(function () {
204                $('body').removeClass('modal-openC');
205            });
206        });
207    }
208    if ($('.mobileBtn').length > 0) {
209        $('.mobileBtn').click(function () {
210            $('.articleMenu').toggleClass('articleMenuOpen');
211            $(this).toggleClass('mobileBtnOpen')
212        });
213    }
214
215
216
217    //文章出處
218    if ($('.provenanceArticleSlick').length > 0) {
219        $('.provenanceArticleSlick').slick({
220            dots: true,
221            infinite: true,
222            speed: 500,
223            arrows: true,
224            slidesToShow: 1,
225            slidesToScroll: 1,
226            autoplay: true,
227            autoplaySpeed: 2000,
228            prevArrow: '<button type="button" class="slick-prev provenanceBtn"><i class="icon-previous2"></i></button>',
229            nextArrow: '<button type="button" class="slick-next provenanceBtn"><i class="icon-previous"></i></button>',
230        });
231    }
232
233    //文章Detail頁編輯器限高度開閤
234    if ($('.toggleBox').length > 0) {
235        $('.toggleBox').expandable({
236            height: 250,
237            // expand_responsive: 992,
238            // no_less: true,
239            offset: 30,
240            more: '&nbsp;',
241            less: '&nbsp; ',
242        });
243    }
244
245    //文章Detail頁編輯器兩欄限高度開閤
246    if ($('.twocolumn').length > 0) {
247        $('.twocolumn .expand-bar').click(function () {
248            $(this).parent().parent().parent().toggleClass('fullWidth')
249        });
250    }
251    //文章Detail頁建議問題
252    if ($('.questionSlick').length > 0) {
253        $('.questionSlick').slick({
254            dots: true,
255            infinite: true,
256            speed: 500,
257            arrows: true,
258            slidesToShow: 1,
259            slidesToScroll: 1,
260            autoplay: true,
261            autoplaySpeed: 2000,
262            prevArrow: '<button type="button" class="slick-prev provenanceBtn"><i class="icon-previous2"></i></button>',
263            nextArrow: '<button type="button" class="slick-next provenanceBtn"><i class="icon-previous"></i></button>',
264        });
265    }
266
267    //大版打開搜尋隠藏進度條title及左側選單
268    if ($('.search.dropdownBoxSet').length > 0) {
269        $('.search.dropdownBoxSet').on('show.bs.dropdown', function (e) {
270            $('body').addClass('hiddenObject');
271        });
272        $('.search.dropdownBoxSet').on('hide.bs.dropdown', function (e) {
273            $('body').removeClass('hiddenObject');
274        });
275    }
276
277
278    //文章Detail進度條
279    if ($('#track-progress').length > 0) {
280        $('#track-progress').scrollProgress({
281            customCss: true
282        });
283    }
284
285    // scroll animate 目前僅首頁
286    if ($('.clickAnimate  a').length > 0) {
287        $(".clickAnimate  a").on("click", function () {
288            var hrefLink = $(this).attr("href");
289            $("html,body").animate({
290                scrollTop: $(hrefLink).offset().top
291            },
292                800
293            );
294        });
295    }
296
297    // scroll animate tab
298    if ($('.tabAnimate  a').length > 0) {
299        $(".tabAnimate  a").on("click", function () {
300            jQuery("html,body").animate({
301                scrollTop: 0 + $('.fixedInfo').offset().top - $('.navBox').innerHeight()
302            }, 1000);
303        });
304    }
305
306    //滿版版型 精選專題tab
307    if ($('.titleSlick').length > 0) {
308        $('.titleSlick').slick({
309            dots: false,
310            infinite: true,
311            speed: 500,
312            arrows: true,
313            slidesToShow: 4,
314            slidesToScroll: 1,
315            autoplay: false,
316            autoplaySpeed: 2000,
317            focusOnSelect: true,
318            prevArrow: '<button type="button" class="slick-prev provenanceBtn"><i class="icon-previous2"></i></button>',
319            nextArrow: '<button type="button" class="slick-next provenanceBtn"><i class="icon-previous"></i></button>',
320            responsive: [{
321                breakpoint: 1441,
322                settings: {
323                    slidesToShow: 3,
324
325                }
326            }, {
327                breakpoint: 769,
328                settings: {
329                    slidesToShow: 2,
330
331                }
332            }, {
333                breakpoint: 641,
334                settings: {
335                    slidesToShow: 1,
336
337                }
338            }]
339        });
340    }
341
342    //滿版版型 精選專題tab active狀態
343    if ($('.titleFullVersionCtn .titleFullVersionItem').length > 0) {
344        $('.titleFullVersionCtn .titleFullVersionItem a').click(function () {
345            $('.titleFullVersionCtn .titleFullVersionItem a').removeClass('active');
346            $(this).addClass('active');
347        });
348    }
349
350
351    //計算 elementOffset top
352    if ($('.fixedInfo').length > 0) {
353        function elementOffset() {
354            var offset = $('.fixedInfo').offset().top - $(window).scrollTop() - $('.navBox').innerHeight();
355            if (offset <= 0) {
356                if ($("body").hasClass('fixedProgress') == false) {
357                    $('body').addClass('fixedProgress');
358                }
359            } else if (offset > 0) {
360                $('body').removeClass('fixedProgress');
361            }
362        }
363        elementOffset();
364        $(window).scroll(elementOffset);
365    }
366
367
368
369    // Load Facebook SDK for JavaScript
370    if ($('.fb-customerchat').length > 0) {
371        window.fbAsyncInit = function () {
372            FB.init({
373                xfbml: true,
374                version: 'v10.0'
375            });
376        };
377
378        (function (d, s, id) {
379            var js, fjs = d.getElementsByTagName(s)[0];
380            if (d.getElementById(id)) return;
381            js = d.createElement(s);
382            js.id = id;
383            js.src = 'https://connect.facebook.net/zh_TW/sdk/xfbml.customerchat.js';
384            fjs.parentNode.insertBefore(js, fjs);
385        }(document, 'script', 'facebook-jssdk'));
386    }
387
388    //shopping cart加入購物車 顯示狀態
389    if ($('.articleMenuItem .buyBox ').length > 0) {
390
391        $('.articleMenuItem .buyBox button.lightBoxBtn').on('click', function () {
392
393            $('.snackbar').toggleClass('show');
394
395            setTimeout(function () {
396
397                $('.snackbar').toggleClass('show');
398
399            }, 5000);
400
401        });
402    }
403
404    //edit 文章註記
405    $('.edit .edit-mark').on('click', function () {
406
407        var markNo = $(this.hash);
408
409        $('html,body').animate({
410
411            scrollTop: markNo.offset().top - 100
412
413        }, 1000);
414
415        return false;
416
417    });
418
419    //nav 小版時 購物車有東西 要顯示
420    if ($(window).outerWidth() < 991 && $('nav .topMenuBox>.topMenu>li.shopCart .dropdown-menu>.ctn>div').hasClass('listBox')) {
421
422        $('nav .topMenuBox>.topMenu>li.shopCart').css('display', 'flex');
423    }
424
425
426    //footer ad banner
427    if ($('.footer_ad_banner .titleFullVersionCtn').length > 0) {
428        $('.footer_ad_banner .titleFullVersionCtn').slick({
429            dots: true,
430            infinite: true,
431            speed: 500,
432            arrows: true,
433            slidesToShow: 4,
434            slidesToScroll: 1,
435            autoplay: true,
436            autoplaySpeed: 2000,
437            focusOnSelect: true,
438            prevArrow: '<button type="button" class="slick-prev provenanceBtn"><i class="icon-previous2"></i></button>',
439            nextArrow: '<button type="button" class="slick-next provenanceBtn"><i class="icon-previous"></i></button>',
440            responsive: [
441                {
442                    breakpoint: 1300,
443                    settings: {
444                        slidesToShow: 3,
445                    },
446                },
447                {
448                    breakpoint: 769,
449                    settings: {
450                        slidesToShow: 2,
451                    },
452                },
453                {
454                    breakpoint: 640,
455                    settings: {
456                        slidesToShow: 1,
457                    },
458                },
459            ],
460        });
461
462        // footer_banner();
463        // $(window).resize(function () {
464        //     console.log('in')
465        //     footer_banner();
466        // });
467    }
468
469
470    // function footer_banner() {
471    //     console.log($('.footer_ad_banner .titleFullVersionCtn .slick-slide').length)
472    //     console.log($(window).outerWidth())
473
474    //     if ($('.footer_ad_banner .titleFullVersionCtn .slick-slide').length <= 4 && $(window).outerWidth() > 1300) {
475    //         console.log('in2')
476    //         $('.footer_ad_banner ul.slick-dots').hide();
477    //     }
478    //     else {
479    //         $('.footer_ad_banner ul.slick-dots').show();
480    //     }
481    // }
482
483});
484
485// 針對IE可寫css
486if ( /*@cc_on!@*/ false) {
487    document.documentElement.className += ' ie' + document.documentMode;
488}
489if ( /*@cc_on!@*/ true) {
490    document.documentElement.className += ' ie' + document.documentMode;
491}
492
493
494//左側選單scroll style    
495$("nav .leftMenu .dropdown-menu,nav .topMenuBox .listBox").mCustomScrollbar({ theme: "minimal-dark" });
496
497
498//選單固定
499function fixedHeader() {
500    if ($(window).scrollTop() > 0) {
501        if (!$("body").hasClass("fixedHeader")) {
502            $('body').addClass("fixedHeader");
503        }
504    }
505    else {
506        $('body').removeClass("fixedHeader");
507    }
508}
509$(window).scroll(function () { fixedHeader() });
510
511
512
513
514//svg fill color
515SVGInject(document.querySelectorAll("img.svg"));
516

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.