PageSourceSearch

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

js tsinghua.edu.cn collected 2026-09-24 08:24:25 UTC 6,268 bytes, 197 lines download raw bytes

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

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.