1function Marquee() 2{ 3 this.ID = document.getElementById(arguments[0]); 4 if(!this.ID) 5 { 6 alert("æ¨è¦è®¾ç½®ç\"" + arguments[0] + "\"åå§åé误\r\nè¯·æ£æ¥æ ç¾ID设置æ¯å¦æ£ç¡®!"); 7 this.ID = -1; 8 return; 9 } 10 this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.CTL = this.StartID = this.Stop = this.MouseOver = 0; 11 this.Step = 1; 12 this.Timer = 30; 13 this.DirectionArray = {"top":0 , "up":0 , "bottom":1 , "down":1 , "left":2 , "right":3}; 14 if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1]; 15 if(typeof arguments[2] == "number")this.Step = arguments[2]; 16 if(typeof arguments[3] == "number")this.Width = arguments[3]; 17 if(typeof arguments[4] == "number")this.Height = arguments[4]; 18 if(typeof arguments[5] == "number")this.Timer = arguments[5]; 19 if(typeof arguments[6] == "number")this.DelayTime = arguments[6]; 20 if(typeof arguments[7] == "number")this.WaitTime = arguments[7]; 21 if(typeof arguments[8] == "number")this.ScrollStep = arguments[8]; 22 this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden"; 23 this.ID.noWrap = true; 24 this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1); 25 if(arguments.length >= 7)this.Start(); 26} 27 28Marquee.prototype.Start = function() 29{ 30 if(this.ID == -1)return; 31 if(this.WaitTime < 800)this.WaitTime = 800; 32 if(this.Timer < 20)this.Timer = 20; 33 if(this.Width == 0)this.Width = parseInt(this.ID.style.width); 34 if(this.Height == 0)this.Height = parseInt(this.ID.style.height); 35 if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()]; 36 this.HalfWidth = Math.round(this.Width / 2); 37 this.HalfHeight = Math.round(this.Height / 2); 38 this.BakStep = this.Step; 39 this.ID.style.width = this.Width + "px"; 40 this.ID.style.height = this.Height + "px"; 41 if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height; 42 var templateLeft = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;display:inline;'><tr><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td></tr></table>"; 43 var templateTop = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;'><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>"; 44 var msobj = this; 45 msobj.tempHTML = msobj.ID.innerHTML; 46 if(msobj.Direction <= 1) 47 { 48 msobj.ID.innerHTML = templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML); 49 } 50 else 51 { 52 if(msobj.ScrollStep == 0 && msobj.DelayTime == 0) 53 { 54 msobj.ID.innerHTML += msobj.ID.innerHTML; 55 } 56 else 57 { 58 msobj.ID.innerHTML = templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML); 59 } 60 } 61 var timer = this.Timer; 62 var delaytime = this.DelayTime; 63 var waittime = this.WaitTime; 64 msobj.StartID = function(){msobj.Scroll()} 65 msobj.Continue = function() 66 { 67 if(msobj.MouseOver == 1) 68 { 69 setTimeout(msobj.Continue,delaytime); 70 } 71 else 72 { clearInterval(msobj.TimerID); 73 msobj.CTL = msobj.Stop = 0; 74 msobj.TimerID = setInterval(msobj.StartID,timer); 75 } 76 } 77 78 msobj.Pause = function() 79 { 80 msobj.Stop = 1; 81 clearInterval(msobj.TimerID); 82 setTimeout(msobj.Continue,delaytime); 83 } 84 85 msobj.Begin = function() 86 { 87 msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth / 2 : msobj.ID.scrollHeight / 2; 88 if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step)) { 89 msobj.ID.innerHTML = msobj.tempHTML; 90 delete(msobj.tempHTML); 91 return; 92 } 93 delete(msobj.tempHTML); 94 msobj.TimerID = setInterval(msobj.StartID,timer); 95 if(msobj.ScrollStep < 0)return; 96 msobj.ID.onmousemove = function(event) 97 { 98 if(msobj.ScrollStep == 0 && msobj.Direction > 1) 99 { 100 var event = event || window.event; 101 if(window.event) 102 { 103 if(msobj.IsNotOpera) 104 { 105 msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX; 106 } 107 else 108 { 109 msobj.ScrollStep = null; 110 return; 111 } 112 } 113 else 114 { 115 msobj.EventLeft = event.layerX - msobj.ID.scrollLeft; 116 } 117 msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2; 118 msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft); 119 msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
120 } 121 } 122 msobj.ID.onmouseover = function() 123 { 124 if(msobj.ScrollStep == 0)return; 125 msobj.MouseOver = 1; 126 clearInterval(msobj.TimerID); 127 } 128 msobj.ID.onmouseout = function() 129 { 130 if(msobj.ScrollStep == 0) 131 { 132 if(msobj.Step == 0)msobj.Step = 1; 133 return; 134 } 135 msobj.MouseOver = 0; 136 if(msobj.Stop == 0) 137 { 138 clearInterval(msobj.TimerID); 139 msobj.TimerID = setInterval(msobj.StartID,timer); 140 } 141 } 142 } 143 setTimeout(msobj.Begin,waittime); 144} 145 146Marquee.prototype.Scroll = function() 147{ 148 switch(this.Direction) 149 { 150 case 0: 151 this.CTL += this.Step; 152 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 153 { 154 this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL; 155 this.Pause(); 156 return; 157 } 158 else 159 { 160 if(this.ID.scrollTop >= this.ClientScroll) 161 { 162 this.ID.scrollTop -= this.ClientScroll; 163 } 164 this.ID.scrollTop += this.Step; 165 } 166 break; 167 168 case 1: 169 this.CTL += this.Step; 170 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 171 { 172 this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL; 173 this.Pause(); 174 return; 175 } 176 else 177 { 178 if(this.ID.scrollTop <= 0) 179 { 180 this.ID.scrollTop += this.ClientScroll; 181 } 182 this.ID.scrollTop -= this.Step; 183 } 184 break; 185 186 case 2: 187 this.CTL += this.Step; 188 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 189 { 190 this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL; 191 this.Pause(); 192 return; 193 } 194 else 195 { 196 if(this.ID.scrollLeft >= this.ClientScroll) 197 { 198 this.ID.scrollLeft -= this.ClientScroll; 199 } 200 this.ID.scrollLeft += this.Step; 201 } 202 break; 203 204 case 3: 205 this.CTL += this.Step; 206 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 207 { 208 this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL; 209 this.Pause(); 210 return; 211 } 212 else 213 { 214 if(this.ID.scrollLeft <= 0) 215 { 216 this.ID.scrollLeft += this.ClientScroll; 217 } 218 this.ID.scrollLeft -= this.Step; 219 } 220 break; 221 } 222}
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.