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 // æ»å¨æ¡çå¬ä½¿ç¨scrollreveal.js 85 // https://github.com/jlmakes/scrollreveal.js 86 // 使ç¨cdn[//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js] 87 require([ 88 '//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js' 89 ], function (ScrollReveal) { 90 // æ´å¤animation: 91 // http://daneden.github.io/animate.css/ 92 var animationNames = [ 93 "pulse", "fadeIn","fadeInRight", "flipInX", "lightSpeedIn","rotateInUpLeft", "slideInUp","zoomIn", 94 ], 95 len = animationNames.length, 96 randomAnimationName = animationNames[Math.ceil(Math.random() * len) - 1]; 97 98 // ie9 䏿¯æcss3 keyframeå¨ç», safari䏿¯ærequestAnimationFrame, ä¸ä½¿ç¨éæºå¨ç»ï¼åå忥çå¨ç» 99 if (!window.requestAnimationFrame) { 100 $('.body-wrap > article').css({opacity: 1}); 101 102 if (navigator.userAgent.match(/Safari/i)) { 103 function showArticle(){ 104 $(".article").each(function(){ 105 if( $(this).offset().top <= $(window).scrollTop()+$(window).height() && !($(this).hasClass('show')) ) { 106 $(this).removeClass("hidden").addClass("show"); 107 $(this).addClass("is-hiddened"); 108 }else{ 109 if(!$(this).hasClass("is-hiddened")){ 110 $(this).addClass("hidden"); 111 } 112 } 113 }); 114 } 115 $(window).on('scroll', function(){ 116 showArticle(); 117 }); 118 showArticle(); 119 } 120 return; 121 } 122 // document.bodyæäºæµè§å¨ä¸æ¯æçå¬scrollï¼æä»¥ä½¿ç¨é»è®¤çdocument.documentElement 123 ScrollReveal({ 124 duration: 0, 125 afterReveal: function (domEl) { 126 // safari䏿¯ærequestAnimationFrame䏿¯ædocument.documentElementçonscrollæä»¥è¿éä¸ä¼æ§è¡ 127 // åå§ç¶æè®¾ä¸ºopacity: 0, å¨ç»æææ´å¹³æ»ä¸äº(ç±äºèæ¬å è½½æ¯å¼æ¥ï¼é¡µé¢å ç´ æ¸²æå卿§è¡å¨ç»ï¼æè§åæ¯å»¶æ¶) 128 $(domEl).addClass('animated ' + randomAnimationName).css({opacity: 1}); 129 } 130 }).reveal('.body-wrap > article'); 131 132 }); 133 } else { 134 $('.body-wrap > article').css({opacity: 1}); 135 } 136 137 } 138 139 //æ¯å¦æ°çªå£æå¼é¾æ¥ 140 if(yiliaConfig.open_in_new == true){ 141 $(".article a[href]").attr("target", "_blank") 142 } 143 $(".archive-article-title, .github-widget a").attr("target", "_blank"); 144 145 //éæºé¢è² 146 var colorList = ["#6da336", "#ff945c", "#66CC66", "#99CC99", "#CC6666", "#76becc", "#c99979", "#918597", "#4d4d4d"]; 147 var id = Math.ceil(Math.random()*(colorList.length-1)); 148 //PC 149 $("#container .left-col .overlay").css({"background-color": colorList[id],"opacity": .3}); 150 //ç§»å¨ç«¯ 151 $("#container #mobile-nav .overlay").css({"background-color": colorList[id],"opacity": .7}); 152});
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.