author | Dan |
Sun, 04 May 2008 21:57:48 -0400 | |
changeset 541 | acb7e23b6ffa |
parent 537 | 547b7ba6d535 |
child 550 | 685e839d934e |
permissions | -rw-r--r-- |
1 | 1 |
// Some additional DHTML functions |
2 |
||
3 |
function fetch_offset(obj) { |
|
4 |
var left_offset = obj.offsetLeft; |
|
5 |
var top_offset = obj.offsetTop; |
|
6 |
while ((obj = obj.offsetParent) != null) { |
|
7 |
left_offset += obj.offsetLeft; |
|
8 |
top_offset += obj.offsetTop; |
|
9 |
} |
|
10 |
return { 'left' : left_offset, 'top' : top_offset }; |
|
11 |
} |
|
12 |
||
13 |
function fetch_dimensions(o) { |
|
14 |
var w = o.offsetWidth; |
|
15 |
var h = o.offsetHeight; |
|
16 |
return { 'w' : w, 'h' : h }; |
|
17 |
} |
|
18 |
||
19 |
function findParentForm(o) |
|
20 |
{ |
|
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
21 |
if ( o.tagName == 'FORM' ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
22 |
return o; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
23 |
while(true) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
24 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
25 |
o = o.parentNode; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
26 |
if ( !o ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
27 |
return false; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
28 |
if ( o.tagName == 'FORM' ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
29 |
return o; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
30 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
31 |
return false; |
1 | 32 |
} |
33 |
||
34 |
function ajaxReverseDNS(o, text) |
|
35 |
{ |
|
36 |
if(text) var ipaddr = text; |
|
37 |
else var ipaddr = o.innerHTML; |
|
38 |
rDnsObj = o; |
|
39 |
rDnsBannerObj = bannerOn('Retrieving reverse DNS info...'); |
|
40 |
ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
372
diff
changeset
|
41 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 42 |
{ |
43 |
off = fetch_offset(rDnsObj); |
|
44 |
dim = fetch_dimensions(rDnsObj); |
|
45 |
right = off['left'] + dim['w']; |
|
46 |
top = off['top'] + dim['h']; |
|
47 |
var thediv = document.createElement('div'); |
|
48 |
thediv.className = 'info-box'; |
|
49 |
thediv.style.margin = '0'; |
|
50 |
thediv.style.position = 'absolute'; |
|
51 |
thediv.style.top = top + 'px'; |
|
52 |
thediv.style.display = 'none'; |
|
53 |
thediv.style.zIndex = getHighestZ() + 2; |
|
54 |
thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000); |
|
55 |
thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>'; |
|
56 |
var body = document.getElementsByTagName('body'); |
|
57 |
body = body[0]; |
|
58 |
bannerOff(rDnsBannerObj); |
|
59 |
body.appendChild(thediv); |
|
60 |
thediv.style.display = 'block'; |
|
61 |
left = fetch_dimensions(thediv); |
|
62 |
thediv.style.display = 'none'; |
|
63 |
left = right - left['w']; |
|
64 |
thediv.style.left = left + 'px'; |
|
65 |
thediv.style.display = 'block'; |
|
66 |
fadeInfoBoxes(); |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
||
71 |
function bannerOn(text) |
|
72 |
{ |
|
73 |
darken(true); |
|
74 |
var thediv = document.createElement('div'); |
|
75 |
thediv.className = 'mdg-comment'; |
|
76 |
thediv.style.padding = '0'; |
|
77 |
thediv.style.marginLeft = '0'; |
|
78 |
thediv.style.position = 'absolute'; |
|
79 |
thediv.style.display = 'none'; |
|
80 |
thediv.style.padding = '4px'; |
|
81 |
thediv.style.fontSize = '14pt'; |
|
82 |
thediv.id = 'mdgDynamic_bannerDiv_'+Math.floor(Math.random() * 1000000); |
|
83 |
thediv.innerHTML = text; |
|
84 |
||
85 |
var body = document.getElementsByTagName('body'); |
|
86 |
body = body[0]; |
|
87 |
body.appendChild(thediv); |
|
88 |
body.style.cursor = 'wait'; |
|
89 |
||
90 |
thediv.style.display = 'block'; |
|
91 |
dim = fetch_dimensions(thediv); |
|
92 |
thediv.style.display = 'none'; |
|
93 |
bdim = { 'w' : getWidth(), 'h' : getHeight() }; |
|
94 |
so = getScrollOffset(); |
|
95 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
96 |
var left = (bdim['w'] / 2) - ( dim['w'] / 2 ); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
97 |
|
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
98 |
var top = (bdim['h'] / 2); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
99 |
top = top - ( dim['h'] / 2 ); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
100 |
|
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
101 |
top = top + so; |
1 | 102 |
|
103 |
thediv.style.top = top + 'px'; |
|
104 |
thediv.style.left = left + 'px'; |
|
105 |
||
106 |
thediv.style.display = 'block'; |
|
107 |
||
108 |
return thediv.id; |
|
109 |
} |
|
110 |
||
111 |
function bannerOff(id) |
|
112 |
{ |
|
113 |
e = document.getElementById(id); |
|
114 |
if(!e) return; |
|
115 |
e.innerHTML = ''; |
|
116 |
e.style.display = 'none'; |
|
117 |
var body = document.getElementsByTagName('body'); |
|
118 |
body = body[0]; |
|
119 |
body.style.cursor = 'default'; |
|
120 |
enlighten(true); |
|
121 |
} |
|
122 |
||
123 |
function disableUnload(message) |
|
124 |
{ |
|
125 |
if(typeof message != 'string') message = 'You may want to save your changes first.'; |
|
440 | 126 |
window._unloadmsg = message; |
127 |
window.onbeforeunload = function(e) |
|
128 |
{ |
|
129 |
if ( !e ) |
|
130 |
e = window.event; |
|
131 |
e.returnValue = window._unloadmsg; |
|
132 |
} |
|
1 | 133 |
} |
134 |
||
135 |
function enableUnload() |
|
136 |
{ |
|
440 | 137 |
window._unloadmsg = null; |
138 |
window.onbeforeunload = null; |
|
1 | 139 |
} |
140 |
||
141 |
/** |
|
142 |
* Gets the highest z-index of all divs in the document |
|
143 |
* @return integer |
|
144 |
*/ |
|
145 |
function getHighestZ() |
|
146 |
{ |
|
147 |
z = 0; |
|
148 |
var divs = document.getElementsByTagName('div'); |
|
149 |
for(var i = 0; i < divs.length; i++) |
|
150 |
{ |
|
151 |
if(divs[i].style.zIndex > z) z = divs[i].style.zIndex; |
|
152 |
} |
|
153 |
return z; |
|
154 |
} |
|
155 |
||
156 |
function isKeyPressed(event) |
|
157 |
{ |
|
158 |
if (event.shiftKey==1) |
|
159 |
{ |
|
160 |
shift = true; |
|
161 |
} |
|
162 |
else |
|
163 |
{ |
|
164 |
shift = false; |
|
165 |
} |
|
166 |
} |
|
167 |
||
168 |
function moveDiv(div, newparent) |
|
169 |
{ |
|
170 |
var backup = div; |
|
171 |
var oldparent = div.parentNode; |
|
172 |
oldparent.removeChild(div); |
|
173 |
newparent.appendChild(backup); |
|
174 |
} |
|
175 |
||
176 |
function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;} |
|
177 |
function createCookie(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";} |
|
178 |
function eraseCookie(name) {createCookie(name,"",-1);} |
|
179 |
||
180 |
var busyBannerID; |
|
181 |
function goBusy(msg) |
|
182 |
{ |
|
183 |
if(!msg) msg = 'Please wait...'; |
|
184 |
body = document.getElementsByTagName('body'); |
|
185 |
body = body[0]; |
|
186 |
body.style.cursor = 'wait'; |
|
187 |
busyBannerID = bannerOn(msg); |
|
188 |
} |
|
189 |
||
190 |
function unBusy() |
|
191 |
{ |
|
192 |
body = document.getElementsByTagName('body'); |
|
193 |
body = body[0]; |
|
194 |
body.style.cursor = 'default'; |
|
195 |
bannerOff(busyBannerID); |
|
196 |
} |
|
197 |
||
198 |
function setAjaxLoading() |
|
199 |
{ |
|
200 |
if ( document.getElementById('ajaxloadicon') ) |
|
201 |
{ |
|
200
63fddf1335d9
Nothing real special. The AJAX loading icon can be changed using the Javascript variable ajax_load_icon in header.tpl.
Dan
parents:
176
diff
changeset
|
202 |
document.getElementById('ajaxloadicon').src=ajax_load_icon; |
1 | 203 |
} |
204 |
} |
|
205 |
||
206 |
function unsetAjaxLoading() |
|
207 |
{ |
|
208 |
if ( document.getElementById('ajaxloadicon') ) |
|
209 |
{ |
|
210 |
document.getElementById('ajaxloadicon').src=scriptPath + '/images/spacer.gif'; |
|
211 |
} |
|
212 |
} |
|
213 |
||
214 |
/* |
|
215 |
* AJAX login box (experimental) |
|
436
242353360e37
Added support for Diffie-Hellman key exchange during login. w00t!
Dan
parents:
426
diff
changeset
|
216 |
* Moved / rewritten in login.js |
1 | 217 |
*/ |
218 |
||
436
242353360e37
Added support for Diffie-Hellman key exchange during login. w00t!
Dan
parents:
426
diff
changeset
|
219 |
// Included only for API-compatibility |
1 | 220 |
function ajaxPromptAdminAuth(call_on_ok, level) |
221 |
{ |
|
436
242353360e37
Added support for Diffie-Hellman key exchange during login. w00t!
Dan
parents:
426
diff
changeset
|
222 |
ajaxLogonInit(call_on_ok, level); |
1 | 223 |
} |
224 |
||
225 |
// This code is in the public domain. Feel free to link back to http://jan.moesen.nu/ |
|
226 |
function sprintf() |
|
227 |
{ |
|
228 |
if (!arguments || arguments.length < 1 || !RegExp) |
|
229 |
{ |
|
230 |
return; |
|
231 |
} |
|
232 |
var str = arguments[0]; |
|
233 |
var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; |
|
234 |
var a = b = [], numSubstitutions = 0, numMatches = 0; |
|
235 |
while (a = re.exec(str)) |
|
236 |
{ |
|
237 |
var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; |
|
238 |
var pPrecision = a[5], pType = a[6], rightPart = a[7]; |
|
239 |
||
240 |
//alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision); |
|
241 |
||
242 |
numMatches++; |
|
243 |
if (pType == '%') |
|
244 |
{ |
|
245 |
subst = '%'; |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
numSubstitutions++; |
|
250 |
if (numSubstitutions >= arguments.length) |
|
251 |
{ |
|
252 |
alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).'); |
|
253 |
} |
|
254 |
var param = arguments[numSubstitutions]; |
|
255 |
var pad = ''; |
|
256 |
if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1); |
|
257 |
else if (pPad) pad = pPad; |
|
258 |
var justifyRight = true; |
|
259 |
if (pJustify && pJustify === "-") justifyRight = false; |
|
260 |
var minLength = -1; |
|
261 |
if (pMinLength) minLength = parseInt(pMinLength); |
|
262 |
var precision = -1; |
|
263 |
if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1)); |
|
264 |
var subst = param; |
|
265 |
if (pType == 'b') subst = parseInt(param).toString(2); |
|
266 |
else if (pType == 'c') subst = String.fromCharCode(parseInt(param)); |
|
267 |
else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0; |
|
268 |
else if (pType == 'u') subst = Math.abs(param); |
|
269 |
else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param); |
|
270 |
else if (pType == 'o') subst = parseInt(param).toString(8); |
|
271 |
else if (pType == 's') subst = param; |
|
272 |
else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase(); |
|
273 |
else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase(); |
|
274 |
} |
|
275 |
str = leftpart + subst + rightPart; |
|
276 |
} |
|
277 |
return str; |
|
278 |
} |
|
279 |
||
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
280 |
/** |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
281 |
* Insert a DOM object _after_ the specified child. |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
282 |
* @param object Parent node |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
283 |
* @param object Node to insert |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
284 |
* @param object Node to insert after |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
285 |
*/ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
286 |
|
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
287 |
function insertAfter(parent, baby, bigsister) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
288 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
289 |
try |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
290 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
291 |
if ( parent.childNodes[parent.childNodes.length-1] == bigsister ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
292 |
parent.appendChild(baby); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
293 |
else |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
294 |
parent.insertBefore(baby, bigsister.nextSibling); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
295 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
296 |
catch(e) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
297 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
298 |
alert(e.toString()); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
299 |
if ( window.console ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
300 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
301 |
// Firebug support |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
302 |
window.console.warn(e); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
303 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
304 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
305 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
306 |
|
125
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
307 |
/** |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
308 |
* Validates an e-mail address. |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
309 |
* @param string E-mail address |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
310 |
* @return bool |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
311 |
*/ |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
312 |
|
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
313 |
function validateEmail(email) |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
314 |
{ |
504
bc8e0e9ee01d
Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents:
501
diff
changeset
|
315 |
return ( email.match(/^(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]*)*<[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*>)$/) ) ? true : false; |
125
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
316 |
} |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
317 |
|
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
318 |
/** |
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
319 |
* Validates a username. |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
320 |
* @param string Username to test |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
321 |
* @return bool |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
322 |
*/ |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
323 |
|
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
324 |
function validateUsername(username) |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
325 |
{ |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
326 |
var regex = new RegExp('^[^<>&\?\'"%\n\r/]+$', ''); |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
327 |
return ( username.match(regex) ) ? true : false; |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
328 |
} |
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
329 |
|
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
340
diff
changeset
|
330 |
/** |
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
331 |
* Equivalent of PHP's time() |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
332 |
* @return int |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
333 |
*/ |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
334 |
|
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
335 |
function unix_time() |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
336 |
{ |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
337 |
return parseInt((new Date()).getTime()/1000); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
338 |
} |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
326
diff
changeset
|
339 |
|
420
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
340 |
/* |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
341 |
* Utility functions, moved from windows.js |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
342 |
*/ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
343 |
|
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
344 |
// getElementWidth() and getElementHeight() |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
345 |
// Source: http://www.aspandjavascript.co.uk/javascript/javascript_api/get_element_width_height.asp |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
346 |
|
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
347 |
function getElementHeight(Elem) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
348 |
if (ns4) |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
349 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
350 |
var elem = getObjNN4(document, Elem); |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
351 |
return elem.clip.height; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
352 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
353 |
else |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
354 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
355 |
if(document.getElementById) |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
356 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
357 |
var elem = document.getElementById(Elem); |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
358 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
359 |
else if (document.all) |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
360 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
361 |
var elem = document.all[Elem]; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
362 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
363 |
if (op5) |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
364 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
365 |
xPos = elem.style.pixelHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
366 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
367 |
else |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
368 |
{ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
369 |
xPos = elem.offsetHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
370 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
371 |
return xPos; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
372 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
373 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
374 |
|
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
375 |
function getElementWidth(Elem) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
376 |
if (ns4) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
377 |
var elem = getObjNN4(document, Elem); |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
378 |
return elem.clip.width; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
379 |
} else { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
380 |
if(document.getElementById) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
381 |
var elem = document.getElementById(Elem); |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
382 |
} else if (document.all){ |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
383 |
var elem = document.all[Elem]; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
384 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
385 |
if (op5) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
386 |
xPos = elem.style.pixelWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
387 |
} else { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
388 |
xPos = elem.offsetWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
389 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
390 |
return xPos; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
391 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
392 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
393 |
|
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
394 |
function getHeight() { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
395 |
var myHeight = 0; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
396 |
if( typeof( window.innerWidth ) == 'number' ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
397 |
myHeight = window.innerHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
398 |
} else if( document.documentElement && |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
399 |
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
400 |
myHeight = document.documentElement.clientHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
401 |
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
402 |
myHeight = document.body.clientHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
403 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
404 |
return myHeight; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
405 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
406 |
|
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
407 |
function getWidth() { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
408 |
var myWidth = 0; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
409 |
if( typeof( window.innerWidth ) == 'number' ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
410 |
myWidth = window.innerWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
411 |
} else if( document.documentElement && |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
412 |
( document.documentElement.clientWidth || document.documentElement.clientWidth ) ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
413 |
myWidth = document.documentElement.clientWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
414 |
} else if( document.body && ( document.body.clientWidth || document.body.clientWidth ) ) { |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
415 |
myWidth = document.body.clientWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
416 |
} |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
417 |
return myWidth; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
413
diff
changeset
|
418 |
} |
426 | 419 |
|
420 |
/** |
|
421 |
* Sanitizes a page URL string so that it can safely be stored in the database. |
|
422 |
* @param string Page ID to sanitize |
|
423 |
* @return string Cleaned text |
|
424 |
*/ |
|
425 |
||
426 |
function sanitize_page_id(page_id) |
|
427 |
{ |
|
428 |
// Remove character escapes |
|
429 |
page_id = dirtify_page_id(page_id); |
|
430 |
||
431 |
var regex = new RegExp('[A-Za-z0-9\\[\\]\./:;\(\)@_-]', 'g'); |
|
432 |
pid_clean = page_id.replace(regex, 'X'); |
|
433 |
var pid_dirty = []; |
|
434 |
for ( var i = 0; i < pid_clean.length; i++ ) |
|
435 |
pid_dirty[i] = pid_clean.substr(i, 1); |
|
436 |
||
437 |
for ( var i = 0; i < pid_dirty.length; i++ ) |
|
438 |
{ |
|
439 |
var char = pid_dirty[i]; |
|
440 |
if ( char == 'X' ) |
|
441 |
continue; |
|
442 |
var cid = char.charCodeAt(0); |
|
443 |
cid = cid.toString(16).toUpperCase(); |
|
444 |
if ( cid.length < 2 ) |
|
445 |
{ |
|
446 |
cid = '0' + cid; |
|
447 |
} |
|
448 |
pid_dirty[i] = "." + cid; |
|
449 |
} |
|
450 |
||
451 |
var pid_chars = []; |
|
452 |
for ( var i = 0; i < page_id.length; i++ ) |
|
453 |
pid_chars[i] = page_id.substr(i, 1); |
|
454 |
||
455 |
var page_id_cleaned = ''; |
|
456 |
||
457 |
for ( var id in pid_chars ) |
|
458 |
{ |
|
459 |
var char = pid_chars[id]; |
|
460 |
if ( pid_dirty[id] == 'X' ) |
|
461 |
page_id_cleaned += char; |
|
462 |
else |
|
463 |
page_id_cleaned += pid_dirty[id]; |
|
464 |
} |
|
465 |
||
466 |
return page_id_cleaned; |
|
467 |
} |
|
468 |
||
469 |
/** |
|
470 |
* Removes character escapes in a page ID string |
|
471 |
* @param string Page ID string to dirty up |
|
472 |
* @return string |
|
473 |
*/ |
|
474 |
||
475 |
function dirtify_page_id(page_id) |
|
476 |
{ |
|
477 |
// First, replace spaces with underscores |
|
478 |
page_id = page_id.replace(/ /g, '_'); |
|
479 |
||
480 |
var matches = page_id.match(/\.[A-Fa-f0-9][A-Fa-f0-9]/g); |
|
481 |
||
482 |
if ( matches != null ) |
|
483 |
{ |
|
484 |
for ( var i = 0; i < matches.length; i++ ) |
|
485 |
{ |
|
486 |
var match = matches[i]; |
|
487 |
var byt = (match.substr(1)).toUpperCase(); |
|
488 |
var code = eval("0x" + byt); |
|
489 |
var regex = new RegExp('\\.' + byt, 'g'); |
|
490 |
page_id = page_id.replace(regex, String.fromCharCode(code)); |
|
491 |
} |
|
492 |
} |
|
493 |
||
494 |
return page_id; |
|
495 |
} |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
496 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
497 |
/* |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
498 |
* Expandable fieldsets |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
499 |
*/ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
500 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
501 |
var expander_onload = function() |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
502 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
503 |
var sets = document.getElementsByTagName('fieldset'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
504 |
if ( sets.length < 1 ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
505 |
return false; |
513 | 506 |
var init_us = []; |
507 |
for ( var index = 0; index < sets.length; index++ ) |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
508 |
{ |
513 | 509 |
var mode = sets[index].getAttribute('enano:expand'); |
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
510 |
if ( mode == 'closed' || mode == 'open' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
511 |
{ |
513 | 512 |
init_us.push(sets[index]); |
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
513 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
514 |
} |
513 | 515 |
for ( var k = 0; k < init_us.length; k++ ) |
516 |
{ |
|
517 |
expander_init_element(init_us[k]); |
|
518 |
} |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
519 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
520 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
521 |
function expander_init_element(el) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
522 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
523 |
// get the legend tag |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
524 |
var legend = el.getElementsByTagName('legend')[0]; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
525 |
if ( !legend ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
526 |
return false; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
527 |
// existing content |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
528 |
var existing_inner = legend.innerHTML; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
529 |
// blank the innerHTML and replace it with a link |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
530 |
legend.innerHTML = ''; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
531 |
var button = document.createElement('a'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
532 |
button.className = 'expander expander-open'; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
533 |
button.innerHTML = existing_inner; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
534 |
button.href = '#'; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
535 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
536 |
legend.appendChild(button); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
537 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
538 |
button.onclick = function() |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
539 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
540 |
try |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
541 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
542 |
expander_handle_click(this); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
543 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
544 |
catch(e) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
545 |
{ |
513 | 546 |
console.debug('Exception caught: ', e); |
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
547 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
548 |
return false; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
549 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
550 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
551 |
if ( el.getAttribute('enano:expand') == 'closed' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
552 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
553 |
expander_close(el); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
554 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
555 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
556 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
557 |
function expander_handle_click(el) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
558 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
559 |
if ( el.parentNode.parentNode.tagName != 'FIELDSET' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
560 |
return false; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
561 |
var parent = el.parentNode.parentNode; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
562 |
if ( parent.getAttribute('enano:expand') == 'closed' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
563 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
564 |
expander_open(parent); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
565 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
566 |
else |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
567 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
568 |
expander_close(parent); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
569 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
570 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
571 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
572 |
function expander_close(el) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
573 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
574 |
var children = el.childNodes; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
575 |
for ( var i = 0; i < children.length; i++ ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
576 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
577 |
var child = children[i]; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
578 |
if ( child.tagName == 'LEGEND' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
579 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
580 |
var a = child.getElementsByTagName('a')[0]; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
581 |
$(a).rmClass('expander-open'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
582 |
$(a).addClass('expander-closed'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
583 |
continue; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
584 |
} |
513 | 585 |
if ( child.style ) |
586 |
{ |
|
587 |
child.expander_meta_old_state = child.style.display; |
|
588 |
child.style.display = 'none'; |
|
589 |
} |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
590 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
591 |
el.expander_meta_padbak = el.style.padding; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
592 |
el.setAttribute('enano:expand', 'closed'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
593 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
594 |
|
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
595 |
function expander_open(el) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
596 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
597 |
var children = el.childNodes; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
598 |
for ( var i = 0; i < children.length; i++ ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
599 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
600 |
var child = children[i]; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
601 |
if ( child.tagName == 'LEGEND' ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
602 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
603 |
var a = child.getElementsByTagName('a')[0]; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
604 |
$(a).rmClass('expander-closed'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
605 |
$(a).addClass('expander-open'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
606 |
continue; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
607 |
} |
513 | 608 |
if ( child.expander_meta_old_state && child.style ) |
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
609 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
610 |
child.style.display = child.expander_meta_old_state; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
611 |
child.expander_meta_old_state = null; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
612 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
613 |
else |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
614 |
{ |
513 | 615 |
if ( child.style ) |
616 |
{ |
|
617 |
child.style.display = null; |
|
618 |
} |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
619 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
620 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
621 |
if ( el.expander_meta_padbak ) |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
622 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
623 |
el.style.padding = el.expander_meta_padbak; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
624 |
el.expander_meta_padbak = null; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
625 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
626 |
else |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
627 |
{ |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
628 |
el.style.padding = null; |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
629 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
630 |
el.setAttribute('enano:expand', 'open'); |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
631 |
} |
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
632 |
|
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:
520
diff
changeset
|
633 |
/** |
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:
520
diff
changeset
|
634 |
* Equivalent to PHP's explode 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:
520
diff
changeset
|
635 |
*/ |
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:
520
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:
520
diff
changeset
|
637 |
function explode(needle, haystack) |
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:
520
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:
520
diff
changeset
|
639 |
return haystack.split(needle); |
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:
520
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:
520
diff
changeset
|
641 |
|
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
458
diff
changeset
|
642 |
addOnloadHook(expander_onload); |