author | Dan |
Mon, 01 Oct 2007 23:48:24 -0400 | |
changeset 158 | f7e83b6db3be |
parent 150 | 824821224153 |
child 259 | 112debff64bd |
permissions | -rw-r--r-- |
1 | 1 |
// Message box system |
2 |
||
3 |
function darken(nofade) |
|
4 |
{ |
|
5 |
if(IE) |
|
6 |
nofade = true; |
|
7 |
if(document.getElementById('specialLayer_darkener')) |
|
8 |
{ |
|
9 |
document.getElementById('specialLayer_darkener').style.display = 'block'; |
|
10 |
if(nofade) |
|
11 |
{ |
|
12 |
document.getElementById('specialLayer_darkener').style.opacity = '0.7'; |
|
13 |
document.getElementById('specialLayer_darkener').style.filter = 'alpha(opacity=70)'; |
|
14 |
} |
|
15 |
else |
|
16 |
{ |
|
17 |
opacity('specialLayer_darkener', 0, 70, 1000); |
|
18 |
} |
|
19 |
} else { |
|
20 |
w = getWidth(); |
|
21 |
h = getHeight(); |
|
22 |
var thediv = document.createElement('div'); |
|
23 |
if(IE) |
|
24 |
thediv.style.position = 'absolute'; |
|
25 |
else |
|
26 |
thediv.style.position = 'fixed'; |
|
27 |
thediv.style.top = '0px'; |
|
28 |
thediv.style.left = '0px'; |
|
29 |
thediv.style.opacity = '0'; |
|
30 |
thediv.style.filter = 'alpha(opacity=0)'; |
|
31 |
thediv.style.backgroundColor = '#000000'; |
|
32 |
thediv.style.width = '100%'; |
|
33 |
thediv.style.height = '100%'; |
|
34 |
thediv.zIndex = getHighestZ() + 5; |
|
35 |
thediv.id = 'specialLayer_darkener'; |
|
36 |
if(nofade) |
|
37 |
{ |
|
38 |
thediv.style.opacity = '0.7'; |
|
39 |
thediv.style.filter = 'alpha(opacity=70)'; |
|
40 |
body = document.getElementsByTagName('body'); |
|
41 |
body = body[0]; |
|
42 |
body.appendChild(thediv); |
|
43 |
} else { |
|
44 |
body = document.getElementsByTagName('body'); |
|
45 |
body = body[0]; |
|
46 |
body.appendChild(thediv); |
|
47 |
opacity('specialLayer_darkener', 0, 70, 1000); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
||
52 |
function enlighten(nofade) |
|
53 |
{ |
|
54 |
if(IE) |
|
55 |
nofade = true; |
|
56 |
if(document.getElementById('specialLayer_darkener')) |
|
57 |
{ |
|
58 |
if(nofade) |
|
59 |
{ |
|
60 |
document.getElementById('specialLayer_darkener').style.display = 'none'; |
|
61 |
} |
|
62 |
opacity('specialLayer_darkener', 70, 0, 1000); |
|
63 |
setTimeout("document.getElementById('specialLayer_darkener').style.display = 'none';", 1000); |
|
64 |
} |
|
65 |
} |
|
66 |
||
67 |
/** |
|
68 |
* The ultimate message box framework for Javascript |
|
69 |
* Syntax is (almost) identical to the MessageBox command in NSIS |
|
70 |
* @param int type - a bitfield consisting of the MB_* constants |
|
71 |
* @param string title - the blue text at the top of the window |
|
72 |
* @param string text - HTML for the body of the message box |
|
73 |
* Properties: |
|
74 |
* onclick - an array of functions to be called on button click events |
|
75 |
* NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE |
|
76 |
* onbeforeclick - same as onclick but called before the messagebox div is destroyed |
|
77 |
* Example: |
|
78 |
* var my_message = new messagebox(MB_OK|MB_ICONSTOP, 'Error logging in', 'The username and/or password is incorrect. Please check the username and retype your password'); |
|
79 |
* my_message.onclick['OK'] = function() { |
|
80 |
* document.getElementById('password').value = ''; |
|
81 |
* }; |
|
82 |
* Deps: |
|
83 |
* Modern browser that supports DOM |
|
84 |
* darken() and enlighten() (above) |
|
85 |
* opacity() - required for darken() and enlighten() |
|
86 |
* MB_* constants are defined in enano-lib-basic.js |
|
87 |
*/ |
|
88 |
||
89 |
var mb_current_obj; |
|
90 |
||
91 |
function messagebox(type, title, message) |
|
92 |
{ |
|
93 |
var y = getScrollOffset(); |
|
94 |
if(document.getElementById('messageBox')) return; |
|
95 |
darken(true); |
|
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
96 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
97 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
98 |
document.getElementById('specialLayer_darkener').style.zIndex = '5'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
99 |
} |
1 | 100 |
var master_div = document.createElement('div'); |
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
101 |
master_div.style.zIndex = '6'; |
1 | 102 |
var mydiv = document.createElement('div'); |
103 |
mydiv.style.width = '400px'; |
|
104 |
mydiv.style.height = '200px'; |
|
105 |
w = getWidth(); |
|
106 |
h = getHeight(); |
|
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
107 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
108 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
109 |
master_div.style.left = ((w / 2) - 200)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
110 |
master_div.style.top = ((h / 2) + y - 120)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
111 |
master_div.style.position = 'absolute'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
112 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
113 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
114 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
115 |
master_div.style.top = '-10000px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
116 |
master_div.style.position = ( IE ) ? 'absolute' : 'fixed'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
117 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
118 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 119 |
mydiv.style.backgroundColor = '#FFFFFF'; |
120 |
mydiv.style.padding = '10px'; |
|
121 |
mydiv.style.marginBottom = '1px'; |
|
122 |
mydiv.id = 'messageBox'; |
|
123 |
mydiv.style.overflow = 'auto'; |
|
124 |
||
125 |
var buttondiv = document.createElement('div'); |
|
126 |
buttondiv.style.width = '400px'; |
|
127 |
w = getWidth(); |
|
128 |
h = getHeight(); |
|
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
129 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
130 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
131 |
//buttondiv.style.left = ((w / 2) - 200)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
132 |
//buttondiv.style.top = ((h / 2) + y + 101)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
133 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
134 |
//buttondiv.style.position = ( IE ) ? 'absolute' : 'fixed'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
135 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 136 |
buttondiv.style.backgroundColor = '#C0C0C0'; |
137 |
buttondiv.style.padding = '10px'; |
|
138 |
buttondiv.style.textAlign = 'right'; |
|
139 |
buttondiv.style.verticalAlign = 'middle'; |
|
140 |
buttondiv.id = 'messageBoxButtons'; |
|
141 |
||
142 |
this.clickHandler = function() { messagebox_click(this, mb_current_obj); }; |
|
143 |
||
38 | 144 |
if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) ) |
1 | 145 |
{ |
146 |
mydiv.style.paddingLeft = '50px'; |
|
147 |
mydiv.style.width = '360px'; |
|
148 |
mydiv.style.backgroundRepeat = 'no-repeat'; |
|
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
1
diff
changeset
|
149 |
mydiv.style.backgroundPosition = '8px 8px'; |
1 | 150 |
} |
38 | 151 |
else if ( type & MB_ICONLOCK ) |
152 |
{ |
|
153 |
mydiv.style.paddingLeft = '50px'; |
|
154 |
mydiv.style.width = '360px'; |
|
155 |
mydiv.style.backgroundRepeat = 'no-repeat'; |
|
156 |
} |
|
1 | 157 |
|
158 |
if(type & MB_ICONINFORMATION) |
|
159 |
{ |
|
160 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/info.png\')'; |
|
161 |
} |
|
162 |
||
163 |
if(type & MB_ICONQUESTION) |
|
164 |
{ |
|
165 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/question.png\')'; |
|
166 |
} |
|
167 |
||
168 |
if(type & MB_ICONSTOP) |
|
169 |
{ |
|
170 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/error.png\')'; |
|
171 |
} |
|
172 |
||
173 |
if(type & MB_ICONEXCLAMATION) |
|
174 |
{ |
|
175 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/warning.png\')'; |
|
176 |
} |
|
177 |
||
178 |
if(type & MB_ICONLOCK) |
|
179 |
{ |
|
180 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/lock.png\')'; |
|
181 |
} |
|
182 |
||
183 |
if(type & MB_OK) |
|
184 |
{ |
|
185 |
btn = document.createElement('input'); |
|
186 |
btn.type = 'button'; |
|
187 |
btn.value = 'OK'; |
|
188 |
btn.onclick = this.clickHandler; |
|
189 |
btn.style.margin = '0 3px'; |
|
190 |
buttondiv.appendChild(btn); |
|
191 |
} |
|
192 |
||
193 |
if(type & MB_OKCANCEL) |
|
194 |
{ |
|
195 |
btn = document.createElement('input'); |
|
196 |
btn.type = 'button'; |
|
197 |
btn.value = 'OK'; |
|
198 |
btn.onclick = this.clickHandler; |
|
199 |
btn.style.margin = '0 3px'; |
|
200 |
buttondiv.appendChild(btn); |
|
201 |
||
202 |
btn = document.createElement('input'); |
|
203 |
btn.type = 'button'; |
|
204 |
btn.value = 'Cancel'; |
|
205 |
btn.onclick = this.clickHandler; |
|
206 |
btn.style.margin = '0 3px'; |
|
207 |
buttondiv.appendChild(btn); |
|
208 |
} |
|
209 |
||
210 |
if(type & MB_YESNO) |
|
211 |
{ |
|
212 |
btn = document.createElement('input'); |
|
213 |
btn.type = 'button'; |
|
214 |
btn.value = 'Yes'; |
|
215 |
btn.onclick = this.clickHandler; |
|
216 |
btn.style.margin = '0 3px'; |
|
217 |
buttondiv.appendChild(btn); |
|
218 |
||
219 |
btn = document.createElement('input'); |
|
220 |
btn.type = 'button'; |
|
221 |
btn.value = 'No'; |
|
222 |
btn.onclick = this.clickHandler; |
|
223 |
btn.style.margin = '0 3px'; |
|
224 |
buttondiv.appendChild(btn); |
|
225 |
} |
|
226 |
||
227 |
if(type & MB_YESNOCANCEL) |
|
228 |
{ |
|
229 |
btn = document.createElement('input'); |
|
230 |
btn.type = 'button'; |
|
231 |
btn.value = 'Yes'; |
|
232 |
btn.onclick = this.clickHandler; |
|
233 |
btn.style.margin = '0 3px'; |
|
234 |
buttondiv.appendChild(btn); |
|
235 |
||
236 |
btn = document.createElement('input'); |
|
237 |
btn.type = 'button'; |
|
238 |
btn.value = 'No'; |
|
239 |
btn.onclick = this.clickHandler; |
|
240 |
btn.style.margin = '0 3px'; |
|
241 |
buttondiv.appendChild(btn); |
|
242 |
||
243 |
btn = document.createElement('input'); |
|
244 |
btn.type = 'button'; |
|
245 |
btn.value = 'Cancel'; |
|
246 |
btn.onclick = this.clickHandler; |
|
247 |
btn.style.margin = '0 3px'; |
|
248 |
buttondiv.appendChild(btn); |
|
249 |
} |
|
250 |
||
251 |
heading = document.createElement('h2'); |
|
252 |
heading.innerHTML = title; |
|
253 |
heading.style.color = '#50A0D0'; |
|
254 |
heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif'; |
|
255 |
heading.style.fontSize = '12pt'; |
|
256 |
heading.style.fontWeight = 'lighter'; |
|
257 |
heading.style.textTransform = 'lowercase'; |
|
258 |
heading.style.marginTop = '0'; |
|
259 |
mydiv.appendChild(heading); |
|
260 |
||
261 |
var text = document.createElement('div'); |
|
262 |
text.innerHTML = String(message); |
|
263 |
this.text_area = text; |
|
264 |
mydiv.appendChild(text); |
|
265 |
||
266 |
this.updateContent = function(text) |
|
267 |
{ |
|
268 |
this.text_area.innerHTML = text; |
|
269 |
}; |
|
270 |
||
271 |
//domObjChangeOpac(0, mydiv); |
|
272 |
//domObjChangeOpac(0, master_div); |
|
273 |
||
274 |
body = document.getElementsByTagName('body'); |
|
275 |
body = body[0]; |
|
276 |
master_div.appendChild(mydiv); |
|
277 |
master_div.appendChild(buttondiv); |
|
278 |
||
279 |
body.appendChild(master_div); |
|
280 |
||
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
281 |
if ( !aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
282 |
setTimeout('mb_runFlyIn();', 100); |
1 | 283 |
|
284 |
this.onclick = new Array(); |
|
285 |
this.onbeforeclick = new Array(); |
|
286 |
mb_current_obj = this; |
|
287 |
} |
|
288 |
||
289 |
function mb_runFlyIn() |
|
290 |
{ |
|
291 |
var mydiv = document.getElementById('messageBox'); |
|
292 |
var maindiv = mydiv.parentNode; |
|
293 |
fly_in_top(maindiv, true, false); |
|
294 |
} |
|
295 |
||
296 |
function messagebox_click(obj, mb) |
|
297 |
{ |
|
298 |
val = obj.value; |
|
299 |
if(typeof mb.onbeforeclick[val] == 'function') |
|
300 |
{ |
|
301 |
var o = mb.onbeforeclick[val]; |
|
302 |
var resp = o(); |
|
303 |
if ( resp ) |
|
304 |
return false; |
|
305 |
o = false; |
|
306 |
} |
|
307 |
||
308 |
var mydiv = document.getElementById('messageBox'); |
|
309 |
var maindiv = mydiv.parentNode; |
|
310 |
||
150
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
311 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
312 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
313 |
var mbdiv = document.getElementById('messageBox'); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
314 |
mbdiv.parentNode.removeChild(mbdiv.nextSibling); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
315 |
mbdiv.parentNode.removeChild(mbdiv); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
316 |
enlighten(true); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
317 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
318 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
319 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
320 |
var to = fly_out_top(maindiv, true, false); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
321 |
setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); enlighten(true);", to); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
322 |
} |
1 | 323 |
if(typeof mb.onclick[val] == 'function') |
324 |
{ |
|
325 |
o = mb.onclick[val]; |
|
326 |
o(); |
|
327 |
o = false; |
|
328 |
} |
|
329 |
} |
|
330 |
||
331 |
function testMessageBox() |
|
332 |
{ |
|
333 |
mb = new messagebox(MB_OKCANCEL|MB_ICONINFORMATION, 'Javascripted dynamic message boxes', 'This is soooooo coool, now if only document.createElement() worked in IE!<br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text'); |
|
334 |
mb.onclick['OK'] = function() |
|
335 |
{ |
|
336 |
alert('You clicked OK!'); |
|
337 |
} |
|
338 |
mb.onbeforeclick['Cancel'] = function() |
|
339 |
{ |
|
340 |
alert('You clicked Cancel!'); |
|
341 |
} |
|
342 |
} |
|
343 |
||
344 |
// Function to fade classes info-box, warning-box, error-box, etc. |
|
345 |
||
346 |
function fadeInfoBoxes() |
|
347 |
{ |
|
348 |
var divs = new Array(); |
|
349 |
d = document.getElementsByTagName('div'); |
|
350 |
j = 0; |
|
351 |
for(var i in d) |
|
352 |
{ |
|
353 |
if ( !d[i].tagName ) |
|
354 |
continue; |
|
355 |
if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box') |
|
356 |
{ |
|
357 |
divs[j] = d[i]; |
|
358 |
j++; |
|
359 |
} |
|
360 |
} |
|
361 |
if(divs.length < 1) return; |
|
362 |
for(i in divs) |
|
363 |
{ |
|
364 |
if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000); |
|
365 |
switch(divs[i].className) |
|
366 |
{ |
|
367 |
case 'info-box': |
|
368 |
default: |
|
369 |
from = '#3333FF'; |
|
370 |
break; |
|
371 |
case 'error-box': |
|
372 |
from = '#FF3333'; |
|
373 |
break; |
|
374 |
case 'warning-box': |
|
375 |
from = '#FFFF33'; |
|
376 |
break; |
|
377 |
case 'question-box': |
|
378 |
from = '#33FF33'; |
|
379 |
break; |
|
380 |
} |
|
381 |
Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id)); |
|
382 |
} |
|
383 |
} |
|
384 |
||
385 |
// Alpha fades |
|
386 |
||
387 |
function opacity(id, opacStart, opacEnd, millisec) { |
|
388 |
//speed for each frame |
|
389 |
var speed = Math.round(millisec / 100); |
|
390 |
var timer = 0; |
|
391 |
||
392 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
393 |
if(opacStart > opacEnd) { |
|
394 |
for(i = opacStart; i >= opacEnd; i--) { |
|
395 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
396 |
timer++; |
|
397 |
} |
|
398 |
} else if(opacStart < opacEnd) { |
|
399 |
for(i = opacStart; i <= opacEnd; i++) |
|
400 |
{ |
|
401 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
402 |
timer++; |
|
403 |
} |
|
404 |
} |
|
405 |
} |
|
406 |
||
53 | 407 |
var opacityDOMCache = new Object(); |
408 |
function domOpacity(obj, opacStart, opacEnd, millisec) { |
|
409 |
//speed for each frame |
|
410 |
var speed = Math.round(millisec / 100); |
|
411 |
var timer = 0; |
|
412 |
||
413 |
// unique ID for this animation |
|
414 |
var uniqid = Math.floor(Math.random() * 1000000); |
|
415 |
opacityDOMCache[uniqid] = obj; |
|
416 |
||
417 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
418 |
if(opacStart > opacEnd) { |
|
419 |
for(i = opacStart; i >= opacEnd; i--) { |
|
420 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
421 |
timer++; |
|
422 |
} |
|
423 |
} else if(opacStart < opacEnd) { |
|
424 |
for(i = opacStart; i <= opacEnd; i++) |
|
425 |
{ |
|
426 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
427 |
timer++; |
|
428 |
} |
|
429 |
} |
|
430 |
setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed)); |
|
431 |
} |
|
432 |
||
1 | 433 |
//change the opacity for different browsers |
434 |
function changeOpac(opacity, id) { |
|
435 |
var object = document.getElementById(id).style; |
|
436 |
object.opacity = (opacity / 100); |
|
437 |
object.MozOpacity = (opacity / 100); |
|
438 |
object.KhtmlOpacity = (opacity / 100); |
|
439 |
object.filter = "alpha(opacity=" + opacity + ")"; |
|
440 |
} |
|
441 |
||
442 |
function mb_logout() |
|
443 |
{ |
|
444 |
var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, 'Are you sure you want to log out?', 'If you log out, you will no longer be able to access your user preferences, your private messages, or certain areas of this site until you log in again.'); |
|
445 |
mb.onclick['Yes'] = function() |
|
446 |
{ |
|
447 |
window.location = makeUrlNS('Special', 'Logout/' + title); |
|
448 |
} |
|
449 |
} |
|
450 |