author | Dan |
Sat, 10 Nov 2007 20:52:05 -0500 | |
changeset 254 | 2b48ca9ce4d3 |
parent 215 | 94db56b8124f |
child 326 | ab66d6d1f1f4 |
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); |
|
151
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'); |
151
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(); |
|
151
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(); |
|
151
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'; |
|
215 | 187 |
btn.value = $lang.get('etc_ok'); |
188 |
btn._GenericName = 'OK'; |
|
1 | 189 |
btn.onclick = this.clickHandler; |
190 |
btn.style.margin = '0 3px'; |
|
191 |
buttondiv.appendChild(btn); |
|
192 |
} |
|
193 |
||
194 |
if(type & MB_OKCANCEL) |
|
195 |
{ |
|
196 |
btn = document.createElement('input'); |
|
197 |
btn.type = 'button'; |
|
215 | 198 |
btn.value = $lang.get('etc_ok'); |
199 |
btn._GenericName = 'OK'; |
|
1 | 200 |
btn.onclick = this.clickHandler; |
201 |
btn.style.margin = '0 3px'; |
|
202 |
buttondiv.appendChild(btn); |
|
203 |
||
204 |
btn = document.createElement('input'); |
|
205 |
btn.type = 'button'; |
|
215 | 206 |
btn.value = $lang.get('etc_cancel'); |
207 |
btn._GenericName = 'Cancel'; |
|
1 | 208 |
btn.onclick = this.clickHandler; |
209 |
btn.style.margin = '0 3px'; |
|
210 |
buttondiv.appendChild(btn); |
|
211 |
} |
|
212 |
||
213 |
if(type & MB_YESNO) |
|
214 |
{ |
|
215 |
btn = document.createElement('input'); |
|
216 |
btn.type = 'button'; |
|
215 | 217 |
btn.value = $lang.get('etc_yes'); |
218 |
btn._GenericName = 'Yes'; |
|
1 | 219 |
btn.onclick = this.clickHandler; |
220 |
btn.style.margin = '0 3px'; |
|
221 |
buttondiv.appendChild(btn); |
|
222 |
||
223 |
btn = document.createElement('input'); |
|
224 |
btn.type = 'button'; |
|
215 | 225 |
btn.value = $lang.get('etc_no'); |
226 |
btn._GenericName = 'No'; |
|
1 | 227 |
btn.onclick = this.clickHandler; |
228 |
btn.style.margin = '0 3px'; |
|
229 |
buttondiv.appendChild(btn); |
|
230 |
} |
|
231 |
||
232 |
if(type & MB_YESNOCANCEL) |
|
233 |
{ |
|
234 |
btn = document.createElement('input'); |
|
235 |
btn.type = 'button'; |
|
215 | 236 |
btn.value = $lang.get('etc_yes'); |
237 |
btn._GenericName = 'Yes'; |
|
1 | 238 |
btn.onclick = this.clickHandler; |
239 |
btn.style.margin = '0 3px'; |
|
240 |
buttondiv.appendChild(btn); |
|
241 |
||
242 |
btn = document.createElement('input'); |
|
243 |
btn.type = 'button'; |
|
215 | 244 |
btn.value = $lang.get('etc_no'); |
245 |
btn._GenericName = 'No'; |
|
1 | 246 |
btn.onclick = this.clickHandler; |
247 |
btn.style.margin = '0 3px'; |
|
248 |
buttondiv.appendChild(btn); |
|
249 |
||
250 |
btn = document.createElement('input'); |
|
251 |
btn.type = 'button'; |
|
215 | 252 |
btn.value = $lang.get('etc_cancel'); |
253 |
btn._GenericName = 'Cancel'; |
|
1 | 254 |
btn.onclick = this.clickHandler; |
255 |
btn.style.margin = '0 3px'; |
|
256 |
buttondiv.appendChild(btn); |
|
257 |
} |
|
258 |
||
259 |
heading = document.createElement('h2'); |
|
260 |
heading.innerHTML = title; |
|
261 |
heading.style.color = '#50A0D0'; |
|
262 |
heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif'; |
|
263 |
heading.style.fontSize = '12pt'; |
|
264 |
heading.style.fontWeight = 'lighter'; |
|
265 |
heading.style.textTransform = 'lowercase'; |
|
266 |
heading.style.marginTop = '0'; |
|
267 |
mydiv.appendChild(heading); |
|
268 |
||
269 |
var text = document.createElement('div'); |
|
270 |
text.innerHTML = String(message); |
|
271 |
this.text_area = text; |
|
272 |
mydiv.appendChild(text); |
|
273 |
||
274 |
this.updateContent = function(text) |
|
275 |
{ |
|
276 |
this.text_area.innerHTML = text; |
|
277 |
}; |
|
278 |
||
279 |
//domObjChangeOpac(0, mydiv); |
|
280 |
//domObjChangeOpac(0, master_div); |
|
281 |
||
282 |
body = document.getElementsByTagName('body'); |
|
283 |
body = body[0]; |
|
284 |
master_div.appendChild(mydiv); |
|
285 |
master_div.appendChild(buttondiv); |
|
286 |
||
287 |
body.appendChild(master_div); |
|
288 |
||
151
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
|
289 |
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
|
290 |
setTimeout('mb_runFlyIn();', 100); |
1 | 291 |
|
292 |
this.onclick = new Array(); |
|
293 |
this.onbeforeclick = new Array(); |
|
294 |
mb_current_obj = this; |
|
295 |
} |
|
296 |
||
297 |
function mb_runFlyIn() |
|
298 |
{ |
|
299 |
var mydiv = document.getElementById('messageBox'); |
|
300 |
var maindiv = mydiv.parentNode; |
|
301 |
fly_in_top(maindiv, true, false); |
|
302 |
} |
|
303 |
||
304 |
function messagebox_click(obj, mb) |
|
305 |
{ |
|
215 | 306 |
val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value; |
1 | 307 |
if(typeof mb.onbeforeclick[val] == 'function') |
308 |
{ |
|
309 |
var o = mb.onbeforeclick[val]; |
|
310 |
var resp = o(); |
|
311 |
if ( resp ) |
|
312 |
return false; |
|
313 |
o = false; |
|
314 |
} |
|
315 |
||
316 |
var mydiv = document.getElementById('messageBox'); |
|
317 |
var maindiv = mydiv.parentNode; |
|
318 |
||
151
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 |
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
|
320 |
{ |
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 |
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
|
322 |
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
|
323 |
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
|
324 |
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
|
325 |
} |
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
|
326 |
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
|
327 |
{ |
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
|
328 |
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
|
329 |
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
|
330 |
} |
1 | 331 |
if(typeof mb.onclick[val] == 'function') |
332 |
{ |
|
333 |
o = mb.onclick[val]; |
|
334 |
o(); |
|
335 |
o = false; |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
function testMessageBox() |
|
340 |
{ |
|
341 |
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'); |
|
342 |
mb.onclick['OK'] = function() |
|
343 |
{ |
|
344 |
alert('You clicked OK!'); |
|
345 |
} |
|
346 |
mb.onbeforeclick['Cancel'] = function() |
|
347 |
{ |
|
348 |
alert('You clicked Cancel!'); |
|
349 |
} |
|
350 |
} |
|
351 |
||
352 |
// Function to fade classes info-box, warning-box, error-box, etc. |
|
353 |
||
354 |
function fadeInfoBoxes() |
|
355 |
{ |
|
356 |
var divs = new Array(); |
|
357 |
d = document.getElementsByTagName('div'); |
|
358 |
j = 0; |
|
359 |
for(var i in d) |
|
360 |
{ |
|
361 |
if ( !d[i].tagName ) |
|
362 |
continue; |
|
363 |
if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box') |
|
364 |
{ |
|
365 |
divs[j] = d[i]; |
|
366 |
j++; |
|
367 |
} |
|
368 |
} |
|
369 |
if(divs.length < 1) return; |
|
370 |
for(i in divs) |
|
371 |
{ |
|
372 |
if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000); |
|
373 |
switch(divs[i].className) |
|
374 |
{ |
|
375 |
case 'info-box': |
|
376 |
default: |
|
377 |
from = '#3333FF'; |
|
378 |
break; |
|
379 |
case 'error-box': |
|
380 |
from = '#FF3333'; |
|
381 |
break; |
|
382 |
case 'warning-box': |
|
383 |
from = '#FFFF33'; |
|
384 |
break; |
|
385 |
case 'question-box': |
|
386 |
from = '#33FF33'; |
|
387 |
break; |
|
388 |
} |
|
389 |
Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id)); |
|
390 |
} |
|
391 |
} |
|
392 |
||
393 |
// Alpha fades |
|
394 |
||
395 |
function opacity(id, opacStart, opacEnd, millisec) { |
|
396 |
//speed for each frame |
|
397 |
var speed = Math.round(millisec / 100); |
|
398 |
var timer = 0; |
|
399 |
||
400 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
401 |
if(opacStart > opacEnd) { |
|
402 |
for(i = opacStart; i >= opacEnd; i--) { |
|
403 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
404 |
timer++; |
|
405 |
} |
|
406 |
} else if(opacStart < opacEnd) { |
|
407 |
for(i = opacStart; i <= opacEnd; i++) |
|
408 |
{ |
|
409 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
410 |
timer++; |
|
411 |
} |
|
412 |
} |
|
413 |
} |
|
414 |
||
53 | 415 |
var opacityDOMCache = new Object(); |
416 |
function domOpacity(obj, opacStart, opacEnd, millisec) { |
|
417 |
//speed for each frame |
|
418 |
var speed = Math.round(millisec / 100); |
|
419 |
var timer = 0; |
|
420 |
||
421 |
// unique ID for this animation |
|
422 |
var uniqid = Math.floor(Math.random() * 1000000); |
|
423 |
opacityDOMCache[uniqid] = obj; |
|
424 |
||
425 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
426 |
if(opacStart > opacEnd) { |
|
427 |
for(i = opacStart; i >= opacEnd; i--) { |
|
428 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
429 |
timer++; |
|
430 |
} |
|
431 |
} else if(opacStart < opacEnd) { |
|
432 |
for(i = opacStart; i <= opacEnd; i++) |
|
433 |
{ |
|
434 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
435 |
timer++; |
|
436 |
} |
|
437 |
} |
|
438 |
setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed)); |
|
439 |
} |
|
440 |
||
1 | 441 |
//change the opacity for different browsers |
442 |
function changeOpac(opacity, id) { |
|
443 |
var object = document.getElementById(id).style; |
|
444 |
object.opacity = (opacity / 100); |
|
445 |
object.MozOpacity = (opacity / 100); |
|
446 |
object.KhtmlOpacity = (opacity / 100); |
|
447 |
object.filter = "alpha(opacity=" + opacity + ")"; |
|
448 |
} |
|
449 |
||
450 |
function mb_logout() |
|
451 |
{ |
|
210
2b283402e4e4
Added language export to JSON page and localization for Javascript using $lang.get(). Localized AJAX login interface.
Dan
parents:
151
diff
changeset
|
452 |
var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body')); |
1 | 453 |
mb.onclick['Yes'] = function() |
454 |
{ |
|
455 |
window.location = makeUrlNS('Special', 'Logout/' + title); |
|
456 |
} |
|
457 |
} |
|
458 |