PageSourceSearch

https://ucas.ac.cn/js/common.js?v=1784978441629

js ucas.ac.cn collected 2026-10-01 09:20:50 UTC 12,093 bytes, 375 lines download raw bytes

1$('.subNav').each(function(){
2	var $this = $(this);
3	$this.css('width', $this.parents('ul').width()).css('left', $this.parents('ul').offset().left - $this.parents('li').offset().left);
4});
5
6fixNav();
7function fixNav() {
8    var sWSon = document.documentElement.clientWidth;
9    var sHeight = document.documentElement.clientHeight;
10    var bodyHeight = document.body.scrollHeight;
11    var x = $('header').next().offset().top;
12    if (bodyHeight > sHeight + 100 && sWSon > 1024) {
13        $(window).scroll(function () {
14            var scrollTop = $(window).scrollTop();
15            if (scrollTop > 100) {
16                $('header').addClass('currents')
17                $('body').css('padding-top', x)
18            } else {
19                $('header').removeClass('currents')
20                $('body').css('padding-top', 0)
21            }
22        });
23    }
24}
25
26/*
27移动端主导航 
28例调用:mobileMenu('#gp-menu');
29*/
30mobideMenu();
31function mobideMenu(){
32    $(".mobile-inner-header .mobile-inner-header-icon").click(function(){
33        $(this).toggleClass("mobile-inner-header-icon-click mobile-inner-header-icon-out");
34        $('body').toggleClass('nav-open');
35        $('.black_bg01').slideToggle(200)
36      });
37
38
39    $('.black_bg01').click(function(){
40        $(".mobile-inner-header .mobile-inner-header-icon").toggleClass("mobile-inner-header-icon-click mobile-inner-header-icon-out");
41        $('body').toggleClass('nav-open');
42        $(this).slideToggle(300)
43        $('.logo').slideToggle(200)
44    })
45      $(".mobile-inner-nav li > a").each(function( index ) {
46        $( this ).css({'animation-delay': (index/20)+'s'});
47      });
48      $('.mobile-search-btn').click(function(){
49        $('.mobile_search').slideToggle(300)
50      })
51      $('.mobile-inner-nav li strong').click(function(){
52                $(this).parent().toggleClass('on');
53                if($(this).parent().hasClass('on')){
54                    $(this).addClass('icon-fanhui-copy ')
55                    $(this).removeClass('icon-fanhui')
56                    $(this).next('.mobile_subNav').slideDown(300)
57                    
58                }else{
59                    $(this).addClass('icon-fanhui')
60                    $(this).removeClass('icon-fanhui-copy');
61                    $(this).next('.mobile_subNav').slideUp(300)
62                }
63            })
64
65}
66
67// 二级页侧栏菜单
68function asideMenu(menu){
69	//当前状态高亮
70	$(menu).find('.active').each(function(){
71	  if($(this).parents('dl').hasClass('gp-second-nav')){
72	   $(this).parents('dl').css('display','block');
73	   $(this).parents('li').addClass('active')
74	   $(this).parents('li').find('.gp-toggles').addClass('icon-down').removeClass('icon-right');
75	  }
76	})
77	$(menu).find('.gp-toggles').click(function(){
78	  if($(this).parents('li').hasClass('active')){
79		  $(this).addClass('icon-right').removeClass('icon-down')
80		  $(this).next('.gp-second-nav').slideUp(500)
81		  $(this).parents('li').removeClass('active')
82		}else{
83		  $(this).addClass('icon-down').removeClass('icon-right');
84		  $(this).next('.gp-second-nav').slideDown(500);
85		  $(this).parents('li').siblings().find('.gp-second-nav').slideUp(500)
86		  $(this).parents('li').siblings().removeClass('active')
87		  $(this).parents('li').siblings().find('.gp-toggles').addClass('icon-right').removeClass('icon-down')
88		  $(this).parents('li').addClass('active')
89		}
90	  })
91  }
92 
93
94
95//移动端侧边栏菜单
96function mobileAsideMenu(menu,main){
97$(menu).find('.gp-m-inner-header').click(function(){
98	$(this).toggleClass("gp-m-inner-header-icon-click gp-m-inner-header-icon-out");
99	$(this).find('.iconfont').toggleClass("icon-jia icon-jian")
100	$(".gp-subNavm").slideToggle(500);
101
102});
103$('.gp-subNavm').find('.gp-m-toggle').click(function(){
104  if($(this).parents('li').hasClass('active')){
105	$(this).addClass('icon-right').removeClass('icon-down')
106	$(this).next('dl').slideUp(500)
107	$(this).parents('li').removeClass('active')
108  }else{
109	$(this).addClass('icon-down').removeClass('icon-right');
110	$(this).next('dl').slideDown(500);
111	$(this).parents('li').siblings().find('dl').slideUp(500)
112	$(this).parents('li').siblings().removeClass('active')
113	$(this).parents('li').siblings().find('.gp-m-toggle').addClass('icon-right').removeClass('icon-down')
114	$(this).parents('li').addClass('active')
115  }
116})
117};
118
119
120// 板块进入效果
121setTimeout("enterEffects();","200");
122$(document).ready(function(){
123	enterEffects();
124});
125$(window).resize(function(){
126	var resizeTimer = null;
127	if (resizeTimer) clearTimeout(resizeTimer);
128		resizeTimer = setTimeout(function(){
129		enterEffects();
130	},50);
131});
132$(window).scroll(function(){
133	enterEffects();
134});
135// 鼠标滚动渐渐出现
136$('.effect11,.effect21,.effect31,.effect41,.effect51,.effectChildren').each(function() {
137	$(this).find("li").each(function(index){
138		var len = $(this).parent().find("li").length;
139		$( this ).css({'transition-delay': (index*0.5/len)+'s'});
140		// $( this ).css({'transition-delay': (index*0.05)+'s'});
141	})
142});
143function enterEffects(){
144	var sWSon = document.documentElement.clientWidth;
145	if(sWSon >= 992){
146		$(".effect").each(function(index, element) {
147			var e = $(this);
148			var c = $(window).height();
149			if( $(window).scrollTop() >= e.offset().top - 0.9 * c ){
150				if( !e.hasClass("isView") ){
151					e.addClass("animated");
152					var x = 0;
153					e.find("*").each(function(index, element) {
154						$(this).on('webkitAnimationStart mozAnimationStart MSAnimationStart oanimationstart animationstart', function(){
155							x++;
156						});
157					});
158					e.find("*").on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
159						x--;
160						if(x == 0){
161							e.removeClass("animated");
162						}
163					});
164				}
165				e.addClass("isView");
166			}else{
167				e.removeClass("isView");
168			}
169		});
170	}else{
171		$(".effect").each(function(){ $(this).addClass("isView"); })
172	}
173}
174
175
176// tab切换
177$.fn.extend({
178	tab: function (options){
179		var defaults = {             //默认参数
180			ev : 'mouseover',        //默认事件'mouseover','click'
181			til : 'h2',              //默认标签
182			box : '.tab_list',       //默认列表
183			defaultNum : 0,          //默认展示第几个
184			eachPage : 1,            //每次切换的个数
185			delay : 100,             //延迟时间
186			auto : true,             //是否自动切换 true,false
187			speed : 4000,            //自动切换间隔时间(毫秒)
188			init : function(){},     //首次加载时触发时间
189			before : function (){},  //切换前触发事件
190			after : function (){},   //切换后触发事件
191			more : true              //是否有more,false,true
192		};
193		var options = $.extend(defaults, options);  //用户设置参数覆盖默认参数
194		
195		return this.each(function (){
196			var o = options;
197			var obj = $(this);
198			var oTil = obj.find(o.til);
199			var oBox = obj.find(o.box);
200			var oMore = null;
201			var iNum = o.defaultNum;
202			var iLen = oTil.length;
203			var iBefore = o.before;
204			var iAfter = o.after;
205			var iEach = o.eachPage;
206						
207			// 默认选中第一个
208			o.init();
209			if( iNum >= 0 ){
210				change( oTil.eq(iNum) );
211			}
212			
213			//鼠标事件绑定
214			oTil.bind(o.ev , function (){
215				var _this = this;
216				if(o.ev == 'mouseover' && o.delay){
217					_this.timer = setTimeout(function (){
218						change(_this);
219					},o.delay);
220				}else{
221					change(_this);
222				}; 
223			})
224
225			oTil.bind('mouseout',function (){
226				var _this = this;
227				clearTimeout(_this.timer);
228			});
229			
230			//自动切换效果
231			(function autoPlay(){
232				var timer2 = null;
233				if(o.auto){
234					function play(){
235						iNum++;
236						if(iNum >= iLen){
237							iNum =0;
238						};
239						change(oTil.eq(iNum));
240					};
241					timer2 = setInterval(play,o.speed);
242					obj.on('mouseover',function (){
243						clearInterval(timer2);
244					})
245					obj.on('mouseout',function (){
246						timer2 = setInterval(play,o.speed);
247					})
248				};
249			})();
250			
251			function change(box){
252				iBefore(iNum,obj);
253				// console.log(1);
254				iNum = $(box).index() - obj.find(o.til).eq(0).index();
255				
256				oTil.removeClass('on').addClass('off');
257				oBox.removeClass('on').addClass('off');
258				if(o.more){
259					oMore = obj.find('.more');
260					oMore.removeClass('on').addClass('off');
261					oMore.eq(iNum).addClass('on').removeClass('off');
262				};
263				oTil.eq(iNum).addClass('on').removeClass('off');
264				oBox.slice( iEach * iNum , iEach * (iNum + 1) ).addClass('on').removeClass('off');
265				iAfter(iNum,obj);
266			}
267			
268		});
269	}
270})
271
272function  sideHeight(){
273	// 左右两边同高度
274	var height1 = document.getElementById("gp-subLeft");
275	var height2 = document.getElementById("subRight");
276	if( height1.offsetHeight > height2.offsetHeight){
277	height2.style.height = height1.offsetHeight + "px";
278	}else {
279		height1.style.height = height2.offsetHeight-5 + "px";
280	}
281}
282
283
284//分页下拉列表框
285function pageSelect(){
286	console.log($('.pageSelect').length)
287	if($('.pageSelect').length!=0){
288		$('.pageSelect').select2({});
289		$("#select21").on("change",function(){
290		window.location.href=$(this).val()
291		})
292		$("#select22").on("change",function(){
293		var $thval=$(this).val()
294		if($thval=="") return false;
295			//value 绱㈠紩浠�0寮€濮�
296			$(".camel-list .list").eq($thval).find(".demo-img:first").click();
297		})
298	}
299}
300
301$('.select_link').click(function(){
302	$(this).find('.arrow').toggleClass('on');
303	$(this).find('.alert_box').toggleClass('on');
304	$(this).toggleClass('on');
305	// $('.alert_box').jScrollPane();
306})
307$('.select_link').mouseleave(function(){
308	$(this).find('.arrow').removeClass('on');
309	$(this).find('.alert_box').removeClass('on');
310	$(this).removeClass('on');
311})
312
313$('.gp-article p').each(function(){
314	if( $(this).find('img').length > 0 && $(this).text().replace(/\s/g,'') == ''  ){
315		$(this).addClass('has_img')
316	}
317})
318
319
320
321
322
323
324
325function lazyload(){
326	var dom = document.querySelectorAll(".lazy"); // 获取所有的图片
327	// console.log(dom)
328	var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; // 获取滚动条的高度
329	var windowHeight = window.innerHeight;  // 获取视口高度
330	for (var i = 0; i < dom.length; i++) {
331		var imgHeight = $(dom[i]).offset().top ;  // 每张图片的偏移量
332		// console.log(1)
333		// console.log(imgHeight)
334		// console.log(scrollTop)
335		// console.log(windowHeight)
336		if (imgHeight < scrollTop + 2 * windowHeight) {  // 判断
337			(function (i) {
338				setTimeout(function () {  // 用一个定时器,延迟多少秒后再渲染图片
339					// var newImage = new Image();  // 创建图片对象
340					// newImage.src = dom[j].getAttribute("data-src");  // 图片存储临时空间
341					// newImage.onload = function() {
342					// 	dom[j].src = dom[j].getAttribute("data-src"); // 设置图片的正确路径
343					// }
344					if($(dom[i]).attr("data-src") != "" && $( dom[i] ).attr("data-src") != undefined ){
345						$(dom[i]).attr("src",$(dom[i]).attr("data-src"));
346						$(dom[i]).removeAttr('data-src');
347					}
348					if($(dom[i]).attr("data-background")!="" && $(dom[i]).attr("data-background") != undefined ){
349						$(dom[i]).css("background-image","url(" + $(dom[i]).attr("data-background") + ")");
350						$(dom[i]).removeAttr('data-background');
351					}
352				},200);
353			})(i)
354		}
355	}
356	// if($('.lazy').length >0){
357	// 	$(".lazy").each(function(index, element) {
358	// 		if($(this).attr("data-src")!="" && $(this).attr("data-src")!=undefined){
359	// 			$(this).attr("src",$(this).attr("data-src"));
360	// 			$(this).removeAttr('data-src');
361	// 		}
362	// 		if($(this).attr("data-background")!="" && $(this).attr("data-background")!=undefined){
363	// 			$(this).css("background-image","url("+$(this).attr("data-background")+")");
364	// 			$(this).removeAttr('data-background');
365	// 		}
366	// 	});
367	// }
368}
369window.onload = function(){
370	lazyload();
371}
372
373$(window).scroll(function(){
374	lazyload();
375});

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.