FIx renkoo.
1 <script type="text/javascript">
4 // Fade interval in milliseconds
5 // Make this larger if you experience performance issues
6 Fadomatic.INTERVAL_MILLIS = 50;
9 // element - The element to fade
10 // speed - The speed to fade at, from 0.0 to 100.0
11 // initialOpacity (optional, default 100) - element's starting opacity, 0 to 100
12 // minOpacity (optional, default 0) - element's minimum opacity, 0 to 100
13 // maxOpacity (optional, default 0) - element's minimum opacity, 0 to 100
14 function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
15 this._element = element;
16 this._intervalId = null;
18 this._isFadeOut = true;
20 // Set initial opacity and bounds
21 // NB use 99 instead of 100 to avoid flicker at start of fade
23 this._maxOpacity = 99;
26 if (typeof minOpacity != 'undefined') {
29 } else if (minOpacity > 99) {
30 this._minOpacity = 99;
32 this._minOpacity = minOpacity;
36 if (typeof maxOpacity != 'undefined') {
39 } else if (maxOpacity > 99) {
40 this._maxOpacity = 99;
42 this._maxOpacity = maxOpacity;
45 if (this._maxOpacity < this._minOpacity) {
46 this._maxOpacity = this._minOpacity;
50 if (typeof initialOpacity != 'undefined') {
51 if (initialOpacity > this._maxOpacity) {
52 this._opacity = this._maxOpacity;
53 } else if (initialOpacity < this._minOpacity) {
54 this._opacity = this._minOpacity;
56 this._opacity = initialOpacity;
60 // See if we're using W3C opacity, MSIE filter, or just
62 if(typeof element.style.opacity != 'undefined') {
64 this._updateOpacity = this._updateOpacityW3c;
66 } else if(typeof element.style.filter != 'undefined') {
68 // If there's not an alpha filter on the element already,
70 if (element.style.filter.indexOf("alpha") == -1) {
72 // Attempt to preserve existing filters
73 var existingFilters="";
74 if (element.style.filter) {
75 existingFilters = element.style.filter+" ";
77 element.style.filter = existingFilters+"alpha(opacity="+this._opacity+")";
80 this._updateOpacity = this._updateOpacityMSIE;
84 this._updateOpacity = this._updateVisibility;
87 this._updateOpacity();
90 // Initiates a fade out
91 Fadomatic.prototype.fadeOut = function () {
92 this._isFadeOut = true;
96 // Initiates a fade in
97 Fadomatic.prototype.fadeIn = function () {
98 this._isFadeOut = false;
102 // Makes the element completely opaque, stops any fade in progress
103 Fadomatic.prototype.show = function () {
105 this._opacity = this._maxOpacity;
106 this._updateOpacity();
109 // Makes the element completely transparent, stops any fade in progress
110 Fadomatic.prototype.hide = function () {
113 this._updateOpacity();
116 // Halts any fade in progress
117 Fadomatic.prototype.haltFade = function () {
119 clearInterval(this._intervalId);
122 // Resumes a fade where it was halted
123 Fadomatic.prototype.resumeFade = function () {
128 // Pseudo-private members
130 Fadomatic.prototype._beginFade = function () {
134 this._intervalId = setInterval(function() { objref._tickFade(); },Fadomatic.INTERVAL_MILLIS);
137 Fadomatic.prototype._tickFade = function () {
139 if (this._isFadeOut) {
140 this._opacity -= this._rate;
141 if (this._opacity < this._minOpacity) {
142 this._opacity = this._minOpacity;
146 this._opacity += this._rate;
147 if (this._opacity > this._maxOpacity ) {
148 this._opacity = this._maxOpacity;
153 this._updateOpacity();
156 Fadomatic.prototype._updateVisibility = function () {
158 if (this._opacity > 0) {
159 this._element.style.visibility = 'visible';
161 this._element.style.visibility = 'hidden';
165 Fadomatic.prototype._updateOpacityW3c = function () {
167 this._element.style.opacity = this._opacity/100;
168 this._updateVisibility();
171 Fadomatic.prototype._updateOpacityMSIE = function () {
173 this._element.filters.alpha.opacity = this._opacity;
174 this._updateVisibility();
177 Fadomatic.prototype._updateOpacity = null;
180 // Override CoalescedHTML methods
181 function outputHTML() {
182 var insert = document.getElementById("insert");
183 if(!!insert && coalescedHTML.isConsecutive) {
184 insert.parentNode.replaceChild(coalescedHTML.fragment, insert);
187 insert.parentNode.removeChild(insert);
188 // insert the documentFragment into the live DOM
190 var fader = new Fadomatic(coalescedHTML.fragment, 9, 0, 0, 95);
197 alignChat(coalescedHTML.shouldScroll);
199 // reset state to empty/non-coalescing
200 coalescedHTML.shouldScroll = undefined;
201 coalescedHTML.isConsecutive = undefined;
202 coalescedHTML.isCoalescing = false;
203 coalescedHTML.coalesceRounds = 0;
206 CoalescedHTML.prototype.coalesce = function() {
207 window.clearTimeout(this.timeoutID);
208 this.timeoutID = window.setTimeout(outputHTML, 25);
209 this.isCoalescing = true;
210 this.coalesceRounds += 1;
211 if(400 < self.coalesceRounds)