1define([], function(){ 2 var _isShow = false; 3 var $tag, $aboutme, $friends; 4 5 var ctn,radio,scaleW,idx,basicwrap; 6 7 //ç¬¬ä¸æ¥ -- åå§å 8 var reset = function() { 9 //设å®çªå£æ¯ç 10 radio = document.body.scrollHeight/document.body.scrollWidth; 11 //设å®ä¸é¡µç宽度 12 scaleW = document.body.scrollWidth; 13 //设å®åå§çç´¢å¼å¼ 14 idx = 0; 15 }; 16 //ç¬¬ä¸æ¥ -- ç»å 17 var combine = function(){ 18 if($tag){ 19 document.getElementById("js-mobile-tagcloud").innerHTML = $tag.innerHTML; 20 } 21 if($aboutme){ 22 document.getElementById("js-mobile-aboutme").innerHTML = $aboutme.innerHTML; 23 } 24 if($friends){ 25 document.getElementById("js-mobile-friends").innerHTML = $friends.innerHTML; 26 } 27 } 28 //ç¬¬ä¸æ¥ -- æ ¹æ®æ°æ®æ¸²æDOM 29 var renderDOM = function(){ 30 //çæèç¹ 31 var $viewer = document.createElement("div"); 32 $viewer.id = "viewer"; 33 $viewer.className = "hide"; 34 $tag = document.getElementById("js-tagcloud"); 35 $aboutme = document.getElementById("js-aboutme"); 36 $friends = document.getElementById("js-friends"); 37 var tagStr = $tag?'<span class="viewer-title">æ ç¾</span><div class="viewer-div tagcloud" id="js-mobile-tagcloud"></div>':""; 38 var friendsStr = $friends?'<span class="viewer-title">åæ é¾æ¥</span><div class="viewer-div friends" id="js-mobile-friends"></div>':""; 39 var aboutmeStr = $aboutme?'<span class="viewer-title">å ³äºæ</span><div class="viewer-div aboutme" id="js-mobile-aboutme"></div>':""; 40 41 $viewer.innerHTML = '<div id="viewer-box">\ 42 <div class="viewer-box-l">\ 43 <div class="viewer-box-wrap">'+aboutmeStr+friendsStr+tagStr+'</div>\ 44 </div>\ 45 <div class="viewer-box-r"></div>\ 46 </div>'; 47 48 //主è¦å¾çèç¹ 49 document.getElementsByTagName("body")[0].appendChild($viewer); 50 var wrap = document.getElementById("viewer-box"); 51 basicwrap = wrap; 52 wrap.style.height = document.body.scrollHeight + 'px'; 53 }; 54 55 var show = function(target, idx){ 56 document.getElementById("viewer").className = ""; 57 setTimeout(function(){ 58 basicwrap.className = "anm-swipe"; 59 },0); 60 _isShow = true; 61 document.ontouchstart=function(e){ 62 if(e.target.tagName != "A"){ 63 return false; 64 } 65 } 66 } 67 68 var hide = function(){ 69 document.getElementById("viewer-box").className = ""; 70 _isShow = false; 71 document.ontouchstart=function(){ 72 return true; 73 } 74 } 75 76 //ç¬¬åæ¥ -- ç»å® DOM äºä»¶ 77 var bindDOM = function(){ 78 var scaleW = scaleW; 79 80 //æ»å¨éè 81 document.getElementById("viewer-box").addEventListener("webkitTransitionEnd", function(){ 82 83 if(_isShow == false){ 84 document.getElementById("viewer").className = "hide"; 85 _isShow = true; 86 }else{ 87 } 88 89 }, false); 90 91 //ç¹å»å±ç¤ºåéè 92 ctn.addEventListener("touchend", function(){ 93 show(); 94 }, false); 95 96 var $right = document.getElementsByClassName("viewer-box-r")[0]; 97 var touchStartTime; 98 var touchEndTime; 99 $right.addEventListener("touchstart", function(){ 100 touchStartTime = + new Date(); 101 }, false); 102 $right.addEventListener("touchend", function(){ 103 touchEndTime = + new Date(); 104 if(touchEndTime - touchStartTime < 300){ 105 hide(); 106 } 107 touchStartTime = 0; 108 touchEndTime = 0; 109 }, false); 110 111 //æ»å¨æ ·å¼
112 var $overlay = $("#mobile-nav .overlay"); 113 var $header = $(".js-mobile-header"); 114 window.onscroll = function(){ 115 var scrollTop = document.documentElement.scrollTop + document.body.scrollTop; 116 if(scrollTop >= 69){ 117 $overlay.addClass("fixed"); 118 }else{ 119 $overlay.removeClass("fixed"); 120 } 121 if(scrollTop >= 160){ 122 $header.removeClass("hide").addClass("fixed"); 123 }else{ 124 $header.addClass("hide").removeClass("fixed"); 125 } 126 }; 127 $header[0].addEventListener("touchstart", function(){ 128 $('html, body').animate({scrollTop:0}, 'slow'); 129 }, false); 130 }; 131 132 var resetTags = function(){ 133 var tags = $(".tagcloud a"); 134 tags.css({"font-size": "12px"}); 135 for(var i=0,len=tags.length; i<len; i++){ 136 var num = tags.eq(i).html().length % 5 +1; 137 tags[i].className = ""; 138 tags.eq(i).addClass("color"+num); 139 } 140 } 141 142 return{ 143 init: function(){ 144 //æé 彿°éè¦çåæ° 145 ctn = document.getElementsByClassName("slider-trigger")[0]; 146 //æé 忥 147 reset(); 148 renderDOM(); 149 combine(); 150 bindDOM(); 151 resetTags(); 152 } 153 } 154})
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.