includes/clientside/static/enano-lib-basic.js
author Dan
Thu, 26 Jun 2008 18:05:42 -0400
changeset 587 705ed7162315
parent 586 234ddd896555
child 588 20484deb89cd
permissions -rw-r--r--
Oops, scriptPath isn't defined in jsres.php.
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
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
    23
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
    24
{
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
    25
  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
    26
}
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
    27
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    28
// Run-time variables
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    29
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    30
var detect = navigator.userAgent.toLowerCase();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    31
var IE;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    32
var is_Safari;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    33
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    34
// 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
    35
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    36
function checkIt(string) {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    37
  place = detect.indexOf(string) + 1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    38
  thestring = string;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    39
  return place;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    40
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    41
if (checkIt('msie')) IE = true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    42
else IE = false;
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 is_Opera = ( checkIt('opera') ) ? true : false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    45
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
    46
var is_firefox2 = ( checkIt('firefox/2.') ) ? true : false;
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
var KILL_SWITCH = false;
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
if ( IE )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    51
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    52
  var version = window.navigator.appVersion;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    53
  version = version.substr( ( version.indexOf('MSIE') + 5 ) );
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    54
  var rawversion = '';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    55
  for ( var i = 0; i < version.length; i++ )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    56
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    57
    var chr = version.substr(i, 1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    58
    if ( !chr.match(/[0-9\.]/) )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    59
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    60
      break;
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
    rawversion += chr;
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
  rawversion = parseInt(rawversion);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    65
  if ( rawversion < 6 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    66
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    67
    KILL_SWITCH = true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    68
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    69
}
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
// dummy tinyMCE object
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    72
var tinyMCE = new Object();
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
if ( typeof(DISABLE_MCE) == undefined )
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
  var DISABLE_MCE = false;
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
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    79
is_Safari = checkIt('safari') ? true : false;
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
var cmt_open;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    82
var editor_open = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    83
var list;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    84
var edit_open = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    85
var catlist = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    86
var arrDiff1Buttons = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    87
var arrDiff2Buttons = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    88
var arrTimeIdList   = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    89
var list;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    90
var unObj;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    91
var unSelectMenuOn = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    92
var unObjDivCurrentId = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    93
var unObjCurrentSelection = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    94
var userlist = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    95
var submitAuthorized = true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    96
var timelist = [];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    97
var rDnsObj;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    98
var rDnsBannerObj;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    99
var ns4 = document.layers;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   100
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
   101
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
   102
var agt=navigator.userAgent.toLowerCase();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   103
var mac = (agt.indexOf("mac")!=-1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   104
var ie = (agt.indexOf("msie") != -1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   105
var mac_ie = mac && ie;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   106
var mouseX = 0;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   107
var mouseY = 0;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   108
var menuheight;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   109
var inertiabase = 1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   110
var inertiainc = 1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   111
var slideintervalinc = 20;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   112
var inertiabaseoriginal = inertiabase;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   113
var heightnow;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   114
var targetheight;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   115
var block;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   116
var slideinterval;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   117
var divheights = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   118
var __menutimeout = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   119
var startmouseX = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   120
var startmouseY = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   121
var startScroll = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   122
var is_dragging = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   123
var current_ta  = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   124
var startwidth  = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   125
var startheight = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   126
var do_width    = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   127
var ajax_load_icon = scriptPath + '/images/loading.gif';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   128
var editor_use_modal_window = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   129
var Spry = {};
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   130
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   131
// You have an NSIS coder in your midst...
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   132
var MB_OK = 1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   133
var MB_OKCANCEL = 2;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   134
var MB_YESNO = 4;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   135
var MB_YESNOCANCEL = 8;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   136
var MB_ABORTRETRYIGNORE = 16;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   137
var MB_ICONINFORMATION = 32;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   138
var MB_ICONEXCLAMATION = 64;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   139
var MB_ICONSTOP = 128;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   140
var MB_ICONQUESTION = 256;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   141
var MB_ICONLOCK = 512;
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
// 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
   144
if ( typeof(pref_disable_js_fx) != 'boolean' )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   145
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   146
  var pref_disable_js_fx = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   147
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   148
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
   149
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   150
// Syntax:
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   151
// messagebox(MB_OK|MB_ICONINFORMATION, 'Title', 'Text');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   152
// :-D
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   153
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   154
var $_REQUEST = new Object();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   155
if ( window.location.hash )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   156
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   157
  var hash = String(window.location.hash);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   158
  hash = hash.substr(1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   159
  var reqobj = hash.split(';');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   160
  var a, b;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   161
  for ( var i = 0; i < reqobj.length; i++ )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   162
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   163
    a = reqobj[i].substr(0, reqobj[i].indexOf(':'));
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   164
    b = reqobj[i].substr( ( reqobj[i].indexOf(':') + 1 ) );
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   165
    $_REQUEST[a] = b;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   166
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   167
}
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
if ( !onload_hooks )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   170
  var onload_hooks = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   171
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   172
function addOnloadHook(func)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   173
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   174
  if ( typeof ( func ) == 'function' )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   175
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   176
    if ( typeof(onload_hooks.push) == 'function' )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   177
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   178
      onload_hooks.push(func);
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
    else
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   181
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   182
      onload_hooks[onload_hooks.length] = func;
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
  }
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
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   187
function runOnloadHooks(e)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   188
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   189
  var _errorTrapper = 0;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   190
  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
   191
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   192
    _errorTrapper++;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   193
    if ( _errorTrapper >= 1000 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   194
      break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   195
    var _f = onload_hooks[_oLc];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   196
    if ( typeof(_f) == 'function' )
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
      _f(e);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   199
    }
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
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   202
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   203
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
   204
var _load_component_running = false;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   205
function load_component(file)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   206
{
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
   207
  _load_component_running = true;
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 583
diff changeset
   208
  file = file.replace(/\.js$/, '');
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   209
  
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 583
diff changeset
   210
  console.info('Loading component %s via AJAX', file);
582
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
  if ( loaded_components[file] )
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
    // already loaded
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   215
    return true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   216
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   217
  
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   218
  load_show_win(file);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   219
  
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   220
  // get an XHR instance
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   221
  var ajax = ajaxMakeXHR();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   222
  
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 583
diff changeset
   223
  file = file + '.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
   224
  var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + file : scriptPath + '/includes/clientside/static/' + file;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   225
  ajax.open('GET', uri, false);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   226
  ajax.send(null);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   227
  if ( ajax.readyState == 4 && ajax.status == 200 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   228
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   229
    onload_hooks = new Array();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   230
    eval_global(ajax.responseText);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   231
    load_hide_win();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   232
    runOnloadHooks();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   233
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   234
  
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   235
  loaded_components[file] = true;
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
   236
  _load_component_running = false;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   237
  return true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   238
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   239
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   240
function load_show_win(file)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   241
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   242
  var img = '<img style="margin-right: 5px" src="' + scriptPath + '/images/loading.gif" />';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   243
  if ( document.getElementById('_js_load_component') )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   244
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   245
    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
   246
    return;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   247
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   248
  file = file.replace(/\.js$/, '');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   249
  var ld = document.createElement('div');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   250
  ld.style.padding = '10px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   251
  ld.style.height = '12px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   252
  ld.style.position = 'fixed';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   253
  ld.style.right = '5px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   254
  ld.style.bottom = '0px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   255
  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
   256
  ld.id = '_js_load_component';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   257
  
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   258
  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
   259
  
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   260
  document.body.appendChild(ld);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   261
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   262
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   263
function load_hide_win()
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   264
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   265
  var ld = document.getElementById('_js_load_component');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   266
  ld.parentNode.removeChild(ld);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   267
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   268
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   269
// 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
   270
// 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
   271
function eval_global(_jsString)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   272
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   273
  if (typeof _jsString != "string")
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   274
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   275
    return false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   276
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   277
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   278
  // 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
   279
  window.eval("var __INCLUDE_TEST_1__ = true;");
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   280
  if (typeof window.__INCLUDE_TEST_1__ != "undefined")
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   281
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   282
    delete window.__INCLUDE_TEST_1__;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   283
    window.eval(_jsString);
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
  else if (typeof window.execScript != "undefined")	// IE only
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   286
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   287
    window.execScript(_jsString);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   288
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   289
  else
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   290
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   291
    // 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
   292
    this._insertScriptTag = function (_jsCode) {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   293
      var _script = document.createElement("script");
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   294
      _script.type = "text/javascript";
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   295
      _script.defer = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   296
      _script.text = _jsCode;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   297
      var _headNodeSet = document.getElementsByTagName("head");
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   298
      if (_headNodeSet.length)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   299
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   300
        _script = _headNodeSet.item(0).appendChild(_script);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   301
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   302
      else
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   303
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   304
        var _head = document.createElement("head");
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   305
        _head = document.documentElement.appendChild(_head);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   306
        _script = _head.appendChild(_script);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   307
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   308
      return _script;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   309
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   310
    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
   311
    if (typeof window.__INCLUDE_TEST_2__ == "boolean")
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   312
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   313
      _testScript.parentNode.removeChild(_testScript);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   314
      this._insertScriptTag(_jsString);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   315
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   316
    else
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   317
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   318
      // Check whether window.setTimeout works in real time.
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   319
      window.setTimeout("var __INCLUDE_TEST_3__ = true;", 0);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   320
      if (typeof window.__INCLUDE_TEST_3__ != "undefined")
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   321
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   322
        delete window.__INCLUDE_TEST_3__;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   323
        window.setTimeout(_jsString, 0);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   324
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   325
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   326
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   327
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   328
  return true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   329
}
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
var head = document.getElementsByTagName('head')[0];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   332
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   333
// placeholder for window.console - used if firebug isn't present
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   334
// http://getfirebug.com/firebug/firebugx.js
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   335
if (!window.console || !console.firebug)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   336
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   337
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   338
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
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
    window.console = {};
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   341
    for (var i = 0; i < names.length; ++i)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   342
        window.console[names[i]] = function() {}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   343
}
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
// 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
   346
if ( is_Safari && !window.console.debug )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   347
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   348
  window.console.debug = function() {};
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   349
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   350
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   351
// 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
   352
/*!START_INCLUDER*/
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   353
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   354
// Start loading files
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   355
// 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
   356
var thefiles = [
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   357
  'dynano.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   358
  'functions.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   359
  'dropdown.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   360
  'json.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   361
  'sliders.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   362
  'loader.js'
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
for(var f in thefiles)
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
  if ( typeof(thefiles[f]) != 'string' )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   368
    continue;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   369
  var script = document.createElement('script');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   370
  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
   371
  if ( thefiles[f] == 'json.js' && KILL_SWITCH )
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
    // alert('kill switch and problem script');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   374
    continue;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   375
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   376
  script.src=scriptPath+"/includes/clientside/static/"+thefiles[f];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   377
  head.appendChild(script);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   378
}
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
// 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
   381
/*!END_INCLUDER*/
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
addOnloadHook(function() {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   384
  if ( $_REQUEST['do'] )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   385
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   386
    var act = $_REQUEST['do'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   387
    switch(act)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   388
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   389
      case 'comments':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   390
        ajaxComments();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   391
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   392
      case 'edit':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   393
        ajaxEditor();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   394
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   395
      case 'login':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   396
        ajaxStartLogin();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   397
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   398
      case 'history':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   399
        ajaxHistory();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   400
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   401
      case 'catedit':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   402
        ajaxCatEdit();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   403
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   404
      case 'rename':
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   405
        ajaxRename();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   406
        break;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   407
    }
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
});
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   410
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   411
function Placeholder(funcname, filename)
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
  this.filename = filename;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   414
  this.funcname = funcname;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   415
  this.go = function()
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   416
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   417
    window[funcname] = null;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   418
    load_component(filename);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   419
    var arglist = [];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   420
    for ( var i = 0; i < arguments.length; i++ )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   421
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   422
      arglist[arglist.length] = 'arguments['+i+']';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   423
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   424
    arglist = implode(', ', arglist);
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 583
diff changeset
   425
    return eval(funcname + '(' + arglist + ');');
582
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
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   428
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   429
// 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
   430
var placeholder_list = {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   431
  ajaxReset: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   432
  ajaxComments: 'comments.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   433
  ajaxEditor: 'editor.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   434
  ajaxHistory: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   435
  ajaxRename: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   436
  ajaxDelVote: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   437
  ajaxProtect: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   438
  ajaxClearLogs: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   439
  ajaxResetDelVotes: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   440
  ajaxDeletePage: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   441
  ajaxSetPassword: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   442
  ajaxChangeStyle: 'ajax.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   443
  ajaxOpenACLManager: 'acl.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   444
  ajaxAdminPage: 'login.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   445
  ajaxInitLogout: 'login.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   446
  ajaxStartLogin: 'login.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   447
  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
   448
  ajaxLoginNavTo: 'login.js',
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   449
  ajaxAdminPage: 'login.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   450
  mb_logout: 'login.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   451
  selectButtonMajor: 'toolbar.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   452
  selectButtonMinor: 'toolbar.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   453
  unselectAllButtonsMajor: 'toolbar.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   454
  unselectAllButtonsMinor: 'toolbar.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   455
  darken: 'fadefilter.js',
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   456
  enlighten: 'fadefilter.js',
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 583
diff changeset
   457
  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
   458
  password_score: 'pwstrength.js',
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 585
diff changeset
   459
  password_score_field: 'pwstrength.js',
582
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
var placeholder_instances = {};
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   463
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   464
for ( var i in placeholder_list )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   465
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   466
  var file = placeholder_list[i];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   467
  placeholder_instances[i] = new Placeholder(i, file);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   468
  window[i] = placeholder_instances[i].go;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   469
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   470
583
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   471
$lang = {
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   472
  get: function(a, b)
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   473
  {
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   474
    load_component('l10n');
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   475
    return $lang.get(a, b);
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   476
  }
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   477
}
c97d5f0d6636 Installer should work with JS componentization now
Dan
parents: 582
diff changeset
   478
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   479
//*/