1/** 2 * author: Timothy Groves - http://www.brandspankingnew.net 3 * version: 1.3 - 2006-11-02 4 * 1.2 - 2006-11-01 5 * 1.1 - 2006-09-29 6 * 1.0 - 2006-09-25 7 * 8 * requires: nothing 9 * 10 */ 11 12var useBSNns; 13 14if (useBSNns) 15{ 16 if (typeof(bsn) == "undefined") 17 bsn = {} 18 var _bsn = bsn; 19} 20else 21{ 22 var _bsn = this; 23} 24 25 26 27 28 29_bsn.Crossfader = function (divs, fadetime, delay ) 30{ 31 this.nAct = -1; 32 this.aDivs = divs; 33 34 for (var i=0;i<divs.length;i++) 35 { 36 document.getElementById(divs[i]).style.opacity = 0; 37 document.getElementById(divs[i]).style.position = "absolute"; 38 document.getElementById(divs[i]).style.filter = "alpha(opacity=0)"; 39 document.getElementById(divs[i]).style.visibility = "hidden"; 40 } 41 42 this.nDur = fadetime; 43 this.nDelay = delay; 44 45 this._newfade(); 46} 47 48 49_bsn.Crossfader.prototype._newfade = function() 50{ 51 if (this.nID1) 52 clearInterval(this.nID1); 53 54 this.nOldAct = this.nAct; 55 this.nAct++; 56 if (!this.aDivs[this.nAct]) this.nAct = 0; 57 58 if (this.nAct == this.nOldAct) 59 return false; 60 61 document.getElementById( this.aDivs[this.nAct] ).style.visibility = "visible"; 62 63 this.nInt = 50; 64 this.nTime = 0; 65 66 var p=this; 67 this.nID2 = setInterval(function() { p._fade() }, this.nInt); 68} 69 70 71_bsn.Crossfader.prototype._fade = function() 72{ 73 this.nTime += this.nInt; 74 75 var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 ); 76 var op = ieop / 100; 77 document.getElementById( this.aDivs[this.nAct] ).style.opacity = op; 78 document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")"; 79 80 if (this.nOldAct > -1) 81 { 82 document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op; 83 document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")"; 84 } 85 86 if (this.nTime == this.nDur) 87 { 88 clearInterval( this.nID2 ); 89 90 if (this.nOldAct > -1) 91 document.getElementById( this.aDivs[this.nOldAct] ).style.visibility = "hidden"; 92 93 var p=this; 94 this.nID1 = setInterval(function() { p._newfade() }, this.nDelay); 95 } 96} 97 98 99 100_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d) 101{ 102 return c/2 * (1 - Math.cos(Math.PI*t/d)) + b; 103}
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.