PageSourceSearch

https://www.filez.com/public/js/header_scroll.js?1790366071

js filez.com collected 2026-09-25 19:55:09 UTC 6,103 bytes, 160 lines download raw bytes

1jQuery(function ($) {
2    function setHeaderColor() { //设置头部背景色透明白色字
3        $('#navbar').addClass('scroll-show')
4        $('#button_enter .btn').css({
5            'color': '#fff',
6            'border-right': '1px solid #fff'
7        })
8
9    }
10
11    // pic动效
12    var waveObj = {},
13        indexWaveObj = {};
14    $('body').ready(function () { //页面刷新时之前的滚动位置的样式设置
15        var scrollTop = $(window).scrollTop();
16        if (window.menuId !== 'map' 
17        && window.menuId !== 'news' 
18        && window.menuId !== 'download'
19        && window.menuId !== 'error') {
20            if (scrollTop > 0) {
21          
22                $('#navbar').removeClass('top-show').addClass('scroll-show')
23                $('#button_enter .btn').css({
24                    'color': '#1B2733',
25                    'border-right': '1px solid #1B2733'
26                })
27
28            } else {
29                setHeaderColor()
30            }
31        } else {//新闻页、下载页白色背景黑色字黑色logo
32            $('#navbar').removeClass('top-show').addClass('scroll-show')
33          
34            $('#button_enter .btn').css({
35                'color': '#1B2733',
36                'border-right': '1px solid #1B2733'
37            })
38        }
39
40        var waves = $('.micro-wave'),
41            wavesLength = waves.length;
42        if (wavesLength > 0) {
43            for (var i = 0; i < wavesLength; i++) {
44                waveObj['img' + i] = waves[i];
45            }
46        }
47
48        // 针对首页特殊处理动效
49        var indexWaves = $('.micro-wave-index'),
50            indexWavesLength = indexWaves.length;
51        if (indexWavesLength > 0) {
52            for (var i = 0; i < indexWavesLength; i++) {
53                indexWaveObj['block' + i] = indexWaves[i];
54            }
55        }
56        animateIndex(scrollTop)
57        // 延迟加入星轨动效
58        setTimeout(insertStarAnimation, 2000);
59    });
60    // 补充导航fix导致的小于1200无法横向滚动
61    window.onscroll = function(){
62          var sl = -Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
63          document.getElementById("navbar").style.left = sl + 'px'; //重新设置横向滚动条位置
64        }
65    var scrollFlag = true;
66    $(window).scroll(function () {
67        var scrollTop = $(window).scrollTop();
68        animate(scrollTop)
69        animateIndex(scrollTop)
70        if (scrollTop > 0) { //滚动时白色背景黑色字黑色logo
71            if (!scrollFlag) return;
72            $('#navbar').removeClass('top-show').addClass('scroll-show')
73            $('#button_enter .btn').css({
74                'color': '#1B2733',
75                'border-right': '1px solid #1B2733'
76            })
77            scrollFlag = false;
78        } else {
79            if (window.menuId !== 'map' 
80            && window.menuId !== 'news' 
81            && window.menuId !== 'download'
82            && window.menuId !== 'error') {
83                //新闻页、下载页滚动到顶保持白色背景黑色字黑色logo
84                // $('#navbar').removeClass('scroll-show').addClass('top-show')
85            }
86            scrollFlag = true;
87        }
88    });
89
90    function animate(scrollTop) {
91        Object.keys(waveObj).forEach(function (t) {
92            var offsetTop = getPosition(waveObj[t]).top
93            scrollTop + document.body.clientHeight >= offsetTop && scrollTop + document.body.clientHeight < offsetTop + waveObj[t].clientHeight && $(waveObj[t]).addClass('wave-up');
94            scrollTop + document.body.clientHeight < offsetTop && $(waveObj[t]).removeClass('wave-up');
95        })
96    }
97    function animateIndex(scrollTop) {
98        Object.keys(indexWaveObj).forEach(function (t) {
99            if ($(indexWaveObj[t]).hasClass('active')) { return; }
100            var offsetTop = getPosition(indexWaveObj[t]).top;
101            // distance:开始动画的位置
102            var distance = document.body.clientHeight / 2;
103            scrollTop + distance >= offsetTop && scrollTop + distance < offsetTop + indexWaveObj[t].clientHeight && $(indexWaveObj[t]).addClass('active');
104        })
105    }
106
107
108    function getPosition(obj) {
109        var left = 0;
110        var top = 0;
111        while (obj.offsetParent) {
112            left += obj.offsetLeft;
113            top += obj.offsetTop;
114            obj = obj.offsetParent;
115        }
116        return { 'left': left, 'top': top }
117    }
118
119    function insertStarAnimation() {
120        var tpl = '<div class="star">' +
121            '<img class="bg" src="/public/images/indexactive/star-bg.svg">' +
122            '<img class="inner" src="/public/images/indexactive/star-inner.svg">' +
123            '<img class="mid" src="/public/images/indexactive/star-mid.svg">
123' +
124            '<img class="outer" src="/public/images/indexactive/star-outer.svg">' +
125            '</div>'
126        // $('.header-img').prepend($(tpl));
127        if( getCookie('language')=== 'zh'){
128            $('.main-banner').prepend($(tpl)); 
129            setTimeout(function () {
130                $('.main-banner .star').addClass('rotate');
131                setTimeout(function () {
132                    $('.main-banner .star').fadeIn(5000);
133                }, 300)
134            }, 0)
135        }else{
136            $('.header-img').prepend($(tpl));
137            setTimeout(function () {
138                $('.header-img .star').addClass('rotate');
139                setTimeout(function () {
140                    $('.header-img .star').fadeIn(5000);
141                }, 300)
142            }, 0)
143        }
144        
145      
146    }
147    function getCookie(c_name) {
148        if (document.cookie.length > 0)     {
149            c_start = document.cookie.indexOf(c_name + "=")           
150            if (c_start != -1){ 
151                c_start = c_start + c_name.length + 1 
152                c_end = document.cookie.indexOf(";", c_start) 
153                if (c_end == -1)   
154                    c_end = document.cookie.length   
155                    return unescape(document.cookie.substring(c_start, c_end))   
156                } 
157            } 
158        return "" 
159    }
160})

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.