582
+ − 1
/*
+ − 2
* Enano - an open source wiki-like CMS
+ − 3
* Copyright (C) 2006-2007 Dan Fuhry
+ − 4
* Javascript client library
+ − 5
*
+ − 6
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ − 7
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ − 8
*
+ − 9
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ − 10
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ − 11
*
+ − 12
* For more information about Enano, please visit http://enanocms.org/.
+ − 13
* Unless otherwise noted, all of the code in these script files may be used freely so long as the above license block
+ − 14
* is displayed and your modified code is distributed in compliance with the GPL. See the special page "About Enano" on
+ − 15
* this website for more information.
+ − 16
*/
+ − 17
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 18
if ( typeof(title) != 'string')
582
+ − 19
{
+ − 20
alert('There was a problem loading the PHP-generated Javascript variables that control parameters for AJAX applets. Most on-page functionality will be very badly broken.\n\nTheme developers, ensure that you are using {JS_DYNAMIC_VARS} *before* you include jsres.php.');
+ − 21
}
+ − 22
588
+ − 23
// placeholder for window.console - used if firebug isn't present
+ − 24
// http://getfirebug.com/firebug/firebugx.js
+ − 25
if (!window.console || !console.firebug)
+ − 26
{
+ − 27
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
+ − 28
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
+ − 29
+ − 30
window.console = {};
+ − 31
for (var i = 0; i < names.length; ++i)
+ − 32
window.console[names[i]] = function() {}
+ − 33
}
+ − 34
+ − 35
console.info('Enano::JS runtime: starting system init');
+ − 36
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 37
if ( typeof(ENANO_JSRES_COMPRESSED) == undefined )
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 38
{
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 39
var ENANO_JSRES_COMPRESSED = false;
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 40
}
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 41
582
+ − 42
// Run-time variables
+ − 43
+ − 44
var detect = navigator.userAgent.toLowerCase();
+ − 45
var IE;
+ − 46
var is_Safari;
+ − 47
+ − 48
// Detect whether the user is running the Evil One or not...
+ − 49
+ − 50
function checkIt(string) {
+ − 51
place = detect.indexOf(string) + 1;
+ − 52
thestring = string;
+ − 53
return place;
+ − 54
}
+ − 55
if (checkIt('msie')) IE = true;
+ − 56
else IE = false;
+ − 57
+ − 58
var is_Opera = ( checkIt('opera') ) ? true : false;
+ − 59
var is_iPhone = ( checkIt('iphone') || checkIt('ipod') ) ? true : false;
+ − 60
var is_firefox2 = ( checkIt('firefox/2.') ) ? true : false;
+ − 61
+ − 62
var KILL_SWITCH = false;
+ − 63
+ − 64
if ( IE )
+ − 65
{
+ − 66
var version = window.navigator.appVersion;
+ − 67
version = version.substr( ( version.indexOf('MSIE') + 5 ) );
+ − 68
var rawversion = '';
+ − 69
for ( var i = 0; i < version.length; i++ )
+ − 70
{
+ − 71
var chr = version.substr(i, 1);
+ − 72
if ( !chr.match(/[0-9\.]/) )
+ − 73
{
+ − 74
break;
+ − 75
}
+ − 76
rawversion += chr;
+ − 77
}
+ − 78
rawversion = parseInt(rawversion);
+ − 79
if ( rawversion < 6 )
+ − 80
{
+ − 81
KILL_SWITCH = true;
+ − 82
}
+ − 83
}
+ − 84
588
+ − 85
var tinymce_initted = false;
582
+ − 86
+ − 87
if ( typeof(DISABLE_MCE) == undefined )
+ − 88
{
+ − 89
var DISABLE_MCE = false;
+ − 90
}
+ − 91
+ − 92
is_Safari = checkIt('safari') ? true : false;
+ − 93
+ − 94
var cmt_open;
+ − 95
var editor_open = false;
+ − 96
var list;
+ − 97
var edit_open = false;
+ − 98
var catlist = new Array();
+ − 99
var arrDiff1Buttons = new Array();
+ − 100
var arrDiff2Buttons = new Array();
+ − 101
var arrTimeIdList = new Array();
+ − 102
var list;
+ − 103
var unObj;
+ − 104
var unSelectMenuOn = false;
+ − 105
var unObjDivCurrentId = false;
+ − 106
var unObjCurrentSelection = false;
+ − 107
var userlist = new Array();
+ − 108
var submitAuthorized = true;
+ − 109
var timelist = [];
+ − 110
var rDnsObj;
+ − 111
var rDnsBannerObj;
+ − 112
var ns4 = document.layers;
+ − 113
var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
+ − 114
var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
+ − 115
var agt=navigator.userAgent.toLowerCase();
+ − 116
var mac = (agt.indexOf("mac")!=-1);
+ − 117
var ie = (agt.indexOf("msie") != -1);
+ − 118
var mac_ie = mac && ie;
+ − 119
var mouseX = 0;
+ − 120
var mouseY = 0;
+ − 121
var menuheight;
+ − 122
var inertiabase = 1;
+ − 123
var inertiainc = 1;
+ − 124
var slideintervalinc = 20;
+ − 125
var inertiabaseoriginal = inertiabase;
+ − 126
var heightnow;
+ − 127
var targetheight;
+ − 128
var block;
+ − 129
var slideinterval;
+ − 130
var divheights = new Array();
+ − 131
var __menutimeout = false;
+ − 132
var startmouseX = false;
+ − 133
var startmouseY = false;
+ − 134
var startScroll = false;
+ − 135
var is_dragging = false;
+ − 136
var current_ta = false;
+ − 137
var startwidth = false;
+ − 138
var startheight = false;
+ − 139
var do_width = false;
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 140
var ajax_load_icon = cdnPath + '/images/loading.gif';
582
+ − 141
var editor_use_modal_window = false;
+ − 142
+ − 143
// You have an NSIS coder in your midst...
+ − 144
var MB_OK = 1;
+ − 145
var MB_OKCANCEL = 2;
+ − 146
var MB_YESNO = 4;
+ − 147
var MB_YESNOCANCEL = 8;
+ − 148
var MB_ABORTRETRYIGNORE = 16;
+ − 149
var MB_ICONINFORMATION = 32;
+ − 150
var MB_ICONEXCLAMATION = 64;
+ − 151
var MB_ICONSTOP = 128;
+ − 152
var MB_ICONQUESTION = 256;
+ − 153
var MB_ICONLOCK = 512;
+ − 154
+ − 155
// Can be set to true by slow themes (St. Patty)
+ − 156
if ( typeof(pref_disable_js_fx) != 'boolean' )
+ − 157
{
+ − 158
var pref_disable_js_fx = false;
+ − 159
}
+ − 160
var aclDisableTransitionFX = ( is_firefox2 || pref_disable_js_fx ) ? true : false;
+ − 161
+ − 162
// Syntax:
+ − 163
// messagebox(MB_OK|MB_ICONINFORMATION, 'Title', 'Text');
+ − 164
// :-D
+ − 165
+ − 166
var $_REQUEST = new Object();
+ − 167
if ( window.location.hash )
+ − 168
{
+ − 169
var hash = String(window.location.hash);
+ − 170
hash = hash.substr(1);
+ − 171
var reqobj = hash.split(';');
+ − 172
var a, b;
+ − 173
for ( var i = 0; i < reqobj.length; i++ )
+ − 174
{
+ − 175
a = reqobj[i].substr(0, reqobj[i].indexOf(':'));
+ − 176
b = reqobj[i].substr( ( reqobj[i].indexOf(':') + 1 ) );
+ − 177
$_REQUEST[a] = b;
+ − 178
}
+ − 179
}
+ − 180
+ − 181
if ( !onload_hooks )
+ − 182
var onload_hooks = new Array();
+ − 183
+ − 184
function addOnloadHook(func)
+ − 185
{
+ − 186
if ( typeof ( func ) == 'function' )
+ − 187
{
+ − 188
if ( typeof(onload_hooks.push) == 'function' )
+ − 189
{
+ − 190
onload_hooks.push(func);
+ − 191
}
+ − 192
else
+ − 193
{
+ − 194
onload_hooks[onload_hooks.length] = func;
+ − 195
}
+ − 196
}
+ − 197
}
+ − 198
+ − 199
function runOnloadHooks(e)
+ − 200
{
+ − 201
var _errorTrapper = 0;
+ − 202
for ( var _oLc = 0; _oLc < onload_hooks.length; _oLc++ )
+ − 203
{
+ − 204
_errorTrapper++;
+ − 205
if ( _errorTrapper >= 1000 )
+ − 206
break;
+ − 207
var _f = onload_hooks[_oLc];
+ − 208
if ( typeof(_f) == 'function' )
+ − 209
{
+ − 210
_f(e);
+ − 211
}
+ − 212
}
+ − 213
}
+ − 214
+ − 215
var loaded_components = {};
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 216
var _load_component_running = false;
582
+ − 217
function load_component(file)
+ − 218
{
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 219
var multiple = false;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 220
if ( typeof(file) == 'object' )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 221
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 222
if ( ENANO_JSRES_COMPRESSED )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 223
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 224
multiple = true;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 225
for ( var i = 0; i < file.length; i++ )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 226
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 227
file[i] = (file[i].replace(/\.js$/, '')) + '.js';
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 228
if ( loaded_components[file[i]] )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 229
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 230
file[i] = false;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 231
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 232
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 233
var file2 = [];
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 234
for ( var i = 0; i < file.length; i++ )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 235
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 236
if ( file[i] )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 237
file2.push(file[i]);
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 238
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 239
file = file2;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 240
delete(file2);
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 241
if ( file.length < 1 )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 242
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 243
return true;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 244
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 245
var file_flat = implode(',', file);
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 246
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 247
else
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 248
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 249
for ( var i = 0; i < file.length; i++ )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 250
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 251
load_component(file[i]);
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 252
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 253
return true;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 254
}
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 255
}
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 256
_load_component_running = true;
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 257
if ( !multiple )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 258
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 259
file = file.replace(/\.js$/, '');
582
+ − 260
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 261
if ( loaded_components[file + '.js'] )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 262
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 263
// already loaded
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 264
return true;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 265
}
582
+ − 266
}
+ − 267
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 268
console.info('Loading component %s via AJAX', ( multiple ? file_flat : file ));
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 269
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 270
load_show_win(( multiple ? file_flat : file ));
582
+ − 271
+ − 272
// get an XHR instance
+ − 273
var ajax = ajaxMakeXHR();
+ − 274
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 275
if ( !multiple )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 276
file = file + '.js';
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 277
var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + (multiple ? file_flat : file ) : scriptPath + '/includes/clientside/static/' + file;
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 278
try
582
+ − 279
{
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 280
ajax.open('GET', uri, false);
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 281
ajax.onreadystatechange = function()
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 282
{
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 283
if ( this.readyState == 4 && this.status != 200 )
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 284
{
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 285
alert('There was a problem loading a script from the server. Please check your network connection.');
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 286
load_hide_win();
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 287
throw('load_component(): XHR for component ' + file + ' failed');
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 288
}
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 289
}
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 290
ajax.send(null);
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 291
// async request, so if status != 200 at this point then we're screwed
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 292
if ( ajax.readyState == 4 && ajax.status == 200 )
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 293
{
752
+ − 294
if ( onload_complete )
+ − 295
onload_hooks = new Array();
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 296
eval_global(ajax.responseText);
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 297
load_hide_win();
752
+ − 298
if ( onload_complete )
+ − 299
runOnloadHooks();
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 300
}
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 301
}
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 302
catch(e)
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 303
{
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 304
alert('There was a problem loading a script from the server. Please check your network connection.');
582
+ − 305
load_hide_win();
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 306
console.info("Component loader exception is shown below.");
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 307
console.debug(e);
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
diff
changeset
+ − 308
throw('load_component(): XHR for component ' + file + ' failed');
582
+ − 309
}
+ − 310
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 311
if ( !multiple )
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 312
{
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 313
loaded_components[file] = true;
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 314
}
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 315
_load_component_running = false;
582
+ − 316
return true;
+ − 317
}
+ − 318
+ − 319
function load_show_win(file)
+ − 320
{
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 321
var img = '<img style="margin-right: 5px" src="' + cdnPath + '/images/loading.gif" />';
582
+ − 322
if ( document.getElementById('_js_load_component') )
+ − 323
{
+ − 324
document.getElementById('_js_load_component').innerHTML = img + msg_loading_component.replace('%component%', file);
+ − 325
return;
+ − 326
}
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
diff
changeset
+ − 327
file = file.replace(/\.js$/, '').replace(/\.js,/g, ', ');
582
+ − 328
var ld = document.createElement('div');
+ − 329
ld.style.padding = '10px';
+ − 330
ld.style.height = '12px';
+ − 331
ld.style.position = 'fixed';
+ − 332
ld.style.right = '5px';
+ − 333
ld.style.bottom = '0px';
+ − 334
ld.innerHTML = img + msg_loading_component.replace('%component%', file);
+ − 335
ld.id = '_js_load_component';
+ − 336
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 337
// FYI: The base64 encoded image is a 70% opacity 1x1px white PNG.
582
+ − 338
ld.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAA1JREFUCNdj+P///xkACcgDypG+nnEAAAAASUVORK5CYII=)';
+ − 339
+ − 340
document.body.appendChild(ld);
738
+ − 341
document.body.style.cursor = 'wait';
582
+ − 342
}
+ − 343
+ − 344
function load_hide_win()
+ − 345
{
+ − 346
var ld = document.getElementById('_js_load_component');
588
+ − 347
if ( !ld )
+ − 348
return false;
582
+ − 349
ld.parentNode.removeChild(ld);
738
+ − 350
document.body.style.cursor = 'default';
582
+ − 351
}
+ − 352
+ − 353
// evaluate a snippet of code in the global context, used for dynamic component loading
+ − 354
// from: http://dean.edwards.name/weblog/2006/11/sandbox/
+ − 355
function eval_global(_jsString)
+ − 356
{
+ − 357
if (typeof _jsString != "string")
+ − 358
{
+ − 359
return false;
+ − 360
}
+ − 361
+ − 362
// Check whether window.eval executes code in the global scope.
+ − 363
window.eval("var __INCLUDE_TEST_1__ = true;");
+ − 364
if (typeof window.__INCLUDE_TEST_1__ != "undefined")
+ − 365
{
+ − 366
delete window.__INCLUDE_TEST_1__;
+ − 367
window.eval(_jsString);
+ − 368
}
+ − 369
else if (typeof window.execScript != "undefined") // IE only
+ − 370
{
+ − 371
window.execScript(_jsString);
+ − 372
}
+ − 373
else
+ − 374
{
+ − 375
// Test effectiveness of creating a new SCRIPT element and adding it to the document.
+ − 376
this._insertScriptTag = function (_jsCode) {
+ − 377
var _script = document.createElement("script");
+ − 378
_script.type = "text/javascript";
+ − 379
_script.defer = false;
+ − 380
_script.text = _jsCode;
+ − 381
var _headNodeSet = document.getElementsByTagName("head");
+ − 382
if (_headNodeSet.length)
+ − 383
{
+ − 384
_script = _headNodeSet.item(0).appendChild(_script);
+ − 385
}
+ − 386
else
+ − 387
{
+ − 388
var _head = document.createElement("head");
+ − 389
_head = document.documentElement.appendChild(_head);
+ − 390
_script = _head.appendChild(_script);
+ − 391
}
+ − 392
return _script;
+ − 393
}
+ − 394
var _testScript = this._insertScriptTag("var __INCLUDE_TEST_2__ = true;");
+ − 395
if (typeof window.__INCLUDE_TEST_2__ == "boolean")
+ − 396
{
+ − 397
_testScript.parentNode.removeChild(_testScript);
+ − 398
this._insertScriptTag(_jsString);
+ − 399
}
+ − 400
else
+ − 401
{
+ − 402
// Check whether window.setTimeout works in real time.
+ − 403
window.setTimeout("var __INCLUDE_TEST_3__ = true;", 0);
+ − 404
if (typeof window.__INCLUDE_TEST_3__ != "undefined")
+ − 405
{
+ − 406
delete window.__INCLUDE_TEST_3__;
+ − 407
window.setTimeout(_jsString, 0);
+ − 408
}
+ − 409
}
+ − 410
}
+ − 411
+ − 412
return true;
+ − 413
}
+ − 414
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 415
var autofill_check = function()
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 416
{
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 417
var inputs = document.getElementsByTagName('input');
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 418
for ( var i = 0; i < inputs.length; i++ )
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 419
{
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 420
if ( inputs[i].className )
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 421
{
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 422
if ( inputs[i].className.match(/^autofill/) )
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 423
{
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 424
load_component('autofill');
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 425
return;
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 426
}
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 427
}
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 428
}
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 429
}
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 430
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 431
addOnloadHook(autofill_check);
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 432
582
+ − 433
var head = document.getElementsByTagName('head')[0];
+ − 434
+ − 435
// safari has window.console but not the .debug() method
+ − 436
if ( is_Safari && !window.console.debug )
+ − 437
{
+ − 438
window.console.debug = function() {};
+ − 439
}
+ − 440
+ − 441
// Do not remove the following comments, they are used by jsres.php.
+ − 442
/*!START_INCLUDER*/
+ − 443
+ − 444
// Start loading files
+ − 445
// The string from the [ to the ] needs to be valid JSON, it's parsed by jsres.php.
+ − 446
var thefiles = [
+ − 447
'dynano.js',
+ − 448
'functions.js',
+ − 449
'dropdown.js',
+ − 450
'json.js',
+ − 451
'sliders.js',
588
+ − 452
'tinymce-init.js',
582
+ − 453
'loader.js'
+ − 454
];
+ − 455
+ − 456
for(var f in thefiles)
+ − 457
{
+ − 458
if ( typeof(thefiles[f]) != 'string' )
+ − 459
continue;
+ − 460
var script = document.createElement('script');
+ − 461
script.type="text/javascript";
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 462
if ( thefiles[f] == 'json.js' && KILL_SWITCH )
582
+ − 463
{
+ − 464
// alert('kill switch and problem script');
+ − 465
continue;
+ − 466
}
650
e45183014778
Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
diff
changeset
+ − 467
script.src=cdnPath+"/includes/clientside/static/"+thefiles[f];
582
+ − 468
head.appendChild(script);
+ − 469
}
+ − 470
+ − 471
// Do not remove the following comment, it is used by jsres.php.
+ − 472
/*!END_INCLUDER*/
+ − 473
+ − 474
addOnloadHook(function() {
+ − 475
if ( $_REQUEST['do'] )
+ − 476
{
+ − 477
var act = $_REQUEST['do'];
+ − 478
switch(act)
+ − 479
{
+ − 480
case 'comments':
+ − 481
ajaxComments();
+ − 482
break;
+ − 483
case 'edit':
+ − 484
ajaxEditor();
+ − 485
break;
+ − 486
case 'login':
+ − 487
ajaxStartLogin();
+ − 488
break;
+ − 489
case 'history':
+ − 490
ajaxHistory();
+ − 491
break;
+ − 492
case 'catedit':
+ − 493
ajaxCatEdit();
+ − 494
break;
+ − 495
case 'rename':
+ − 496
ajaxRename();
+ − 497
break;
729
+ − 498
case 'aclmanager':
+ − 499
ajaxOpenACLManager();
+ − 500
break;
582
+ − 501
}
+ − 502
}
+ − 503
});
+ − 504
+ − 505
function Placeholder(funcname, filename)
+ − 506
{
+ − 507
this.filename = filename;
+ − 508
this.funcname = funcname;
+ − 509
this.go = function()
+ − 510
{
+ − 511
window[funcname] = null;
+ − 512
load_component(filename);
+ − 513
var arglist = [];
+ − 514
for ( var i = 0; i < arguments.length; i++ )
+ − 515
{
+ − 516
arglist[arglist.length] = 'arguments['+i+']';
+ − 517
}
+ − 518
arglist = implode(', ', arglist);
585
+ − 519
return eval(funcname + '(' + arglist + ');');
582
+ − 520
}
+ − 521
}
+ − 522
+ − 523
// list of public functions that need placeholders that fetch the component
+ − 524
var placeholder_list = {
+ − 525
ajaxReset: 'ajax.js',
+ − 526
ajaxComments: 'comments.js',
+ − 527
ajaxEditor: 'editor.js',
+ − 528
ajaxHistory: 'ajax.js',
+ − 529
ajaxRename: 'ajax.js',
+ − 530
ajaxDelVote: 'ajax.js',
+ − 531
ajaxProtect: 'ajax.js',
+ − 532
ajaxClearLogs: 'ajax.js',
+ − 533
ajaxResetDelVotes: 'ajax.js',
+ − 534
ajaxDeletePage: 'ajax.js',
+ − 535
ajaxSetPassword: 'ajax.js',
+ − 536
ajaxChangeStyle: 'ajax.js',
664
+ − 537
ajaxCatToTag: 'ajax.js',
701
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 538
ajaxCatEdit: 'ajax.js',
785
+ − 539
ajaxReverseDNS: 'ajax.js',
582
+ − 540
ajaxOpenACLManager: 'acl.js',
694
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
diff
changeset
+ − 541
ajaxOpenDirectACLRule: 'acl.js',
582
+ − 542
ajaxAdminPage: 'login.js',
+ − 543
ajaxInitLogout: 'login.js',
+ − 544
ajaxStartLogin: 'login.js',
+ − 545
ajaxStartAdminLogin: 'login.js',
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 546
ajaxLoginNavTo: 'login.js',
591
2529833a7731
Made $session->private_key protected and added pk_{en,de}crypt methods for encrypting and decrypting data using the private key
Dan
diff
changeset
+ − 547
ajaxLogonToElev: 'login.js',
582
+ − 548
ajaxAdminPage: 'login.js',
664
+ − 549
ajaxAdminUser: 'login.js',
582
+ − 550
mb_logout: 'login.js',
+ − 551
selectButtonMajor: 'toolbar.js',
+ − 552
selectButtonMinor: 'toolbar.js',
+ − 553
unselectAllButtonsMajor: 'toolbar.js',
+ − 554
unselectAllButtonsMinor: 'toolbar.js',
+ − 555
darken: 'fadefilter.js',
+ − 556
enlighten: 'fadefilter.js',
585
+ − 557
autofill_onload: 'autofill.js',
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
diff
changeset
+ − 558
password_score: 'pwstrength.js',
590
03a60844c7c5
Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
diff
changeset
+ − 559
password_score_field: 'pwstrength.js',
03a60844c7c5
Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
diff
changeset
+ − 560
ajaxEditTheme: 'theme-manager.js',
03a60844c7c5
Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
diff
changeset
+ − 561
ajaxToggleSystemThemes: 'theme-manager.js',
03a60844c7c5
Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
diff
changeset
+ − 562
ajaxInstallTheme: 'theme-manager.js',
628
+ − 563
ajaxInitRankEdit: 'rank-manager.js',
701
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 564
ajaxInitRankCreate: 'rank-manager.js',
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 565
autofill_init_element: 'autofill.js',
789
4a8fc835ba02
Added paginator_goto() to function reverse map; fixed some missing component loads in pagination code
Dan
diff
changeset
+ − 566
autofill_onload: 'autofill.js',
4a8fc835ba02
Added paginator_goto() to function reverse map; fixed some missing component loads in pagination code
Dan
diff
changeset
+ − 567
paginator_goto: 'paginate.js'
589
+ − 568
};
582
+ − 569
701
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 570
function AutofillUsername(el, p)
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 571
{
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 572
p = p || {};
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 573
el.className = 'autofill username';
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 574
el.onkeyup = null;
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 575
autofill_init_element(el, p);
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 576
}
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 577
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 578
function AutofillPage(el, p)
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 579
{
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 580
p = p || {};
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 581
el.className = 'autofill page';
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 582
el.onkeyup = null;
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 583
autofill_init_element(el, p);
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 584
}
dd80cde96a6c
Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
diff
changeset
+ − 585
582
+ − 586
var placeholder_instances = {};
+ − 587
+ − 588
for ( var i in placeholder_list )
+ − 589
{
+ − 590
var file = placeholder_list[i];
+ − 591
placeholder_instances[i] = new Placeholder(i, file);
+ − 592
window[i] = placeholder_instances[i].go;
+ − 593
}
+ − 594
583
+ − 595
$lang = {
+ − 596
get: function(a, b)
+ − 597
{
+ − 598
load_component('l10n');
+ − 599
return $lang.get(a, b);
+ − 600
}
+ − 601
}
+ − 602
582
+ − 603
//*/