154 var MB_ICONLOCK = 512; |
154 var MB_ICONLOCK = 512; |
155 |
155 |
156 // Can be set to true by slow themes (St. Patty) |
156 // Can be set to true by slow themes (St. Patty) |
157 if ( typeof(pref_disable_js_fx) != 'boolean' ) |
157 if ( typeof(pref_disable_js_fx) != 'boolean' ) |
158 { |
158 { |
159 var pref_disable_js_fx = false; |
159 var pref_disable_js_fx = false; |
160 } |
160 } |
161 var aclDisableTransitionFX = ( is_firefox2 || pref_disable_js_fx ) ? true : false; |
161 var aclDisableTransitionFX = ( is_firefox2 || pref_disable_js_fx ) ? true : false; |
162 |
162 |
163 // Syntax: |
163 // Syntax: |
164 // messagebox(MB_OK|MB_ICONINFORMATION, 'Title', 'Text'); |
164 // messagebox(MB_OK|MB_ICONINFORMATION, 'Title', 'Text'); |
165 // :-D |
165 // :-D |
166 |
166 |
167 var $_REQUEST = new Object(); |
167 var $_REQUEST = new Object(); |
168 if ( window.location.hash ) |
168 if ( window.location.hash ) |
169 { |
169 { |
170 var hash = String(window.location.hash); |
170 var hash = String(window.location.hash); |
171 hash = hash.substr(1); |
171 hash = hash.substr(1); |
172 var reqobj = hash.split(';'); |
172 var reqobj = hash.split(';'); |
173 var a, b; |
173 var a, b; |
174 for ( var i = 0; i < reqobj.length; i++ ) |
174 for ( var i = 0; i < reqobj.length; i++ ) |
175 { |
175 { |
176 a = reqobj[i].substr(0, reqobj[i].indexOf(':')); |
176 a = reqobj[i].substr(0, reqobj[i].indexOf(':')); |
177 b = reqobj[i].substr( ( reqobj[i].indexOf(':') + 1 ) ); |
177 b = reqobj[i].substr( ( reqobj[i].indexOf(':') + 1 ) ); |
178 $_REQUEST[a] = b; |
178 $_REQUEST[a] = b; |
179 } |
179 } |
180 } |
180 } |
181 |
181 |
182 if ( !onload_hooks ) |
182 if ( !onload_hooks ) |
183 var onload_hooks = new Array(); |
183 var onload_hooks = new Array(); |
184 |
184 |
185 function addOnloadHook(func) |
185 function addOnloadHook(func) |
186 { |
186 { |
187 if ( typeof ( func ) == 'function' ) |
187 if ( typeof ( func ) == 'function' ) |
188 { |
188 { |
189 if ( typeof(onload_hooks.push) == 'function' ) |
189 if ( typeof(onload_hooks.push) == 'function' ) |
190 { |
190 { |
191 onload_hooks.push(func); |
191 onload_hooks.push(func); |
192 } |
192 } |
193 else |
193 else |
194 { |
194 { |
195 onload_hooks[onload_hooks.length] = func; |
195 onload_hooks[onload_hooks.length] = func; |
196 } |
196 } |
197 } |
197 } |
198 } |
198 } |
199 |
199 |
200 function runOnloadHooks(e) |
200 function runOnloadHooks(e) |
201 { |
201 { |
202 var _errorTrapper = 0; |
202 var _errorTrapper = 0; |
203 for ( var _oLc = 0; _oLc < onload_hooks.length; _oLc++ ) |
203 for ( var _oLc = 0; _oLc < onload_hooks.length; _oLc++ ) |
204 { |
204 { |
205 _errorTrapper++; |
205 _errorTrapper++; |
206 if ( _errorTrapper >= 1000 ) |
206 if ( _errorTrapper >= 1000 ) |
207 break; |
207 break; |
208 var _f = onload_hooks[_oLc]; |
208 var _f = onload_hooks[_oLc]; |
209 if ( typeof(_f) == 'function' ) |
209 if ( typeof(_f) == 'function' ) |
210 { |
210 { |
211 _f(e); |
211 _f(e); |
212 } |
212 } |
213 } |
213 } |
214 onload_hooks = []; |
214 onload_hooks = []; |
215 } |
215 } |
216 |
216 |
217 var enano_hooks = {}; |
217 var enano_hooks = {}; |
218 function setHook(hook_name) |
218 function setHook(hook_name) |
219 { |
219 { |
220 if ( enano_hooks[hook_name] ) |
220 if ( enano_hooks[hook_name] ) |
221 { |
221 { |
222 return enano_hooks[hook_name]; |
222 return enano_hooks[hook_name]; |
223 } |
223 } |
224 return 'void(0);'; |
224 return 'void(0);'; |
225 } |
225 } |
226 |
226 |
227 function attachHook(hook_name, code) |
227 function attachHook(hook_name, code) |
228 { |
228 { |
229 if ( !enano_hooks[hook_name] ) |
229 if ( !enano_hooks[hook_name] ) |
230 enano_hooks[hook_name] = ''; |
230 enano_hooks[hook_name] = ''; |
231 |
231 |
232 enano_hooks[hook_name] += code; |
232 enano_hooks[hook_name] += code; |
233 } |
233 } |
234 |
234 |
235 var loaded_components = loaded_components || {}; |
235 var loaded_components = loaded_components || {}; |
236 var _load_component_running = false; |
236 var _load_component_running = false; |
237 function load_component(file) |
237 function load_component(file) |
238 { |
238 { |
239 var multiple = false; |
239 var multiple = false; |
240 if ( typeof(file) == 'object' ) |
240 if ( typeof(file) == 'object' ) |
241 { |
241 { |
242 if ( ENANO_JSRES_COMPRESSED ) |
242 if ( ENANO_JSRES_COMPRESSED ) |
243 { |
243 { |
244 multiple = true; |
244 multiple = true; |
245 for ( var i = 0; i < file.length; i++ ) |
245 for ( var i = 0; i < file.length; i++ ) |
246 { |
246 { |
247 file[i] = (file[i].replace(/\.js$/, '')) + '.js'; |
247 file[i] = (file[i].replace(/\.js$/, '')) + '.js'; |
248 if ( loaded_components[file[i]] ) |
248 if ( loaded_components[file[i]] ) |
249 { |
249 { |
250 file[i] = false; |
250 file[i] = false; |
251 } |
251 } |
252 } |
252 } |
253 var file2 = []; |
253 var file2 = []; |
254 for ( var i = 0; i < file.length; i++ ) |
254 for ( var i = 0; i < file.length; i++ ) |
255 { |
255 { |
256 if ( file[i] ) |
256 if ( file[i] ) |
257 file2.push(file[i]); |
257 file2.push(file[i]); |
258 } |
258 } |
259 file = file2; |
259 file = file2; |
260 delete(file2); |
260 delete(file2); |
261 if ( file.length < 1 ) |
261 if ( file.length < 1 ) |
262 { |
262 { |
263 return true; |
263 return true; |
264 } |
264 } |
265 var file_flat = implode(',', file); |
265 var file_flat = implode(',', file); |
266 } |
266 } |
267 else |
267 else |
268 { |
268 { |
269 for ( var i = 0; i < file.length; i++ ) |
269 for ( var i = 0; i < file.length; i++ ) |
270 { |
270 { |
271 load_component(file[i]); |
271 load_component(file[i]); |
272 } |
272 } |
273 return true; |
273 return true; |
274 } |
274 } |
275 } |
275 } |
276 _load_component_running = true; |
276 _load_component_running = true; |
277 if ( !multiple ) |
277 if ( !multiple ) |
278 { |
278 { |
279 file = file.replace(/\.js$/, ''); |
279 file = file.replace(/\.js$/, ''); |
280 |
280 |
281 if ( loaded_components[file + '.js'] ) |
281 if ( loaded_components[file + '.js'] ) |
282 { |
282 { |
283 // already loaded |
283 // already loaded |
284 return true; |
284 return true; |
285 } |
285 } |
286 } |
286 } |
287 |
287 |
288 console.info('Loading component %s via AJAX', ( multiple ? file_flat : file )); |
288 console.info('Loading component %s via AJAX', ( multiple ? file_flat : file )); |
289 |
289 |
290 load_show_win(( multiple ? file_flat : file )); |
290 load_show_win(( multiple ? file_flat : file )); |
291 |
291 |
292 // get an XHR instance |
292 // get an XHR instance |
293 var ajax = ajaxMakeXHR(); |
293 var ajax = ajaxMakeXHR(); |
294 |
294 |
295 if ( !multiple ) |
295 if ( !multiple ) |
296 file = file + '.js'; |
296 file = file + '.js'; |
297 var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + (multiple ? file_flat : file ) + '&' + enano_version : scriptPath + '/includes/clientside/static/' + file + '?' + enano_version; |
297 var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + (multiple ? file_flat : file ) + '&' + enano_version : scriptPath + '/includes/clientside/static/' + file + '?' + enano_version; |
298 try |
298 try |
299 { |
299 { |
300 ajax.open('GET', uri, false); |
300 ajax.open('GET', uri, false); |
301 ajax.onreadystatechange = function() |
301 ajax.onreadystatechange = function() |
302 { |
302 { |
303 if ( this.readyState == 4 && this.status != 200 ) |
303 if ( this.readyState == 4 && this.status != 200 ) |
304 { |
304 { |
305 alert('There was a problem loading a script from the server. Please check your network connection.'); |
305 alert('There was a problem loading a script from the server. Please check your network connection.'); |
306 load_hide_win(); |
306 load_hide_win(); |
307 throw('load_component(): XHR for component ' + file + ' failed'); |
307 throw('load_component(): XHR for component ' + file + ' failed'); |
308 } |
308 } |
309 } |
309 } |
310 ajax.send(null); |
310 ajax.send(null); |
311 // async request, so if status != 200 at this point then we're screwed |
311 // async request, so if status != 200 at this point then we're screwed |
312 if ( ajax.readyState == 4 && ajax.status == 200 ) |
312 if ( ajax.readyState == 4 && ajax.status == 200 ) |
313 { |
313 { |
314 if ( onload_complete ) |
314 if ( onload_complete ) |
315 onload_hooks = []; |
315 onload_hooks = []; |
316 eval_global(ajax.responseText); |
316 eval_global(ajax.responseText); |
317 if ( window.jQuery && aclDisableTransitionFX ) |
317 if ( window.jQuery && aclDisableTransitionFX ) |
318 if ( window.jQuery.fx ) |
318 if ( window.jQuery.fx ) |
319 window.jQuery.fx.off = true; |
319 window.jQuery.fx.off = true; |
320 load_hide_win(); |
320 load_hide_win(); |
321 if ( onload_complete ) |
321 if ( onload_complete ) |
322 runOnloadHooks(); |
322 runOnloadHooks(); |
323 } |
323 } |
324 } |
324 } |
325 catch(e) |
325 catch(e) |
326 { |
326 { |
327 alert('There was a problem loading a script from the server. Please check your network connection.'); |
327 alert('There was a problem loading a script from the server. Please check your network connection.'); |
328 load_hide_win(); |
328 load_hide_win(); |
329 console.info("Component loader exception is shown below."); |
329 console.info("Component loader exception is shown below."); |
330 console.debug(e); |
330 console.debug(e); |
331 console.trace(); |
331 console.trace(); |
332 throw('load_component(): XHR for component ' + file + ' failed'); |
332 throw('load_component(): XHR for component ' + file + ' failed'); |
333 } |
333 } |
334 |
334 |
335 if ( !multiple ) |
335 if ( !multiple ) |
336 { |
336 { |
337 loaded_components[file] = true; |
337 loaded_components[file] = true; |
338 } |
338 } |
339 _load_component_running = false; |
339 _load_component_running = false; |
340 return true; |
340 return true; |
341 } |
341 } |
342 |
342 |
343 function load_show_win(file) |
343 function load_show_win(file) |
344 { |
344 { |
345 var img = '<img style="margin-right: 5px" src="' + cdnPath + '/images/loading.gif" />'; |
345 var img = '<img style="margin-right: 5px" src="' + cdnPath + '/images/loading.gif" />'; |
346 if ( document.getElementById('_js_load_component') ) |
346 if ( document.getElementById('_js_load_component') ) |
347 { |
347 { |
348 document.getElementById('_js_load_component').innerHTML = img + msg_loading_component.replace('%component%', file); |
348 document.getElementById('_js_load_component').innerHTML = img + msg_loading_component.replace('%component%', file); |
349 return; |
349 return; |
350 } |
350 } |
351 file = file.replace(/\.js$/, '').replace(/\.js,/g, ', '); |
351 file = file.replace(/\.js$/, '').replace(/\.js,/g, ', '); |
352 var ld = document.createElement('div'); |
352 var ld = document.createElement('div'); |
353 ld.style.padding = '10px'; |
353 ld.style.padding = '10px'; |
354 ld.style.height = '12px'; |
354 ld.style.height = '12px'; |
355 ld.style.position = 'fixed'; |
355 ld.style.position = 'fixed'; |
356 ld.style.right = '5px'; |
356 ld.style.right = '5px'; |
357 ld.style.bottom = '0px'; |
357 ld.style.bottom = '0px'; |
358 ld.innerHTML = img + msg_loading_component.replace('%component%', file); |
358 ld.innerHTML = img + msg_loading_component.replace('%component%', file); |
359 ld.id = '_js_load_component'; |
359 ld.id = '_js_load_component'; |
360 |
360 |
361 // FYI: The base64 encoded image is a 70% opacity 1x1px white PNG. |
361 // FYI: The base64 encoded image is a 70% opacity 1x1px white PNG. |
362 ld.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAA1JREFUCNdj+P///xkACcgDypG+nnEAAAAASUVORK5CYII=)'; |
362 ld.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAA1JREFUCNdj+P///xkACcgDypG+nnEAAAAASUVORK5CYII=)'; |
363 |
363 |
364 document.body.appendChild(ld); |
364 document.body.appendChild(ld); |
365 document.body.style.cursor = 'wait'; |
365 document.body.style.cursor = 'wait'; |
366 } |
366 } |
367 |
367 |
368 function load_hide_win() |
368 function load_hide_win() |
369 { |
369 { |
370 var ld = document.getElementById('_js_load_component'); |
370 var ld = document.getElementById('_js_load_component'); |
371 if ( !ld ) |
371 if ( !ld ) |
372 return false; |
372 return false; |
373 ld.parentNode.removeChild(ld); |
373 ld.parentNode.removeChild(ld); |
374 document.body.style.cursor = 'default'; |
374 document.body.style.cursor = 'default'; |
375 } |
375 } |
376 |
376 |
377 // evaluate a snippet of code in the global context, used for dynamic component loading |
377 // evaluate a snippet of code in the global context, used for dynamic component loading |
378 // from: http://dean.edwards.name/weblog/2006/11/sandbox/ |
378 // from: http://dean.edwards.name/weblog/2006/11/sandbox/ |
379 function eval_global(_jsString) |
379 function eval_global(_jsString) |
380 { |
380 { |
381 if (typeof _jsString != "string") |
381 if (typeof _jsString != "string") |
382 { |
382 { |
383 return false; |
383 return false; |
384 } |
384 } |
385 |
385 |
386 // Check whether window.eval executes code in the global scope. |
386 // Check whether window.eval executes code in the global scope. |
387 window.eval("var __INCLUDE_TEST_1__ = true;"); |
387 window.eval("var __INCLUDE_TEST_1__ = true;"); |
388 if (typeof window.__INCLUDE_TEST_1__ != "undefined") |
388 if (typeof window.__INCLUDE_TEST_1__ != "undefined") |
389 { |
389 { |
390 delete window.__INCLUDE_TEST_1__; |
390 delete window.__INCLUDE_TEST_1__; |
391 window.eval(_jsString); |
391 window.eval(_jsString); |
392 } |
392 } |
393 else if (typeof window.execScript != "undefined") // IE only |
393 else if (typeof window.execScript != "undefined") // IE only |
394 { |
394 { |
395 window.execScript(_jsString); |
395 window.execScript(_jsString); |
396 } |
396 } |
397 else |
397 else |
398 { |
398 { |
399 // Test effectiveness of creating a new SCRIPT element and adding it to the document. |
399 // Test effectiveness of creating a new SCRIPT element and adding it to the document. |
400 this._insertScriptTag = function (_jsCode) { |
400 this._insertScriptTag = function (_jsCode) { |
401 var _script = document.createElement("script"); |
401 var _script = document.createElement("script"); |
402 _script.type = "text/javascript"; |
402 _script.type = "text/javascript"; |
403 _script.defer = false; |
403 _script.defer = false; |
404 _script.text = _jsCode; |
404 _script.text = _jsCode; |
405 var _headNodeSet = document.getElementsByTagName("head"); |
405 var _headNodeSet = document.getElementsByTagName("head"); |
406 if (_headNodeSet.length) |
406 if (_headNodeSet.length) |
407 { |
407 { |
408 _script = _headNodeSet.item(0).appendChild(_script); |
408 _script = _headNodeSet.item(0).appendChild(_script); |
409 } |
409 } |
410 else |
410 else |
411 { |
411 { |
412 var _head = document.createElement("head"); |
412 var _head = document.createElement("head"); |
413 _head = document.documentElement.appendChild(_head); |
413 _head = document.documentElement.appendChild(_head); |
414 _script = _head.appendChild(_script); |
414 _script = _head.appendChild(_script); |
415 } |
415 } |
416 return _script; |
416 return _script; |
417 } |
417 } |
418 var _testScript = this._insertScriptTag("var __INCLUDE_TEST_2__ = true;"); |
418 var _testScript = this._insertScriptTag("var __INCLUDE_TEST_2__ = true;"); |
419 if (typeof window.__INCLUDE_TEST_2__ == "boolean") |
419 if (typeof window.__INCLUDE_TEST_2__ == "boolean") |
420 { |
420 { |
421 _testScript.parentNode.removeChild(_testScript); |
421 _testScript.parentNode.removeChild(_testScript); |
422 this._insertScriptTag(_jsString); |
422 this._insertScriptTag(_jsString); |
423 } |
423 } |
424 else |
424 else |
425 { |
425 { |
426 // Check whether window.setTimeout works in real time. |
426 // Check whether window.setTimeout works in real time. |
427 window.setTimeout("var __INCLUDE_TEST_3__ = true;", 0); |
427 window.setTimeout("var __INCLUDE_TEST_3__ = true;", 0); |
428 if (typeof window.__INCLUDE_TEST_3__ != "undefined") |
428 if (typeof window.__INCLUDE_TEST_3__ != "undefined") |
429 { |
429 { |
430 delete window.__INCLUDE_TEST_3__; |
430 delete window.__INCLUDE_TEST_3__; |
431 window.setTimeout(_jsString, 0); |
431 window.setTimeout(_jsString, 0); |
432 } |
432 } |
433 } |
433 } |
434 } |
434 } |
435 |
435 |
436 return true; |
436 return true; |
437 } |
437 } |
438 |
438 |
439 var autofill_check = function() |
439 var autofill_check = function() |
440 { |
440 { |
441 var inputs = document.getElementsByTagName('input'); |
441 var inputs = document.getElementsByTagName('input'); |
442 for ( var i = 0; i < inputs.length; i++ ) |
442 for ( var i = 0; i < inputs.length; i++ ) |
443 { |
443 { |
444 if ( inputs[i].className ) |
444 if ( inputs[i].className ) |
445 { |
445 { |
446 if ( inputs[i].className.match(/^autofill/) ) |
446 if ( inputs[i].className.match(/^autofill/) ) |
447 { |
447 { |
448 load_component('autofill'); |
448 load_component('autofill'); |
449 return; |
449 return; |
450 } |
450 } |
451 } |
451 } |
452 } |
452 } |
453 } |
453 } |
454 |
454 |
455 addOnloadHook(autofill_check); |
455 addOnloadHook(autofill_check); |
456 |
456 |
457 var head = document.getElementsByTagName('head')[0]; |
457 var head = document.getElementsByTagName('head')[0]; |
458 |
458 |
459 // safari has window.console but not the .debug() method |
459 // safari has window.console but not the .debug() method |
460 if ( is_Safari && !window.console.debug ) |
460 if ( is_Safari && !window.console.debug ) |
461 { |
461 { |
462 window.console.debug = function() {}; |
462 window.console.debug = function() {}; |
463 } |
463 } |
464 |
464 |
465 // Do not remove the following comments, they are used by jsres.php. |
465 // Do not remove the following comments, they are used by jsres.php. |
466 /*!START_INCLUDER*/ |
466 /*!START_INCLUDER*/ |
467 |
467 |
468 // Start loading files |
468 // Start loading files |
469 // The string from the [ to the ] needs to be valid JSON, it's parsed by jsres.php. |
469 // The string from the [ to the ] needs to be valid JSON, it's parsed by jsres.php. |
470 var thefiles = [ |
470 var thefiles = [ |
471 'dynano.js', |
471 'dynano.js', |
472 'functions.js', |
472 'functions.js', |
473 'dropdown.js', |
473 'dropdown.js', |
474 'json.js', |
474 'json.js', |
475 'sliders.js', |
475 'sliders.js', |
476 'tinymce-init.js', |
476 'tinymce-init.js', |
477 'loader.js' |
477 'loader.js' |
478 ]; |
478 ]; |
479 |
479 |
480 for(var f in thefiles) |
480 for(var f in thefiles) |
481 { |
481 { |
482 if ( typeof(thefiles[f]) != 'string' ) |
482 if ( typeof(thefiles[f]) != 'string' ) |
483 continue; |
483 continue; |
484 var script = document.createElement('script'); |
484 var script = document.createElement('script'); |
485 script.type="text/javascript"; |
485 script.type="text/javascript"; |
486 if ( thefiles[f] == 'json.js' && KILL_SWITCH ) |
486 if ( thefiles[f] == 'json.js' && KILL_SWITCH ) |
487 { |
487 { |
488 // alert('kill switch and problem script'); |
488 // alert('kill switch and problem script'); |
489 continue; |
489 continue; |
490 } |
490 } |
491 script.src=cdnPath+"/includes/clientside/static/"+thefiles[f]; |
491 script.src=cdnPath+"/includes/clientside/static/"+thefiles[f]; |
492 head.appendChild(script); |
492 head.appendChild(script); |
493 } |
493 } |
494 |
494 |
495 // Do not remove the following comment, it is used by jsres.php. |
495 // Do not remove the following comment, it is used by jsres.php. |
496 /*!END_INCLUDER*/ |
496 /*!END_INCLUDER*/ |
497 |
497 |
498 addOnloadHook(function() { |
498 addOnloadHook(function() { |
499 if ( $_REQUEST['auth'] ) |
499 if ( $_REQUEST['auth'] ) |
500 { |
500 { |
501 var key = $_REQUEST['auth']; |
501 var key = $_REQUEST['auth']; |
502 var loc = String(window.location); |
502 var loc = String(window.location); |
503 loc = loc.replace(/#.+$/, '').replace(/&auth=[0-9a-f]+/, '').replace(/\?auth=[0-9a-f]+(&)?/, '$1'); |
503 loc = loc.replace(/#.+$/, '').replace(/&auth=[0-9a-f]+/, '').replace(/\?auth=[0-9a-f]+(&)?/, '$1'); |
504 if ( key != 'false' ) |
504 if ( key != 'false' ) |
505 { |
505 { |
506 var sep = loc.indexOf('?') != -1 ? '&' : '?'; |
506 var sep = loc.indexOf('?') != -1 ? '&' : '?'; |
507 loc = loc + sep + 'auth=' + key; |
507 loc = loc + sep + 'auth=' + key; |
508 } |
508 } |
509 console.debug(loc); |
509 console.debug(loc); |
510 window.location = loc; |
510 window.location = loc; |
511 } |
511 } |
512 if ( $_REQUEST['do'] ) |
512 if ( $_REQUEST['do'] ) |
513 { |
513 { |
514 var act = $_REQUEST['do']; |
514 var act = $_REQUEST['do']; |
515 switch(act) |
515 switch(act) |
516 { |
516 { |
517 case 'comments': |
517 case 'comments': |
518 ajaxComments(); |
518 ajaxComments(); |
519 break; |
519 break; |
520 case 'edit': |
520 case 'edit': |
521 var revid = ( $_REQUEST['rev'] ) ? parseInt($_REQUEST['rev']) : false; |
521 var revid = ( $_REQUEST['rev'] ) ? parseInt($_REQUEST['rev']) : false; |
522 ajaxEditor(revid); |
522 ajaxEditor(revid); |
523 break; |
523 break; |
524 case 'login': |
524 case 'login': |
525 ajaxStartLogin(); |
525 ajaxStartLogin(); |
526 break; |
526 break; |
527 case 'history': |
527 case 'history': |
528 ajaxHistory(); |
528 ajaxHistory(); |
529 break; |
529 break; |
530 case 'catedit': |
530 case 'catedit': |
531 ajaxCatEdit(); |
531 ajaxCatEdit(); |
532 break; |
532 break; |
533 case 'rename': |
533 case 'rename': |
534 ajaxRename(); |
534 ajaxRename(); |
535 break; |
535 break; |
536 case 'aclmanager': |
536 case 'aclmanager': |
537 ajaxOpenACLManager(); |
537 ajaxOpenACLManager(); |
538 break; |
538 break; |
539 } |
539 } |
540 } |
540 } |
541 }); |
541 }); |
542 |
542 |
543 function Placeholder(funcname, filename) |
543 function Placeholder(funcname, filename) |
544 { |
544 { |
545 this.filename = filename; |
545 this.filename = filename; |
546 this.funcname = funcname; |
546 this.funcname = funcname; |
547 this.go = function() |
547 this.go = function() |
548 { |
548 { |
549 window[funcname] = null; |
549 window[funcname] = null; |
550 load_component(filename); |
550 load_component(filename); |
551 var arglist = []; |
551 var arglist = []; |
552 for ( var i = 0; i < arguments.length; i++ ) |
552 for ( var i = 0; i < arguments.length; i++ ) |
553 { |
553 { |
554 arglist[arglist.length] = 'arguments['+i+']'; |
554 arglist[arglist.length] = 'arguments['+i+']'; |
555 } |
555 } |
556 arglist = implode(', ', arglist); |
556 arglist = implode(', ', arglist); |
557 return eval(funcname + '(' + arglist + ');'); |
557 return eval(funcname + '(' + arglist + ');'); |
558 } |
558 } |
559 } |
559 } |
560 |
560 |
561 // list of public functions that need placeholders that fetch the component |
561 // list of public functions that need placeholders that fetch the component |
562 var placeholder_list = { |
562 var placeholder_list = { |
563 ajaxReset: 'ajax.js', |
563 ajaxReset: 'ajax.js', |
564 ajaxComments: 'comments.js', |
564 ajaxComments: 'comments.js', |
565 ajaxEditor: 'editor.js', |
565 ajaxEditor: 'editor.js', |
566 ajaxHistory: 'ajax.js', |
566 ajaxHistory: 'ajax.js', |
567 ajaxRename: 'ajax.js', |
567 ajaxRename: 'ajax.js', |
568 ajaxDelVote: 'ajax.js', |
568 ajaxDelVote: 'ajax.js', |
569 ajaxProtect: 'ajax.js', |
569 ajaxProtect: 'ajax.js', |
570 ajaxClearLogs: 'ajax.js', |
570 ajaxClearLogs: 'ajax.js', |
571 ajaxRollback: 'ajax.js', |
571 ajaxRollback: 'ajax.js', |
572 ajaxResetDelVotes: 'ajax.js', |
572 ajaxResetDelVotes: 'ajax.js', |
573 ajaxDeletePage: 'ajax.js', |
573 ajaxDeletePage: 'ajax.js', |
574 ajaxSetPassword: 'ajax.js', |
574 ajaxSetPassword: 'ajax.js', |
575 ajaxChangeStyle: 'ajax.js', |
575 ajaxChangeStyle: 'ajax.js', |
576 ajaxCatToTag: 'ajax.js', |
576 ajaxCatToTag: 'ajax.js', |
577 ajaxCatEdit: 'ajax.js', |
577 ajaxCatEdit: 'ajax.js', |
578 ajaxReverseDNS: 'ajax.js', |
578 ajaxReverseDNS: 'ajax.js', |
579 ajaxGzipCheck: 'ajax.js', |
579 ajaxGzipCheck: 'ajax.js', |
580 ajaxOpenACLManager: 'acl.js', |
580 ajaxOpenACLManager: 'acl.js', |
581 ajaxOpenDirectACLRule: 'acl.js', |
581 ajaxOpenDirectACLRule: 'acl.js', |
582 ajaxAdminPage: 'login.js', |
582 ajaxAdminPage: 'login.js', |
583 ajaxInitLogout: 'login.js', |
583 ajaxInitLogout: 'login.js', |
584 ajaxStartLogin: 'login.js', |
584 ajaxStartLogin: 'login.js', |
585 ajaxStartAdminLogin: 'login.js', |
585 ajaxStartAdminLogin: 'login.js', |
586 ajaxLoginNavTo: 'login.js', |
586 ajaxLoginNavTo: 'login.js', |
587 ajaxLogonToElev: 'login.js', |
587 ajaxLogonToElev: 'login.js', |
588 ajaxLoginInit: 'login.js', |
588 ajaxLoginInit: 'login.js', |
589 ajaxAdminPage: 'login.js', |
589 ajaxAdminPage: 'login.js', |
590 ajaxAdminUser: 'login.js', |
590 ajaxAdminUser: 'login.js', |
591 mb_logout: 'login.js', |
591 mb_logout: 'login.js', |
592 selectButtonMajor: 'toolbar.js', |
592 selectButtonMajor: 'toolbar.js', |
593 selectButtonMinor: 'toolbar.js', |
593 selectButtonMinor: 'toolbar.js', |
594 unselectAllButtonsMajor: 'toolbar.js', |
594 unselectAllButtonsMajor: 'toolbar.js', |
595 unselectAllButtonsMinor: 'toolbar.js', |
595 unselectAllButtonsMinor: 'toolbar.js', |
596 darken: 'fadefilter.js', |
596 darken: 'fadefilter.js', |
597 enlighten: 'fadefilter.js', |
597 enlighten: 'fadefilter.js', |
598 password_score: 'pwstrength.js', |
598 password_score: 'pwstrength.js', |
599 password_score_field: 'pwstrength.js', |
599 password_score_field: 'pwstrength.js', |
600 ajaxEditTheme: 'theme-manager.js', |
600 ajaxEditTheme: 'theme-manager.js', |
601 ajaxToggleSystemThemes: 'theme-manager.js', |
601 ajaxToggleSystemThemes: 'theme-manager.js', |
602 ajaxInstallTheme: 'theme-manager.js', |
602 ajaxInstallTheme: 'theme-manager.js', |
603 ajaxInitRankEdit: 'rank-manager.js', |
603 ajaxInitRankEdit: 'rank-manager.js', |
604 ajaxInitRankCreate: 'rank-manager.js', |
604 ajaxInitRankCreate: 'rank-manager.js', |
605 autofill_init_element: 'autofill.js', |
605 autofill_init_element: 'autofill.js', |
606 autofill_init: 'autofill.js', |
606 autofill_init: 'autofill.js', |
607 paginator_goto: 'paginate.js' |
607 paginator_goto: 'paginate.js' |
608 }; |
608 }; |
609 |
609 |
610 function AutofillUsername(el, p) |
610 function AutofillUsername(el, p) |
611 { |
611 { |
612 p = p || {}; |
612 p = p || {}; |
613 el.className = 'autofill username'; |
613 el.className = 'autofill username'; |
614 el.onkeyup = null; |
614 el.onkeyup = null; |
615 autofill_init_element(el, p); |
615 autofill_init_element(el, p); |
616 } |
616 } |
617 |
617 |
618 function AutofillPage(el, p) |
618 function AutofillPage(el, p) |
619 { |
619 { |
620 p = p || {}; |
620 p = p || {}; |
621 el.className = 'autofill page'; |
621 el.className = 'autofill page'; |
622 el.onkeyup = null; |
622 el.onkeyup = null; |
623 autofill_init_element(el, p); |
623 autofill_init_element(el, p); |
624 } |
624 } |
625 |
625 |
626 var placeholder_instances = {}; |
626 var placeholder_instances = {}; |
627 |
627 |
628 for ( var i in placeholder_list ) |
628 for ( var i in placeholder_list ) |
629 { |
629 { |
630 var file = placeholder_list[i]; |
630 var file = placeholder_list[i]; |
631 placeholder_instances[i] = new Placeholder(i, file); |
631 placeholder_instances[i] = new Placeholder(i, file); |
632 window[i] = window[i] || placeholder_instances[i].go; |
632 window[i] = window[i] || placeholder_instances[i].go; |
633 } |
633 } |
634 |
634 |
635 $lang = window.$lang || { |
635 $lang = window.$lang || { |
636 get: function(a, b) |
636 get: function(a, b) |
637 { |
637 { |
638 load_component('l10n'); |
638 load_component('l10n'); |
639 return $lang.get(a, b); |
639 return $lang.get(a, b); |
640 }, |
640 }, |
641 placeholder: true |
641 placeholder: true |
642 } |
642 } |
643 |
643 |
644 //*/ |
644 //*/ |