author | Dan |
Wed, 09 Jul 2008 21:02:28 -0400 | |
changeset 618 | 587b393f1e5e |
parent 562 | 75df0b2c596c |
permissions | -rw-r--r-- |
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
1 |
// Message box and visual effect system |
1 | 2 |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
3 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
4 |
* 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(). |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
5 |
* @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. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
6 |
* @param int When specified, represents the numeric opacity value to set the fade layer to. 1-100. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
7 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
8 |
|
539
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
9 |
var darkener_index = 0; |
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
10 |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
11 |
function darken(nofade, opacVal) |
1 | 12 |
{ |
13 |
if(IE) |
|
14 |
nofade = true; |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
15 |
if ( !opacVal ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
16 |
opacVal = 70; |
539
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
17 |
darkener_index++; |
1 | 18 |
if(document.getElementById('specialLayer_darkener')) |
19 |
{ |
|
20 |
if(nofade) |
|
21 |
{ |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
22 |
changeOpac(opacVal, 'specialLayer_darkener'); |
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
23 |
document.getElementById('specialLayer_darkener').style.display = 'block'; |
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
24 |
document.getElementById('specialLayer_darkener').myOpacVal = opacVal; |
1 | 25 |
} |
26 |
else |
|
27 |
{ |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
28 |
if ( document.getElementById('specialLayer_darkener').style.display != 'none' ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
29 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
30 |
var currentOpac = document.getElementById('specialLayer_darkener').myOpacVal; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
31 |
opacity('specialLayer_darkener', currentOpac, opacVal, 1000); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
32 |
document.getElementById('specialLayer_darkener').myOpacVal = opacVal; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
33 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
34 |
else |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
35 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
36 |
document.getElementById('specialLayer_darkener').style.display = 'block'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
37 |
document.getElementById('specialLayer_darkener').myOpacVal = opacVal; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
38 |
opacity('specialLayer_darkener', 0, opacVal, 1000); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
39 |
} |
1 | 40 |
} |
41 |
} else { |
|
42 |
w = getWidth(); |
|
43 |
h = getHeight(); |
|
44 |
var thediv = document.createElement('div'); |
|
45 |
if(IE) |
|
46 |
thediv.style.position = 'absolute'; |
|
47 |
else |
|
48 |
thediv.style.position = 'fixed'; |
|
461 | 49 |
if ( IE ) |
50 |
{ |
|
51 |
var top = getScrollOffset(); |
|
52 |
thediv.style.top = String(top) + 'px'; |
|
53 |
} |
|
54 |
else |
|
55 |
{ |
|
56 |
thediv.style.top = '0px'; |
|
57 |
} |
|
1 | 58 |
thediv.style.left = '0px'; |
59 |
thediv.style.opacity = '0'; |
|
60 |
thediv.style.filter = 'alpha(opacity=0)'; |
|
61 |
thediv.style.backgroundColor = '#000000'; |
|
62 |
thediv.style.width = '100%'; |
|
63 |
thediv.style.height = '100%'; |
|
64 |
thediv.zIndex = getHighestZ() + 5; |
|
65 |
thediv.id = 'specialLayer_darkener'; |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
66 |
thediv.myOpacVal = opacVal; |
1 | 67 |
if(nofade) |
68 |
{ |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
69 |
thediv.style.opacity = ( parseFloat(opacVal) / 100 ); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
70 |
thediv.style.filter = 'alpha(opacity=' + opacVal + ')'; |
1 | 71 |
body = document.getElementsByTagName('body'); |
72 |
body = body[0]; |
|
73 |
body.appendChild(thediv); |
|
74 |
} else { |
|
75 |
body = document.getElementsByTagName('body'); |
|
76 |
body = body[0]; |
|
77 |
body.appendChild(thediv); |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
78 |
opacity('specialLayer_darkener', 0, opacVal, 1000); |
1 | 79 |
} |
80 |
} |
|
81 |
} |
|
82 |
||
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
83 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
84 |
* Un-darkens the screen and re-enables clicking of on-screen controls. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
85 |
* @param bool If true, disables the fade effect. Fades are always disabled if aclDisableTransitionFX is true and on IE. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
86 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
87 |
|
1 | 88 |
function enlighten(nofade) |
89 |
{ |
|
90 |
if(IE) |
|
91 |
nofade = true; |
|
539
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
92 |
darkener_index -= 1; |
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
93 |
if ( darkener_index > 0 ) |
1beddd693f2d
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents:
537
diff
changeset
|
94 |
return false; |
1 | 95 |
if(document.getElementById('specialLayer_darkener')) |
96 |
{ |
|
97 |
if(nofade) |
|
98 |
{ |
|
99 |
document.getElementById('specialLayer_darkener').style.display = 'none'; |
|
100 |
} |
|
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
101 |
else |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
102 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
103 |
var from = document.getElementById('specialLayer_darkener').myOpacVal; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
104 |
// console.info('Fading from ' + from); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
105 |
opacity('specialLayer_darkener', from, 0, 1000); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
106 |
setTimeout("document.getElementById('specialLayer_darkener').style.display = 'none';", 1000); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
107 |
} |
1 | 108 |
} |
109 |
} |
|
110 |
||
111 |
/** |
|
112 |
* The ultimate message box framework for Javascript |
|
113 |
* Syntax is (almost) identical to the MessageBox command in NSIS |
|
114 |
* @param int type - a bitfield consisting of the MB_* constants |
|
115 |
* @param string title - the blue text at the top of the window |
|
116 |
* @param string text - HTML for the body of the message box |
|
117 |
* Properties: |
|
118 |
* onclick - an array of functions to be called on button click events |
|
119 |
* NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE |
|
120 |
* onbeforeclick - same as onclick but called before the messagebox div is destroyed |
|
320
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
121 |
* Methods: |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
122 |
* destroy: kills the running message box |
1 | 123 |
* Example: |
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
124 |
* 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'); |
1 | 125 |
* my_message.onclick['OK'] = function() { |
126 |
* document.getElementById('password').value = ''; |
|
127 |
* }; |
|
128 |
* Deps: |
|
129 |
* Modern browser that supports DOM |
|
130 |
* darken() and enlighten() (above) |
|
131 |
* opacity() - required for darken() and enlighten() |
|
132 |
* MB_* constants are defined in enano-lib-basic.js |
|
133 |
*/ |
|
134 |
||
135 |
var mb_current_obj; |
|
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
136 |
var mb_previously_had_darkener = false; |
1 | 137 |
|
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
138 |
function MessageBox(type, title, message) |
1 | 139 |
{ |
140 |
var y = getScrollOffset(); |
|
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
141 |
|
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
142 |
// Prevent multiple instances |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
143 |
if ( document.getElementById('messageBox') ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
144 |
return; |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
145 |
|
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
146 |
if ( document.getElementById('specialLayer_darkener') ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
147 |
if ( document.getElementById('specialLayer_darkener').style.display == 'block' ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
148 |
mb_previously_had_darkener = true; |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
149 |
if ( !mb_previously_had_darkener ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
150 |
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
|
151 |
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
|
152 |
{ |
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
|
153 |
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
|
154 |
} |
1 | 155 |
var master_div = document.createElement('div'); |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
156 |
master_div.style.zIndex = String(getHighestZ() + 5); |
1 | 157 |
var mydiv = document.createElement('div'); |
158 |
mydiv.style.height = '200px'; |
|
159 |
w = getWidth(); |
|
160 |
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
|
161 |
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
|
162 |
{ |
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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
} |
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
|
167 |
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
|
168 |
{ |
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
|
169 |
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
|
170 |
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
|
171 |
} |
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
|
172 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 173 |
mydiv.style.backgroundColor = '#FFFFFF'; |
174 |
mydiv.style.padding = '10px'; |
|
175 |
mydiv.style.marginBottom = '1px'; |
|
176 |
mydiv.id = 'messageBox'; |
|
177 |
mydiv.style.overflow = 'auto'; |
|
178 |
||
179 |
var buttondiv = document.createElement('div'); |
|
509
175df10e0b56
Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents:
507
diff
changeset
|
180 |
|
542
5841df0ab575
Added ETag support and increased caching settings to try and speed the system up. Result of a YSlow audit.
Dan
parents:
541
diff
changeset
|
181 |
mydiv.style.width = '400px'; |
5841df0ab575
Added ETag support and increased caching settings to try and speed the system up. Result of a YSlow audit.
Dan
parents:
541
diff
changeset
|
182 |
buttondiv.style.width = '400px'; |
509
175df10e0b56
Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents:
507
diff
changeset
|
183 |
|
1 | 184 |
w = getWidth(); |
185 |
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
|
186 |
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
|
187 |
{ |
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
|
188 |
//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
|
189 |
//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
|
190 |
} |
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
|
191 |
//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
|
192 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 193 |
buttondiv.style.backgroundColor = '#C0C0C0'; |
194 |
buttondiv.style.padding = '10px'; |
|
195 |
buttondiv.style.textAlign = 'right'; |
|
196 |
buttondiv.style.verticalAlign = 'middle'; |
|
197 |
buttondiv.id = 'messageBoxButtons'; |
|
198 |
||
199 |
this.clickHandler = function() { messagebox_click(this, mb_current_obj); }; |
|
200 |
||
38 | 201 |
if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) ) |
1 | 202 |
{ |
203 |
mydiv.style.paddingLeft = '50px'; |
|
204 |
mydiv.style.width = '360px'; |
|
205 |
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
|
206 |
mydiv.style.backgroundPosition = '8px 8px'; |
1 | 207 |
} |
38 | 208 |
else if ( type & MB_ICONLOCK ) |
209 |
{ |
|
210 |
mydiv.style.paddingLeft = '50px'; |
|
211 |
mydiv.style.width = '360px'; |
|
212 |
mydiv.style.backgroundRepeat = 'no-repeat'; |
|
213 |
} |
|
1 | 214 |
|
215 |
if(type & MB_ICONINFORMATION) |
|
216 |
{ |
|
217 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/info.png\')'; |
|
218 |
} |
|
219 |
||
220 |
if(type & MB_ICONQUESTION) |
|
221 |
{ |
|
222 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/question.png\')'; |
|
223 |
} |
|
224 |
||
225 |
if(type & MB_ICONSTOP) |
|
226 |
{ |
|
227 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/error.png\')'; |
|
228 |
} |
|
229 |
||
230 |
if(type & MB_ICONEXCLAMATION) |
|
231 |
{ |
|
232 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/warning.png\')'; |
|
233 |
} |
|
234 |
||
235 |
if(type & MB_ICONLOCK) |
|
236 |
{ |
|
237 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/lock.png\')'; |
|
238 |
} |
|
239 |
||
240 |
if(type & MB_OK) |
|
241 |
{ |
|
242 |
btn = document.createElement('input'); |
|
243 |
btn.type = 'button'; |
|
215 | 244 |
btn.value = $lang.get('etc_ok'); |
245 |
btn._GenericName = 'OK'; |
|
1 | 246 |
btn.onclick = this.clickHandler; |
247 |
btn.style.margin = '0 3px'; |
|
248 |
buttondiv.appendChild(btn); |
|
249 |
} |
|
250 |
||
251 |
if(type & MB_OKCANCEL) |
|
252 |
{ |
|
253 |
btn = document.createElement('input'); |
|
254 |
btn.type = 'button'; |
|
215 | 255 |
btn.value = $lang.get('etc_ok'); |
256 |
btn._GenericName = 'OK'; |
|
1 | 257 |
btn.onclick = this.clickHandler; |
258 |
btn.style.margin = '0 3px'; |
|
259 |
buttondiv.appendChild(btn); |
|
260 |
||
261 |
btn = document.createElement('input'); |
|
262 |
btn.type = 'button'; |
|
215 | 263 |
btn.value = $lang.get('etc_cancel'); |
264 |
btn._GenericName = 'Cancel'; |
|
1 | 265 |
btn.onclick = this.clickHandler; |
266 |
btn.style.margin = '0 3px'; |
|
267 |
buttondiv.appendChild(btn); |
|
268 |
} |
|
269 |
||
270 |
if(type & MB_YESNO) |
|
271 |
{ |
|
272 |
btn = document.createElement('input'); |
|
273 |
btn.type = 'button'; |
|
215 | 274 |
btn.value = $lang.get('etc_yes'); |
275 |
btn._GenericName = 'Yes'; |
|
1 | 276 |
btn.onclick = this.clickHandler; |
277 |
btn.style.margin = '0 3px'; |
|
278 |
buttondiv.appendChild(btn); |
|
279 |
||
280 |
btn = document.createElement('input'); |
|
281 |
btn.type = 'button'; |
|
215 | 282 |
btn.value = $lang.get('etc_no'); |
283 |
btn._GenericName = 'No'; |
|
1 | 284 |
btn.onclick = this.clickHandler; |
285 |
btn.style.margin = '0 3px'; |
|
286 |
buttondiv.appendChild(btn); |
|
287 |
} |
|
288 |
||
289 |
if(type & MB_YESNOCANCEL) |
|
290 |
{ |
|
291 |
btn = document.createElement('input'); |
|
292 |
btn.type = 'button'; |
|
215 | 293 |
btn.value = $lang.get('etc_yes'); |
294 |
btn._GenericName = 'Yes'; |
|
1 | 295 |
btn.onclick = this.clickHandler; |
296 |
btn.style.margin = '0 3px'; |
|
297 |
buttondiv.appendChild(btn); |
|
298 |
||
299 |
btn = document.createElement('input'); |
|
300 |
btn.type = 'button'; |
|
215 | 301 |
btn.value = $lang.get('etc_no'); |
302 |
btn._GenericName = 'No'; |
|
1 | 303 |
btn.onclick = this.clickHandler; |
304 |
btn.style.margin = '0 3px'; |
|
305 |
buttondiv.appendChild(btn); |
|
306 |
||
307 |
btn = document.createElement('input'); |
|
308 |
btn.type = 'button'; |
|
215 | 309 |
btn.value = $lang.get('etc_cancel'); |
310 |
btn._GenericName = 'Cancel'; |
|
1 | 311 |
btn.onclick = this.clickHandler; |
312 |
btn.style.margin = '0 3px'; |
|
313 |
buttondiv.appendChild(btn); |
|
314 |
} |
|
315 |
||
316 |
heading = document.createElement('h2'); |
|
317 |
heading.innerHTML = title; |
|
318 |
heading.style.color = '#50A0D0'; |
|
319 |
heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif'; |
|
320 |
heading.style.fontSize = '12pt'; |
|
321 |
heading.style.fontWeight = 'lighter'; |
|
322 |
heading.style.textTransform = 'lowercase'; |
|
323 |
heading.style.marginTop = '0'; |
|
324 |
mydiv.appendChild(heading); |
|
325 |
||
326 |
var text = document.createElement('div'); |
|
327 |
text.innerHTML = String(message); |
|
328 |
this.text_area = text; |
|
329 |
mydiv.appendChild(text); |
|
330 |
||
331 |
this.updateContent = function(text) |
|
332 |
{ |
|
333 |
this.text_area.innerHTML = text; |
|
334 |
}; |
|
320
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
335 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
336 |
this.destroy = function() |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
337 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
338 |
var mbdiv = document.getElementById('messageBox'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
339 |
mbdiv.parentNode.removeChild(mbdiv.nextSibling); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
340 |
mbdiv.parentNode.removeChild(mbdiv); |
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
341 |
if ( !mb_previously_had_darkener ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
342 |
enlighten(true); |
320
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
343 |
}; |
1 | 344 |
|
345 |
//domObjChangeOpac(0, mydiv); |
|
346 |
//domObjChangeOpac(0, master_div); |
|
347 |
||
348 |
body = document.getElementsByTagName('body'); |
|
349 |
body = body[0]; |
|
350 |
master_div.appendChild(mydiv); |
|
351 |
master_div.appendChild(buttondiv); |
|
352 |
||
353 |
body.appendChild(master_div); |
|
354 |
||
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
|
355 |
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
|
356 |
setTimeout('mb_runFlyIn();', 100); |
1 | 357 |
|
358 |
this.onclick = new Array(); |
|
359 |
this.onbeforeclick = new Array(); |
|
360 |
mb_current_obj = this; |
|
361 |
} |
|
362 |
||
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
363 |
var messagebox = MessageBox; |
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
364 |
|
1 | 365 |
function mb_runFlyIn() |
366 |
{ |
|
367 |
var mydiv = document.getElementById('messageBox'); |
|
368 |
var maindiv = mydiv.parentNode; |
|
369 |
fly_in_top(maindiv, true, false); |
|
370 |
} |
|
371 |
||
372 |
function messagebox_click(obj, mb) |
|
373 |
{ |
|
215 | 374 |
val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value; |
1 | 375 |
if(typeof mb.onbeforeclick[val] == 'function') |
376 |
{ |
|
377 |
var o = mb.onbeforeclick[val]; |
|
378 |
var resp = o(); |
|
379 |
if ( resp ) |
|
380 |
return false; |
|
381 |
o = false; |
|
382 |
} |
|
383 |
||
384 |
var mydiv = document.getElementById('messageBox'); |
|
385 |
var maindiv = mydiv.parentNode; |
|
386 |
||
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
|
387 |
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
|
388 |
{ |
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
|
389 |
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
|
390 |
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
|
391 |
mbdiv.parentNode.removeChild(mbdiv); |
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
392 |
if ( !mb_previously_had_darkener ) |
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
393 |
enlighten(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
|
394 |
} |
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
|
395 |
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
|
396 |
{ |
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
|
397 |
var to = fly_out_top(maindiv, true, false); |
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents:
461
diff
changeset
|
398 |
setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); if ( !mb_previously_had_darkener ) enlighten(true);", to); |
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
|
399 |
} |
1 | 400 |
if(typeof mb.onclick[val] == 'function') |
401 |
{ |
|
402 |
o = mb.onclick[val]; |
|
403 |
o(); |
|
404 |
o = false; |
|
405 |
} |
|
406 |
} |
|
407 |
||
408 |
function testMessageBox() |
|
409 |
{ |
|
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
410 |
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'); |
1 | 411 |
mb.onclick['OK'] = function() |
412 |
{ |
|
413 |
alert('You clicked OK!'); |
|
414 |
} |
|
415 |
mb.onbeforeclick['Cancel'] = function() |
|
416 |
{ |
|
417 |
alert('You clicked Cancel!'); |
|
418 |
} |
|
419 |
} |
|
420 |
||
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
421 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
422 |
* The miniPrompt function, for creating small prompts and dialogs. The window will be flown in and the window darkened with opac=0.4. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
423 |
* @param function Will be passed an HTMLElement that is the body of the prompt window; the function can do with this as it pleases |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
424 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
425 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
426 |
function miniPrompt(call_on_create) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
427 |
{ |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
428 |
if ( document.getElementById('specialLayer_darkener') ) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
429 |
{ |
555
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
430 |
if ( document.getElementById('specialLayer_darkener').style.display != 'none' ) |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
431 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
432 |
var opac = parseFloat(document.getElementById('specialLayer_darkener').style.opacity); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
433 |
opac = opac * 100; |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
434 |
darken(aclDisableTransitionFX, opac); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
435 |
} |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
436 |
else |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
437 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
438 |
darken(aclDisableTransitionFX, 40); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
439 |
} |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
440 |
} |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
441 |
else |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
442 |
{ |
555
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
443 |
darken(aclDisableTransitionFX, 40); |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
539
diff
changeset
|
444 |
} |
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
445 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
446 |
var wrapper = document.createElement('div'); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
447 |
wrapper.className = 'miniprompt'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
448 |
var top = document.createElement('div'); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
449 |
top.className = 'mp-top'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
450 |
var body = document.createElement('div'); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
451 |
body.className = 'mp-body'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
452 |
var bottom = document.createElement('div'); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
453 |
bottom.className = 'mp-bottom'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
454 |
if ( typeof(call_on_create) == 'function' ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
455 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
456 |
call_on_create(body); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
457 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
458 |
wrapper.appendChild(top); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
459 |
wrapper.appendChild(body); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
460 |
wrapper.appendChild(bottom); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
461 |
var left = ( getWidth() / 2 ) - ( 388 / 2 ); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
462 |
wrapper.style.left = left + 'px'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
463 |
var top = getScrollOffset() - 27; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
464 |
wrapper.style.top = top + 'px'; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
465 |
domObjChangeOpac(0, wrapper); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
466 |
var realbody = document.getElementsByTagName('body')[0]; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
467 |
realbody.appendChild(wrapper); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
468 |
|
555
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
469 |
if ( aclDisableTransitionFX ) |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
470 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
471 |
domObjChangeOpac(100, wrapper); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
472 |
} |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
473 |
else |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
474 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
475 |
fly_in_top(wrapper, true, true); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
476 |
|
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
477 |
setTimeout(function() |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
478 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
479 |
domObjChangeOpac(100, wrapper); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
480 |
}, 40); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
481 |
} |
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
482 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
483 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
484 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
485 |
* For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
486 |
* @param object:HTMLElement Child node to scan |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
487 |
* @return object |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
488 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
489 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
490 |
function miniPromptGetParent(obj) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
491 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
492 |
while ( true ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
493 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
494 |
// prevent infinite loops |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
495 |
if ( !obj || obj.tagName == 'BODY' ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
496 |
return false; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
497 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
498 |
if ( $dynano(obj).hasClass('miniprompt') ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
499 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
500 |
return obj; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
501 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
502 |
obj = obj.parentNode; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
503 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
504 |
return false; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
505 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
506 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
507 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
508 |
* Destroys the first miniPrompt div encountered by recursively checking all parent nodes. |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
509 |
* Usage: <a href="javascript:miniPromptDestroy(this);">click</a> |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
510 |
* @param object:HTMLElement a child of the div.miniprompt |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
511 |
* @param bool If true, does not call enlighten(). |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
512 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
513 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
514 |
function miniPromptDestroy(obj, nofade) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
515 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
516 |
obj = miniPromptGetParent(obj); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
517 |
if ( !obj ) |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
518 |
return false; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
519 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
520 |
// found it |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
521 |
var parent = obj.parentNode; |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
522 |
if ( !nofade ) |
555
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
523 |
enlighten(aclDisableTransitionFX); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
524 |
if ( aclDisableTransitionFX ) |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
525 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
526 |
parent.removeChild(obj); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
527 |
} |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
528 |
else |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
529 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
530 |
var timeout = fly_out_top(obj, true, true); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
531 |
setTimeout(function() |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
532 |
{ |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
533 |
parent.removeChild(obj); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
534 |
}, timeout); |
ac4c6a7f01d8
Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
550
diff
changeset
|
535 |
} |
522
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
536 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
537 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
538 |
/** |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
539 |
* Simple test case |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
540 |
*/ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
541 |
|
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
542 |
function miniPromptTest() |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
543 |
{ |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
544 |
miniPrompt(function(div) { div.innerHTML = 'hello world! <a href="#" onclick="miniPromptDestroy(this); return false;">destroy me</a>'; }); |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
545 |
} |
fd46b1bf708e
Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents:
509
diff
changeset
|
546 |
|
537
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
547 |
/** |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
548 |
* Message box system for miniPrompts. Less customization but easier to scale than the regular messageBox framework. |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
549 |
* @example |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
550 |
<code> |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
551 |
miniPromptMessage({ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
552 |
title: 'Delete page', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
553 |
message: 'Do you really want to delete this page? This is reversible unless you clear the page logs.', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
554 |
buttons: [ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
555 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
556 |
text: 'Delete', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
557 |
color: 'red', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
558 |
style: { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
559 |
fontWeight: 'bold' |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
560 |
}, |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
561 |
onclick: function() { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
562 |
ajaxDeletePage(); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
563 |
miniPromptDestroy(this); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
564 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
565 |
}, |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
566 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
567 |
text: 'cancel', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
568 |
onclick: function() { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
569 |
miniPromptDestroy(this); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
570 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
571 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
572 |
] |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
573 |
}); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
574 |
</code> |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
575 |
*/ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
576 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
577 |
function miniPromptMessage(parms) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
578 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
579 |
if ( !parms.title || !parms.message || !parms.buttons ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
580 |
return false; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
581 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
582 |
return miniPrompt(function(parent) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
583 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
584 |
try |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
585 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
586 |
var h3 = document.createElement('h3'); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
587 |
h3.appendChild(document.createTextNode(parms.title)); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
588 |
var body = document.createElement('p'); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
589 |
var message = parms.message.split(unescape('%0A')); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
590 |
for ( var i = 0; i < message.length; i++ ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
591 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
592 |
body.appendChild(document.createTextNode(message[i])); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
593 |
if ( i + 1 < message.length ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
594 |
body.appendChild(document.createElement('br')); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
595 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
596 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
597 |
parent.style.textAlign = 'center'; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
598 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
599 |
parent.appendChild(h3); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
600 |
parent.appendChild(body); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
601 |
parent.appendChild(document.createElement('br')); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
602 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
603 |
// construct buttons |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
604 |
for ( var i = 0; i < parms.buttons.length; i++ ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
605 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
606 |
var button = parms.buttons[i]; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
607 |
button.input = document.createElement('a'); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
608 |
button.input.href = '#'; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
609 |
button.input.clickAction = button.onclick; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
610 |
button.input.className = 'abutton'; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
611 |
if ( button.color ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
612 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
613 |
button.input.className += ' abutton_' + button.color; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
614 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
615 |
button.input.appendChild(document.createTextNode(button.text)); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
616 |
if ( button.style ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
617 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
618 |
for ( var j in button.style ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
619 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
620 |
button.input.style[j] = button.style[j]; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
621 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
622 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
623 |
button.input.onclick = function(e) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
624 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
625 |
try |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
626 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
627 |
this.clickAction(e); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
628 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
629 |
catch(e) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
630 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
631 |
console.error(e); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
632 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
633 |
return false; |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
634 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
635 |
parent.appendChild(button.input); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
636 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
637 |
if ( parms.buttons[0] ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
638 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
639 |
setTimeout(function() |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
640 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
641 |
parms.buttons[0].input.focus(); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
642 |
}, 300); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
643 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
644 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
645 |
catch ( e ) |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
646 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
647 |
console.error(e); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
648 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
649 |
}); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
650 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
651 |
|
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
652 |
function testMPMessageBox() |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
653 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
654 |
miniPromptMessage({ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
655 |
title: 'The Game of LIFE question #73', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
656 |
message: 'You just got your girlfriend pregnant. Please select an option:', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
657 |
buttons: [ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
658 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
659 |
text: 'Abort', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
660 |
color: 'red', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
661 |
style: { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
662 |
fontWeight: 'bold' |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
663 |
}, |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
664 |
onclick: function() { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
665 |
miniPromptDestroy(this); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
666 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
667 |
}, |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
668 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
669 |
text: 'Retry', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
670 |
color: 'blue', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
671 |
onclick: function() { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
672 |
miniPromptDestroy(this); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
673 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
674 |
}, |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
675 |
{ |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
676 |
text: 'Ignore', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
677 |
color: 'green', |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
678 |
onclick: function() { |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
679 |
miniPromptDestroy(this); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
680 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
681 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
682 |
] |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
683 |
}); |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
684 |
} |
547b7ba6d535
Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents:
522
diff
changeset
|
685 |
|
1 | 686 |
// Function to fade classes info-box, warning-box, error-box, etc. |
687 |
||
688 |
function fadeInfoBoxes() |
|
689 |
{ |
|
690 |
var divs = new Array(); |
|
691 |
d = document.getElementsByTagName('div'); |
|
692 |
j = 0; |
|
693 |
for(var i in d) |
|
694 |
{ |
|
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
326
diff
changeset
|
695 |
if ( !d[i] ) |
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
326
diff
changeset
|
696 |
continue; |
1 | 697 |
if ( !d[i].tagName ) |
698 |
continue; |
|
699 |
if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box') |
|
700 |
{ |
|
701 |
divs[j] = d[i]; |
|
702 |
j++; |
|
703 |
} |
|
704 |
} |
|
705 |
if(divs.length < 1) return; |
|
706 |
for(i in divs) |
|
707 |
{ |
|
708 |
if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000); |
|
709 |
switch(divs[i].className) |
|
710 |
{ |
|
711 |
case 'info-box': |
|
712 |
default: |
|
713 |
from = '#3333FF'; |
|
714 |
break; |
|
715 |
case 'error-box': |
|
716 |
from = '#FF3333'; |
|
717 |
break; |
|
718 |
case 'warning-box': |
|
719 |
from = '#FFFF33'; |
|
720 |
break; |
|
721 |
case 'question-box': |
|
722 |
from = '#33FF33'; |
|
723 |
break; |
|
724 |
} |
|
725 |
Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id)); |
|
726 |
} |
|
727 |
} |
|
728 |
||
729 |
// Alpha fades |
|
730 |
||
731 |
function opacity(id, opacStart, opacEnd, millisec) { |
|
732 |
//speed for each frame |
|
733 |
var speed = Math.round(millisec / 100); |
|
734 |
var timer = 0; |
|
735 |
||
736 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
737 |
if(opacStart > opacEnd) { |
|
738 |
for(i = opacStart; i >= opacEnd; i--) { |
|
739 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
740 |
timer++; |
|
741 |
} |
|
742 |
} else if(opacStart < opacEnd) { |
|
743 |
for(i = opacStart; i <= opacEnd; i++) |
|
744 |
{ |
|
745 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
746 |
timer++; |
|
747 |
} |
|
748 |
} |
|
749 |
} |
|
750 |
||
53 | 751 |
var opacityDOMCache = new Object(); |
752 |
function domOpacity(obj, opacStart, opacEnd, millisec) { |
|
753 |
//speed for each frame |
|
754 |
var speed = Math.round(millisec / 100); |
|
755 |
var timer = 0; |
|
756 |
||
757 |
// unique ID for this animation |
|
758 |
var uniqid = Math.floor(Math.random() * 1000000); |
|
759 |
opacityDOMCache[uniqid] = obj; |
|
760 |
||
761 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
762 |
if(opacStart > opacEnd) { |
|
763 |
for(i = opacStart; i >= opacEnd; i--) { |
|
764 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
765 |
timer++; |
|
766 |
} |
|
767 |
} else if(opacStart < opacEnd) { |
|
768 |
for(i = opacStart; i <= opacEnd; i++) |
|
769 |
{ |
|
770 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
771 |
timer++; |
|
772 |
} |
|
773 |
} |
|
774 |
setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed)); |
|
775 |
} |
|
776 |
||
1 | 777 |
//change the opacity for different browsers |
778 |
function changeOpac(opacity, id) { |
|
779 |
var object = document.getElementById(id).style; |
|
780 |
object.opacity = (opacity / 100); |
|
781 |
object.MozOpacity = (opacity / 100); |
|
782 |
object.KhtmlOpacity = (opacity / 100); |
|
783 |
object.filter = "alpha(opacity=" + opacity + ")"; |
|
784 |
} |
|
785 |
||
786 |
function mb_logout() |
|
787 |
{ |
|
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
542
diff
changeset
|
788 |
var mb = new MessageBox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body')); |
1 | 789 |
mb.onclick['Yes'] = function() |
790 |
{ |
|
562
75df0b2c596c
Got initial CSRF token framework implemented and sample implementation added in Special:Logout; removing Javascript compression engine from aggressive_optimize_html() and instead calling JavascriptCompressor class from js-compressor.php
Dan
parents:
555
diff
changeset
|
791 |
window.location = makeUrlNS('Special', 'Logout/' + csrf_token + '/' + title); |
1 | 792 |
} |
793 |
} |
|
794 |
||
507
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
795 |
function whiteOutElement(el) |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
796 |
{ |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
797 |
var top = $(el).Top(); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
798 |
var left = $(el).Left(); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
799 |
var width = $(el).Width(); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
800 |
var height = $(el).Height(); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
801 |
|
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
802 |
var blackout = document.createElement('div'); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
803 |
blackout.style.position = 'absolute'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
804 |
blackout.style.top = top + 'px'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
805 |
blackout.style.left = left + 'px'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
806 |
blackout.style.width = width + 'px'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
807 |
blackout.style.height = height + 'px'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
808 |
|
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
809 |
blackout.style.backgroundColor = '#FFFFFF'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
810 |
domObjChangeOpac(60, blackout); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
811 |
blackout.style.backgroundImage = 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
812 |
blackout.style.backgroundPosition = 'center center'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
813 |
blackout.style.backgroundRepeat = 'no-repeat'; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
814 |
blackout.style.zIndex = getHighestZ() + 2; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
815 |
|
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
816 |
var body = document.getElementsByTagName('body')[0]; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
817 |
body.appendChild(blackout); |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
818 |
|
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
819 |
return blackout; |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
820 |
} |
586fd7d3202d
Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents:
473
diff
changeset
|
821 |