author | Dan |
Tue, 02 Dec 2008 21:11:22 -0500 | |
changeset 760 | 60c132a5bc8e |
parent 694 | 43367c66d869 |
child 869 | 58bc29c14a4d |
permissions | -rw-r--r-- |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
1 |
/** |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
2 |
* Darkens the browser screen. This will make the entire page un-clickable except for any floating divs created after this is called. Restore with enlighten(). |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
3 |
* @param bool Controls whether the fade should be disabled or not. aclDisableTransitionFX will override this if set to true, and fades are never fired on IE. |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
4 |
* @param int When specified, represents the numeric opacity value to set the fade layer to. 1-100. |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
5 |
*/ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
6 |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
7 |
var darkener_index = []; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
8 |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
9 |
function darken(nofade, opacVal, layerid) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
10 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
11 |
layerid = ( layerid ) ? layerid : 'specialLayer_darkener'; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
12 |
if(IE) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
13 |
nofade = true; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
14 |
if ( !opacVal ) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
15 |
opacVal = 70; |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
16 |
darkener_index[layerid] = ( typeof(darkener_index[layerid]) == 'number' ) ? darkener_index[layerid] + 1 : 1; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
17 |
if(document.getElementById(layerid)) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
18 |
{ |
694
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
677
diff
changeset
|
19 |
document.getElementById(layerid).style.zIndex = getHighestZ() + 1; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
20 |
if(nofade) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
21 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
22 |
changeOpac(opacVal, layerid); |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
23 |
document.getElementById(layerid).style.display = 'block'; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
24 |
document.getElementById(layerid).myOpacVal = opacVal; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
25 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
26 |
else |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
27 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
28 |
if ( document.getElementById(layerid).style.display != 'none' ) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
29 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
30 |
var currentOpac = document.getElementById(layerid).myOpacVal; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
31 |
opacity(layerid, currentOpac, opacVal, 1000); |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
32 |
document.getElementById(layerid).myOpacVal = opacVal; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
33 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
34 |
else |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
35 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
36 |
document.getElementById(layerid).style.display = 'block'; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
37 |
document.getElementById(layerid).myOpacVal = opacVal; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
38 |
opacity(layerid, 0, opacVal, 1000); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
39 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
40 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
41 |
} else { |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
42 |
w = getWidth(); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
43 |
h = getHeight(); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
44 |
var thediv = document.createElement('div'); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
45 |
if(IE) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
46 |
thediv.style.position = 'absolute'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
47 |
else |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
48 |
thediv.style.position = 'fixed'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
49 |
if ( IE ) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
50 |
{ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
51 |
var top = getScrollOffset(); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
52 |
thediv.style.top = String(top) + 'px'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
53 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
54 |
else |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
55 |
{ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
56 |
thediv.style.top = '0px'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
57 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
58 |
thediv.style.left = '0px'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
59 |
thediv.style.opacity = '0'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
60 |
thediv.style.filter = 'alpha(opacity=0)'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
61 |
thediv.style.backgroundColor = '#000000'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
62 |
thediv.style.width = '100%'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
63 |
thediv.style.height = '100%'; |
694
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
677
diff
changeset
|
64 |
thediv.style.zIndex = getHighestZ() + 1; |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
65 |
thediv.id = layerid; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
66 |
thediv.myOpacVal = opacVal; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
67 |
if(nofade) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
68 |
{ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
69 |
thediv.style.opacity = ( parseFloat(opacVal) / 100 ); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
70 |
thediv.style.filter = 'alpha(opacity=' + opacVal + ')'; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
71 |
body = document.getElementsByTagName('body'); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
72 |
body = body[0]; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
73 |
body.appendChild(thediv); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
74 |
} else { |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
75 |
body = document.getElementsByTagName('body'); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
76 |
body = body[0]; |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
77 |
body.appendChild(thediv); |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
78 |
opacity(layerid, 0, opacVal, 1000); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
79 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
80 |
} |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
81 |
return document.getElementById(layerid); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
82 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
83 |
|
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
84 |
/** |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
85 |
* Un-darkens the screen and re-enables clicking of on-screen controls. |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
86 |
* @param bool If true, disables the fade effect. Fades are always disabled if aclDisableTransitionFX is true and on IE. |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
87 |
*/ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
88 |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
89 |
function enlighten(nofade, layerid) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
90 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
91 |
layerid = ( layerid ) ? layerid : 'specialLayer_darkener'; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
92 |
|
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
93 |
if(IE) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
94 |
nofade = true; |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
95 |
darkener_index[layerid] -= 1; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
96 |
if ( darkener_index[layerid] > 0 ) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
97 |
return false; |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
98 |
if(document.getElementById(layerid)) |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
99 |
{ |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
100 |
if(nofade) |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
101 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
102 |
document.getElementById(layerid).style.display = 'none'; |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
103 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
104 |
else |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
105 |
{ |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
106 |
var from = document.getElementById(layerid).myOpacVal; |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
107 |
opacity(layerid, from, 0, 1000); |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
108 |
setTimeout("document.getElementById('" + layerid + "').style.display = 'none';", 1000); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
109 |
} |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
110 |
} |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
582
diff
changeset
|
111 |
return document.getElementById(layerid); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
diff
changeset
|
112 |
} |