PageSourceSearch

https://www.tsinghua.edu.cn/new/script/js.js

js tsinghua.edu.cn collected 2026-09-24 08:24:31 UTC 7,471 bytes, 240 lines download raw bytes

1$(function () {
2    //--
3    {
4        if( $(window).width() >= 800) {
5             $('.navA').on("mouseover",function () {
6                if ($('body').hasClass('navShow')) {
7                    //$('body').removeClass('navShow')
8                } else {
9                    $('body').addClass('navShow')
10                }
11                return false
12            });
13         }
14
15
16        $('.navA').click(function () {
17            if ($('body').hasClass('navShow')) {
18                $('body').removeClass('navShow')
19            } else {
20              //if( $(window).width() < 800) {
21                 $('body').addClass('navShow')
22              //  }
23            }
24            return false
25        });
26        $('.g-head .nav').find('li').each(function () {
27            var li = $(this);
28            if($(window).width() < 800 && li.find('.list2').length > 0){
29                li.find('a.name').click(function () {
30                    if(li.hasClass('on')){
31                        li.removeClass('on')
32                    }else{
33                        li.addClass('on')
34                    }
35                    return false
36                })
37            }
38        })
39    }
40
41    //--返回顶部
42    scroll2top();
43
44    //--js下拉选择框
45    {
46        $('.select').each(function () {
47            var select = $(this);
48            select.find('select').change(function () {
49                select.find('span').html($(this).find("option:selected").text());
50            })
51        })
52    }
53
54    {
55        $('.form').find('li').each(function () {
56            var li = $(this);
57            li.find('input').focus(function () {
58                li.addClass('on')
59            });
60            li.find('input').blur(function () {
61                li.removeClass('on')
62            });
63            li.find('textarea').focus(function () {
64                li.addClass('on')
65            });
66            li.find('textarea').blur(function () {
67                li.removeClass('on')
68            })
69        })
70    }
71
72    {
73        var layer = $('.p-layer');
74        layer.click(function () {
75            layer.removeClass('show');
76            $('body').removeClass('hidden');
77        });
78        layer.find('.container').click(function (e) {
79            e.stopPropagation()
80        })
81    }
82
83    {
84        $('.g-foot .img li').hover(
85            function () {
86                $(this).addClass('on')
87            },
88            function () {
89                $(this).removeClass('on')
90            }
91        )
92    }
93
94 {
95        var dom = $('.g-foot .img-list')
96        var li = dom.find('li')
97        var curr = 0
98        var list = [
99            {width: '1.3rem', left: '0rem', top: '0rem', zIndex: 2},
100            {width: '1.1rem', left: '1.2rem', top: '.125rem', zIndex: 1},
101            {width: '1.1rem', left: '-1rem', top: '.125rem', zIndex: 0},
102        ]
103        if(window.innerWidth < 800){
104            list = [
105                {width: '1.7rem', left: '0rem', top: '0rem', zIndex: 2},
106                {width: '1.3rem', left: '1.4rem', top: '.25rem', zIndex: 1},
107                {width: '1.3rem', left: '-1.2rem', top: '.25rem', zIndex: 0},
108            ]
109        }
110        change()
111        setInterval(function (){
112            if(curr < li.length - 1){
113                curr ++
114            }else{
115                curr = 0
116            }
117            change()
118        }, 5000)
119        function change(){
120            li.each(function (i){
121                var j = i - curr
122                if(j < 0){
123                    j += li.length
124                }
125               
126                if(j > 3 || j < 0){
127                    setPosition($(this), list[0], 0)
128                }else{
129                    setPosition($(this), list[j], 1)
130                }
131            })
132        }
133        function setPosition(li, position, opacity){
134            //var {width, left, top, zIndex} = position;
135            TweenMax.to(li, .5, {
136                'width': position.width,
137                'left': position.left,
138                'top': position.top,
139                'z-index': position.zIndex
140            })
141            TweenMax.to(li, 0, {
142                'opacity':opacity
143            })
144        }
145    }
146
147});
148
149function swiperFun(swiper) {
150    this.dom = swiper.dom;
151    this.domList  = this.dom;
152    this.dom.find('ul').addClass('swiper-wrapper');
153    this.dom.find('li').addClass('swiper-slide');
154    if(swiper.domList !== undefined){
155        this.domList = this.dom.find(swiper.domList)
156    }
157    if(this.dom.find('.num').length > 0){
158        this.dom.find('.num-total').html(this.dom.find('li').length)
159    }
160
161    this.change = function () {};
162    var that = this;
163    this.mySwiper = new Swiper(that.domList, {
164        loop: swiper.loop !== undefined ? swiper.loop : true,
165        autoplay: swiper.autoplay !== undefined ? swiper.autoplay : 5000,
166        autoplayDisableOnInteraction: false,
167        paginationClickable: true,
168        speed: 600,
169        slidesPerView: swiper.slidesPerView !== undefined ? swiper.slidesPerView : 1,
170        slidesPerGroup: swiper.slidesPerGroup !== undefined ? swiper.slidesPerGroup : 1,
171        centeredSlides: swiper.centeredSlides !== undefined ? swiper.centeredSlides : false,
172        slideToClickedSlide: swiper.slideToClickedSlide !== undefined ? swiper.slideToClickedSlide : false,
173        roundLengths: swiper.roundLengths !== undefined ? swiper.roundLengths : false,
174        pagination: that.dom.find('.dots'),
175        onSlideChangeStart: function(swiper){
176            if(that.dom.find('.num').length > 0){
177                that.dom.find('.num-curr').html(swiper.realIndex + 1)
178            }
179            that.change(swiper.realIndex);
180        }
181    });
182    this.dom.find('.prev').click(function () {
183        that.mySwiper.slidePrev();
184        return false
185    });
186    this.dom.find('.next').click(function () {
187        that.mySwiper.slideNext();
188        return false
189    })
190}
191
192//--选项卡-- tabFun({dom: $('.about'), curr: 0});
193function tabFun(tab) {
194    var btn = tab.dom.find('.tab-btn li'),
195        box = tab.dom.find('.tab-box');
196    btn.each(function (i) {
197        $(this).hover(
198            function () {
199                change(i)
200            },
201            function () {
202
203            }
204        )
205    });
206    change(tab.curr);
207    function change(curr) {
208        btn.removeClass('on');
209        btn.eq(curr).addClass('on');
210        box.hide();
211        box.eq(curr).fadeIn()
212    }
213}
214
215function scroll2top() {
216    var btn = $('.topA');
217    btn.click(function () {
218        $('body,html').stop(true, true).animate({scrollTop: 0}, 300);
219    });
220    $(window).scroll(function () {
221        if($(window).scrollTop() > $(window).height()){
222            btn.addClass('show')
223        }else{
224            btn.removeClass('show')
225        }
226    });
227}
228
229
230function arrayOne2Two(baseArray, n) {
231    var len = baseArray.length,
232        lineNum = len % n === 0 ? len / n : Math.floor( (len / n) + 1 ),
233        res = [];
234    for (var i = 0; i < lineNum; i++) {
235        // slice() 方法返回一个从开始到结束(不包括结束)选择的数组的一部分浅拷贝到一个新数组对象。且原始数组不会被修改。
236        var temp = baseArray.slice(i*n, i*n+n);
237        res.push(temp);
238    }
239    return res
240}

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.