PageSourceSearch

http://co19debate.com/js/index_nav29e36.js?v

js co19debate.com collected 2026-10-04 09:03:50 UTC 12,785 bytes, 372 lines download raw bytes

1!(function (window, document) {
2    /*二级跳转至移动端*/
3    // return
4    var location = window.location.href, //完整链接
5        pageName = location.substr(location.lastIndexOf('/') + 1), //页面名称
6        isIndex =
7            pageName == '' ||
8            pageName == 'home.htm' ||
9            pageName == 'index.htm'|| //是否首页
10            pageName == 'index.html', //是否首页
11        isMobile =
12            window.navigator.userAgent.toLowerCase().indexOf('mobile') > 0
13                ? true
14                : false, //是否移动端
15        m_url = ''
16    if (isMobile) {
17        if (isIndex) {
18            m_url =
19                location.substr(0, location.lastIndexOf('/') + 1) +
20                'mobile/index_m.htm'
21        } else {
22            if (pageName == 'xhwlyzb.htm') return //路演现场
23
24            m_url =
25                location.substr(0, location.lastIndexOf('/') + 1) +
26                'mobile/' +
27                pageName.substr(0, pageName.indexOf('.')) +
28                '_m.htm'
29        }
30        window.location.href = m_url
31    } else {
32        return
33    }
34})(window, document)
35!(function (window, document) {
36    /*导航交互*/
37    var $nav = $('.nav'),
38        $main_box = $nav.find('.nav-main-item'), //主导航a父级
39        $main_a = $main_box.find('.nav-main-items'), //主导航a
40        $main_bg = $main_box.find('.nav-bg'), //背景图
41        $sub_nav = $nav.find('.sub-nav'), //副导航
42        $sub_nav_box = $sub_nav.find('.sub-nav-box'), //副导航box
43        $sub_nav_item = $sub_nav.find('.sub-nav-item'), //副导航a父级
44        $sub_a = $sub_nav.find('.sub-nav-items'), //副导航a
45        $sub_bg = $sub_nav.find('.sub-nav-bg'),
46        $onWhichPage = $nav.find('.nav-on'), //当前页,预留---
47        main_box = document.querySelector('.nav-main-item'),
48        main_a = document.querySelectorAll('.nav-main-items'), //主导航a
49        sub_a = document.querySelectorAll('.sub-nav-items'), //副导航a
50        sub_nav_box = document.querySelector('.sub-nav-box'), //副导航box
51        sub_nav_item = document.querySelectorAll('.sub-nav-item'), //副导航a父级
52        main_a_len = main_a.length,
53        pageHref = window.location.href,
54        isIe8 =
55            window.navigator.userAgent.toLowerCase().indexOf('msie 8') != -1
56                ? true
57                : false,
58        arrW = [],
59        offsetx = 52, //对应a标签的margin值;
60        oldIndex = -1,
61        newIndex = 0,
62        _timer = null,
63        isIndex0 = true,
64        isSubExpand = false,
65        aniDur = 100, //展开时长;
66        mainBgH = 350, //展开时背景高度;
67        mainBgh = $nav.height(),
68        renderXInit = false,
69        tempHref = '',
70        defaultColor = '#4c4c4c', //主导航文字没选中时颜色;
71        changeColor = '#fff' //主导航文字选中时颜色;
72    pageHref = pageHref.substr(pageHref.lastIndexOf('/') + 1, pageHref.length) //获取浏览器地址栏网址具体页面,若没有则默认为index
73    tempHref = pageHref
74    $sub_nav_item.css({
75        height: mainBgH - 104,
76    })
77
78    var bindEv = function (obj, evNameWithoutOn, fn, useCapture) {
79        var _useCapture = useCapture || false
80        if (window.addEventListener) {
81            obj.addEventListener(evNameWithoutOn, fn, _useCapture)
82        } else if (window.attachEvent) {
83            obj.attachEvent('on' + evNameWithoutOn, fn)
84        }
85    }
86    var unbindEv = function (obj, evNameWithoutOn, fn) {
87        if (window.removeEventListener) {
88            obj.removeEventListener(evNameWithoutOn, fn)
89        } else if (window.detachEvent) {
90            obj.detachEvent('on' + evNameWithoutOn, fn)
91        }
92    }
93    var getDis = function (length, arr) {
94        var i = 0,
95            len = length,
96            sum = 0
97        for (; i < len; i++) {
98            sum += arr[i]
99        }
100        return sum
101    }
102    !(function () {
103        var j = 0,
104            len = main_a_len
105        for (; j < len; j++) {
106            main_a[j].index = j
107            sub_nav_item[j].index = j
108            arrW.push(main_a[j].offsetWidth)
109        }
110        whereHrefForm()
111        //if(isIndex0) main_bg.style.height="70px";
112    })()
113
114    function whereHrefForm() {
115        var i = 0,
116            href = '',
117            len = main_a_len - 1
118        for (; i < len; i++) {
119            console.log(pageHref);
120            href = main_a[i].href
121            href = href.substr(href.lastIndexOf('/') + 1, href.length)
122            console.log(href,tempHref);
123            href = href.indexOf(tempHref) //在主导航中查找地址栏中对应的页面地址
124            // return;
125            console.log(href, pageHref,1234455)//有则为false
126            if (pageHref == '' || href == -1) {
127                //如果地址栏具体页面为空,说明使用的主页的目录映射,实际页面为index;
128                oldestIndex = oldIndex = pageHref = 0
129                $main_a.eq(pageHref).addClass('nav-on')
130                // console.log("网址栏为空");
131                return
132            } else if (pageHref != '' && href != -1) {
133                //在主导航中找到对应;
134                oldestIndex = oldIndex = pageHref = i
135                $main_a.eq(pageHref).addClass('nav-on')
136                // console.log("网址栏不为空且在主导航中");
137                return
138            }
139        }
140        getSubHref()
141    }
142
143    function getMainHref() {
144        var i = 0,
145            len = main_a_len.length - 1,
146            href = ''
147        for (; i < len; i++) {
148            href = sub_a[i].href
149            href = href.substr(href.lastIndexOf('/') + 1, href.length)
150            href = href.indexOf(tempHref) //在副导航中查找对应的地址栏页面文件名;
151            // console.log(href);
152            if (href != -1) {
153                //匹配成功
154                // console.log("匹配成功");
155                oldestIndex = oldIndex = pageHref = sub_a[i].parentNode.index
156                // console.log(oldIndex);
157                $main_a.eq(oldestIndex).addClass('nav-on')
158                return
159            } else if (href == -1) {
160                //匹配不成功,则说明地址栏文件既不在主导航中也不在副导航中,则使默认index为选中状态;
161                // console.log("未在副导航中找到");
162                oldestIndex = oldIndex = pageHref = 0
163                $main_a.eq(oldestIndex).addClass('nav-on')
164            }
165        }
166    }
167
168    function getSubHref() {
169        var i = 0,
170            len = sub_a.length - 1,
171            href = ''
172        for (; i < len; i++) {
173            href = sub_a[i].href
174            href = href.substr(href.lastIndexOf('/') + 1, href.length)
175            href = href.indexOf(tempHref) //在副导航中查找对应的地址栏页面文件名;
176            // console.log(href);
177            if (href != -1) {
178                //匹配成功
179                // console.log("匹配成功");
180                oldestIndex = oldIndex = pageHref = sub_a[i].parentNode.index
181                // console.log(oldIndex);
182                $main_a.eq(oldestIndex).addClass('nav-on')
183                return
184            } else if (href == -1) {
185                //匹配不成功,则说明地址栏文件既不在主导航中也不在副导航中,则使默认index为选中状态;
186                // console.log("未在副导航中找到");
187                oldestIndex = oldIndex = pageHref = 0
188                $main_a.eq(oldestIndex).addClass('nav-on')
189            }
190        }
191    }
192
193    var ev_nav_main_mouseenter = function (ev) {
194        //主副导航鼠标悬浮事件
195        var e = ev || window.event,
196            _target = e.target || e.srcElement,
197            dis = 0,
198            isMainHover =
199                _target.getAttribute('class').indexOf('nav-main-items') != -1,
200            isSubBoxHover =
201                _target.getAttribute('class').indexOf('sub-nav-item') != -1,
202            isSubHover =
203                _target.getAttribute('class').indexOf('sub-nav-items') != -1
204        // console.log(isMainHover,isSubBoxHover,isSubHover);
205        if (
206            _target.nodeType == 1 &&
207            (isMainHover || isSubBoxHover || isSubHover)
208        ) {
209            if (isMainHover) {
210                //主导航a;
211                newIndex = _target.index
212                clearTimer()
213                subExpand()
214                if (newIndex == 0) {
215                    // console.log("a")
216                    unStrenchBg()
217                }
218            } else if (isSubBoxHover) {
219                if (isSubHover) {
220                    //副导航a
221                    newIndex = _target.parentNode.index
222                    if (newIndex == 0) unStrenchBg()
223                } else {
224                    //副导航box
225                    newIndex = _target.index
226                    if (newIndex == 0) unStrenchBg()
227                }
228            } //end if..if else...;
229            dis = getDis(newIndex, arrW) + offsetx * newIndex
230            // 判断事件重复调用
231            if (newIndex != oldIndex) {
232                //如果是在副导航的同一栏a标签切换,则不会变化newIndex
233                // render(dis,newIndex,oldIndex);
234            }
235            render(dis, newIndex, oldIndex)
236        } //
237    }
238
239    function subExpand() {
240        if (isSubExpand) return
241        $sub_nav.slideDown(aniDur / 1.5)
242        isSubExpand = true
243        strenchBg()
244    }
245
246    function turnFontColor(index, oldIndex) {
247        $main_a.css('color', defaultColor)
248        $main_a.eq(index).css('color', changeColor)
249    }
250
251    function renderX(dis, index, oldIndex) {
252        // console.log(dis,index,oldIndex);
253        $main_bg.stop(true, false).animate(
254            {
255                left: dis,
256                width: arrW[index],
257            },
258            aniDur * 0.8
259        )
260        oldIndex = pageHref
261        //turnFontColor(pageHref,oldIndex)
262        if (!renderXInit) {
263            turnFontColor(pageHref, oldIndex)
264            renderXInit = false
265        }
266    }
267
268    function render(dis, index, oldIndex) {
269        // console.log(newIndex);
270        if (!isSubExpand) subExpand()
271        if (index == 0) {
272            unStrenchBg()
273            $main_bg.stop(true, false).animate(
274                {
275                    left: dis,
276                    width: arrW[index],
277                },
278                aniDur
279            )
280        } else {
281            $main_bg.stop(true, false).animate(
282                {
283                    left: dis,
284                    width: arrW[index],
285                },
286                aniDur
287            )
288            strenchBg()
289        }
290        turnFontColor(newIndex, oldIndex)
291        oldIndex = newIndex
292        //$main_bg.stop(true,false).animate({"left":dis,"width":arrW[index]},aniDur,strenchBg)
293    }
294
295    function strenchBg() {
296        $main_bg.css({
297            height: mainBgH,
298        })
299        //$main_bg.stop("",false,true).animate({"height":mainBgH},aniDur/2);
300    }
301
302    function unStrenchBg() {
303        $main_bg.css({
304            height: mainBgh,
305        })
306        //$main_bg.stop("",true,true).animate({"height":mainBgh},aniDur/5);
307    }
308
309    function clearTimer() {
310        if (_timer) {
311            clearTimeout(_timer)
312            _timer = null
313        }
314    }
315
316    function subUp(fn) {
317        // subExpand();
318        $sub_nav.slideUp(aniDur / 2)
319        $main_bg.stop('', true, true).animate(
320            {
321                height: mainBgh,
322            },
323            aniDur / 2,
324            function () {
325                renderX(
326                    getDis(pageHref, arrW) + offsetx * pageHref,
327                    pageHref,
328                    oldIndex
329                )
330            }
331        )
332        turnFontColor(newIndex, oldIndex)
333        isSubExpand = false
334    }
335
336    function sub_nav_up() {
337        clearTimer()
338        _timer = setTimeout(subUp, 300)
339        $main_a.eq(newIndex).addClass('nav-on')
340        // console.log(newIndex);
341    }
342
343    // $main_box.on("mouseenter",function(){
344    // 	clearTimer();
345    // 	subExpand();
346    // })
347    $main_box.on('mouseleave', function () {
348        sub_nav_up()
349    })
350    $sub_nav.on('mouseenter', function () {
351        clearTimer()
352        subExpand()
353    })
354    $sub_nav.on('mouseleave', function () {
355        sub_nav_up()
356    })
357
358    renderX(getDis(pageHref, arrW) + offsetx * pageHref, pageHref, 0)
359    bindEv(main_box, 'mouseover', ev_nav_main_mouseenter)
360    bindEv(sub_nav_box, 'mouseover', ev_nav_main_mouseenter)
361
362    /*
363    //底部分享预留
364    $('.foot-share-ico-weixin').hover(
365    function() {
366        $('.foot-share-ico-ewm').show();
367    },
368    function() {
369        $('.foot-share-ico-ewm').hide();
370    }
371    */
372})(window, document)

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.