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