1// JavaScript Document 2 3 4 <!-- 5//å ¬å ±èæ¬æä»¶ main.js 6function addEvent(obj,evtType,func,cap){ 7 cap=cap||false; 8 if(obj.addEventListener){ 9 obj.addEventListener(evtType,func,cap); 10 return true; 11 }else if(obj.attachEvent){ 12 if(cap){ 13 obj.setCapture(); 14 return true; 15 }else{ 16 return obj.attachEvent("on" + evtType,func); 17 } 18 }else{ 19 return false; 20 } 21} 22function getPageScroll(){ 23 var xScroll,yScroll; 24 if (self.pageXOffset) { 25 xScroll = self.pageXOffset; 26 } else if (document.documentElement && document.documentElement.scrollLeft){ 27 xScroll = document.documentElement.scrollLeft; 28 } else if (document.body) { 29 xScroll = document.body.scrollLeft; 30 } 31 if (self.pageYOffset) { 32 yScroll = self.pageYOffset; 33 } else if (document.documentElement && document.documentElement.scrollTop){ 34 yScroll = document.documentElement.scrollTop; 35 } else if (document.body) { 36 yScroll = document.body.scrollTop; 37 } 38 arrayPageScroll = new Array(xScroll,yScroll); 39 return arrayPageScroll; 40} 41function GetPageSize(){ 42 var xScroll, yScroll; 43 if (window.innerHeight && window.scrollMaxY) { 44 xScroll = document.body.scrollWidth; 45 yScroll = window.innerHeight + window.scrollMaxY; 46 } else if (document.body.scrollHeight > document.body.offsetHeight){ 47 xScroll = document.body.scrollWidth; 48 yScroll = document.body.scrollHeight; 49 } else { 50 xScroll = document.body.offsetWidth; 51 yScroll = document.body.offsetHeight; 52 } 53 var windowWidth, windowHeight; 54 if (self.innerHeight) { 55 windowWidth = self.innerWidth; 56 windowHeight = self.innerHeight; 57 } else if (document.documentElement && document.documentElement.clientHeight) { 58 windowWidth = document.documentElement.clientWidth; 59 windowHeight = document.documentElement.clientHeight; 60 } else if (document.body) { 61 windowWidth = document.body.clientWidth; 62 windowHeight = document.body.clientHeight; 63 } 64 if(yScroll < windowHeight){ 65 pageHeight = windowHeight; 66 } else { 67 pageHeight = yScroll; 68 } 69 if(xScroll < windowWidth){ 70 pageWidth = windowWidth; 71 } else { 72 pageWidth = xScroll; 73 } 74 arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 75 return arrayPageSize; 76} 77//广åèæ¬æä»¶ AdMove.js 78/* 79ä¾å 80<div id="Div2"> 81 ***** content ****** 82</div> 83var ad=new AdMove("Div2"); 84ad.Run(); 85*/ 86//////////////////////////////////////////////////////// 87var AdMoveConfig=new Object(); 88AdMoveConfig.IsInitialized=false; 89AdMoveConfig.ScrollX=0; 90AdMoveConfig.ScrollY=0; 91AdMoveConfig.MoveWidth=0; 92AdMoveConfig.MoveHeight=0; 93AdMoveConfig.Resize=function(){ 94 var winsize=GetPageSize(); 95 AdMoveConfig.MoveWidth=winsize[2]; 96 AdMoveConfig.MoveHeight=winsize[3]; 97 AdMoveConfig.Scroll(); 98} 99AdMoveConfig.Scroll=function(){ 100 var winscroll=getPageScroll(); 101 AdMoveConfig.ScrollX=winscroll[0]; 102 AdMoveConfig.ScrollY=winscroll[1]; 103} 104addEvent(window,"resize",AdMoveConfig.Resize); 105addEvent(window,"scroll",AdMoveConfig.Scroll); 106function AdMove(id){ 107 if(!AdMoveConfig.IsInitialized){ 108 AdMoveConfig.Resize(); 109 AdMoveConfig.IsInitialized=true; 110 } 111 var obj=document.getElementById(id); 112 obj.style.position="absolute"; 113 var W=AdMoveConfig.MoveWidth-obj.offsetWidth; 114 var H=AdMoveConfig.MoveHeight-obj.offsetHeight; 115 var x = W*Math.random(),y = H*Math.random(); 116 var rad=(Math.random()+1)*Math.PI/6; 117 var kx=Math.sin(rad),ky=Math.cos(rad); 118 var dirx = (Math.random()<0.5?1:-1), diry = (Math.random()<0.5?1:-1); 119 var step = 1; 120 var interval; 121 this.SetLocation=function(vx,vy){x=vx;y=vy;} 122 this.SetDirection=function(vx,vy){dirx=vx;diry=vy;} 123 obj.CustomMethod=function(){ 124 obj.style.left = (x + AdMoveConfig.ScrollX) + "px"; 125 obj.style.top = (y + AdMoveConfig.ScrollY) + "px"; 126 rad=(Math.random()+1)*Math.PI/6; 127 W=AdMoveConfig.MoveWidth-obj.offsetWidth; 128 H=AdMoveConfig.MoveHeight-obj.offsetHeight; 129 x = x + step*kx*dirx; 130 if (x < 0){dirx = 1;x = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 131 if (x > W){dirx = -1;x = W;kx=Math.sin(rad);ky=Math.cos(rad);} 132 y = y + step*ky*diry; 133 if (y < 0){diry = 1;y = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 134 if (y > H){diry = -1;y = H;kx=Math.sin(rad);ky=Math.cos(rad);} 135 } 136 this.Run=function(){
137 var delay = 10; 138 interval=setInterval(obj.CustomMethod,delay); 139 obj.onmouseover=function(){clearInterval(interval);} 140 obj.onmouseout=function(){interval=setInterval(obj.CustomMethod, delay);} 141 } 142} 143 144 145 146 //-->
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.