PageSourceSearch

https://cedar-renjun.github.io/js/main.js

js cedar-renjun.github.io collected 2026-10-03 09:47:21 UTC 3,117 bytes, 110 lines download raw bytes

1require([], function (){
2
3	var isMobileInit = false;
4	var loadMobile = function(){
5		require(['/js/mobile.js'], function(mobile){
6			mobile.init();
7			isMobileInit = true;
8		});
9	}
10	var isPCInit = false;
11	var loadPC = function(){
12		require(['/js/pc.js'], function(pc){
13			pc.init();
14			isPCInit = true;
15		});
16	}
17
18	var browser={
19	    versions:function(){
20	    var u = window.navigator.userAgent;
21	    return {
22	        trident: u.indexOf('Trident') > -1, //IE内核
23	        presto: u.indexOf('Presto') > -1, //opera内核
24	        webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
25	        gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
26	        mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
27	        ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
28	        android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
29	        iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者安卓QQ浏览器
30	        iPad: u.indexOf('iPad') > -1, //是否为iPad
31	        webApp: u.indexOf('Safari') == -1 ,//是否为web应用程序,没有头部与底部
32	        weixin: u.indexOf('MicroMessenger') == -1 //是否为微信浏览器
33	        };
34	    }()
35	}
36
37	$(window).bind("resize", function(){
38		if(isMobileInit && isPCInit){
39			$(window).unbind("resize");
40			return;
41		}
42		var w = $(window).width();
43		if(w >= 700){
44			loadPC();
45		}else{
46			loadMobile();
47		}
48	});
49
50	if(browser.versions.mobile === true || $(window).width() < 700){
51		loadMobile();
52	}else{
53		loadPC();
54	}
55
56	//是否使用fancybox
57	if(yiliaConfig.fancybox === true){
58		require(['/fancybox/jquery.fancybox.js'], function(pc){
59			var isFancy = $(".isFancy");
60			if(isFancy.length != 0){
61				var imgArr = $(".article-inner img");
62				for(var i=0,len=imgArr.length;i<len;i++){
63					var src = imgArr.eq(i).attr("src");
64					var title = imgArr.eq(i).attr("alt");
65					imgArr.eq(i).replaceWith("<a href='"+src+"' title='"+title+"' rel='fancy-group' class='fancy-ctn fancybox'><img src='"+src+"' title='"+title+"'></a>");
66				}
67				$(".article-inner .fancy-ctn").fancybox();
68			}
69		});
70		
71	}
72	//是否开启动画
73	if(yiliaConfig.animate === true){
74
75		require(['/js/jquery.lazyload.js'], function(){
76			//avatar
77			$(".js-avatar").attr("src", $(".js-avatar").attr("lazy-src"));
78			$(".js-avatar")[0].onload = function(){
79				$(".js-avatar").addClass("show");
80			}
81		});
82		
83		if(yiliaConfig.isHome === true){
84			//content
85			function showArticle(){
86				$(".article").each(function(){
87					if( $(this).offset().top <= $(window).scrollTop()+$(window).height() && !($(this).hasClass('show')) ) {
88						$(this).removeClass("hidden").addClass("show");
89						$(this).addClass("is-hiddened");
90					}else{
91						if(!$(this).hasClass("is-hiddened")){
92							$(this).addClass("hidden");
93						}
94					}
95				});
96			}
97			$(window).on('scroll', function(){
98				showArticle();
99			});
100			showArticle();
101		}
102		
103	}
104	
105	//是否新窗口打开链接
106	if(yiliaConfig.open_in_new == true){
107		$(".article a[href]").attr("target", "_blank")
108	}
109	
110});

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.