PageSourceSearch

https://cmppj.org.tw/content/js/site/site.nav.js

js cmppj.org.tw collected 2026-10-07 15:17:21 UTC 4,642 bytes, 140 lines download raw bytes

1$(function () {
2    var _flagNav = null;
3    var t;
4
5    //·í¬O®à¾÷®É
6    if (!browser.iphone() && !browser.ipad() && !browser.isMobile()) {
7        $('.js-nav-parent').unbind('mouseover').bind('mouseover', function (e) {
8            var _this = $(this);
9            if (!_flagNav) {
10                _flagNav = _this;
11                _flagNav.find('.nav-subnav').slideDown('easeOutExpo');
12            } else {
13                if (t) clearTimeout(t);
14                if (_this != _flagNav) {
15                    t = setTimeout(function () {
16                        _flagNav = _this;
17                        _this.siblings().find('.nav-subnav').hide();
18                        _flagNav.find('.nav-subnav').show();
19                    }, 100);
20                }
21            }
22        });
23        $('.js-nav-parent').unbind('mouseout').bind('mouseout', function (e) {
24            if (t) clearTimeout(t);
25            t = setTimeout(function () {
26                _flagNav.find('.nav-subnav').slideUp('easeOutExpo');
27                _flagNav = null;
28            }, 300);
29        });
30    }
31
32    $('.js-search').bind('click', function (e) {
33        $('.header-search').addClass('active');
34        $('body').removeClass('mobile-nav-active');
35    });
36
37    $('.js-search-close').click(function (event) {
38        $('.header-search').removeClass('active');
39        console.log('close');
40        event.stopPropagation();
41    });
42    $('.header-search-block').click(function (event) {
43        event.stopPropagation();
44        //location.href = window.location + location.pathname;
45    });
46    $('.js-search-input').keyup(function () {
47        if (!(($(this).val()) == "")) {
48            console.log("have value");
49            $(this).siblings('label').addClass('active');
50        } else {
51            console.log("no value");
52            $(this).siblings('label').removeClass('active');
53        }
54    });
55
56
57
58    
59    $('#btnSearch').click( function (e) {
60        //e.preventDefault;
61        var value = $('.js-search-input').val();
62        event.stopPropagation();
63        window.location.href = "/cht/search?name=" + value;
64    });
65
66    $('.mobile-nav').click(function () {
67        console.log('mobile-nav');
68    })
69
70    $('#js-nav-close').bind('click', function (e) {
71        subnavOn = false;
72        $('.nav-subnav').slideUp();
73        $('#js-nav-close').hide();
74    });
75
76    $('#js-mobile-nav-toggle').bind('click', function (e) {
77        $('body').toggleClass('mobile-nav-active');
78        return false;
79    });
80
81    $('#js-mobile-nav-close').bind('click', function (e) {
82        $('body').removeClass('mobile-nav-active');
83        return false;
84    });
85
86    $('.mobile-nav .js-expand-title').bind('click', function (e) {
87        $(this).parent().find('.nav-subnav').slideToggle(function () {
88            $(this).parent().find('.nav-subnav:hidden').parent().find('.arrow-box').removeClass('arrow-box-expand');
89        });
90        $(this).parent().find('.nav-subnav:visible').parent().find('.arrow-box').addClass('arrow-box-expand');
91    });
92
93
94
95    if (browser.iphone() || browser.ipad() || browser.isMobile()) {
96        $("#nav-revenue").attr("href", "http://mops.twse.com.tw/mops/web/index");
97        $("#nav-revenue").attr("target", "_blank");
98    }
99    
100    //ÂIÀ»scroll¨ìsection
101    $('.nav-subnav li a').click(function () {
102        var href = $(this).attr("href");
103        var hash = href.split('#')[1];
104        $("html,body").animate({ scrollTop: $('#' + hash).offset().top - 100 });
105    });
106
107
108    // Hide Header on on scroll down
109    //var didScroll;
110    //var lastScrollTop = 0;
111    //var delta = 5;
112    //var navbarHeight;
113
114    //$(window).scroll(function (event) {
115    //    didScroll = true;
116    //});
117
118    //setInterval(function () {
119    //    if (didScroll) {
120    //        hasScrolled();
121    //        didScroll = false;
122    //    }
123    //}, 250);
124
125    //function hasScrolled() {
126    //    var st = $(this).scrollTop();
127    //    if (Math.abs(lastScrollTop - st) <= delta) return;
128    //    if ($(window).width() < 900) {
129    //        navbarHeight = $('.header').outerHeight();
130    //        if (st > lastScrollTop && st > navbarHeight) {
131    //            $('.header').removeClass('scroll-show').addClass('scroll-hide');
132    //        } else {
133    //            if (st + $(window).height() < $(document).height()) {
134    //                $('.header,.nav').removeClass('scroll-hide').addClass('scroll-show');
135    //            }
136    //        }
137    //    }
138    //    lastScrollTop = st;
139    //}
140});

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.