includes/clientside/static/enano-lib-basic.js
changeset 585 35e91d16ecf5
parent 583 c97d5f0d6636
child 586 234ddd896555
equal deleted inserted replaced
584:04a6ea3da279 585:35e91d16ecf5
   196 }
   196 }
   197 
   197 
   198 var loaded_components = {};
   198 var loaded_components = {};
   199 function load_component(file)
   199 function load_component(file)
   200 {
   200 {
   201   if ( !file.match(/\.js$/) )
   201   file = file.replace(/\.js$/, '');
   202     file = file + '.js';
   202   
   203   
   203   console.info('Loading component %s via AJAX', file);
   204   console.info('Loading component %s via AJAX', file.replace(/\.js$/, ''));
       
   205   
   204   
   206   if ( loaded_components[file] )
   205   if ( loaded_components[file] )
   207   {
   206   {
   208     // already loaded
   207     // already loaded
   209     return true;
   208     return true;
   212   load_show_win(file);
   211   load_show_win(file);
   213   
   212   
   214   // get an XHR instance
   213   // get an XHR instance
   215   var ajax = ajaxMakeXHR();
   214   var ajax = ajaxMakeXHR();
   216   
   215   
       
   216   file = file + '.js';
   217   var uri = scriptPath + '/includes/clientside/static/' + file;
   217   var uri = scriptPath + '/includes/clientside/static/' + file;
   218   ajax.open('GET', uri, false);
   218   ajax.open('GET', uri, false);
   219   ajax.send(null);
   219   ajax.send(null);
   220   if ( ajax.readyState == 4 && ajax.status == 200 )
   220   if ( ajax.readyState == 4 && ajax.status == 200 )
   221   {
   221   {
   418     for ( var i = 0; i < arguments.length; i++ )
   418     for ( var i = 0; i < arguments.length; i++ )
   419     {
   419     {
   420       arglist[arglist.length] = 'arguments['+i+']';
   420       arglist[arglist.length] = 'arguments['+i+']';
   421     }
   421     }
   422     arglist = implode(', ', arglist);
   422     arglist = implode(', ', arglist);
   423     eval(funcname + '(' + arglist + ');');
   423     return eval(funcname + '(' + arglist + ');');
   424   }
   424   }
   425 }
   425 }
   426 
   426 
   427 // list of public functions that need placeholders that fetch the component
   427 // list of public functions that need placeholders that fetch the component
   428 var placeholder_list = {
   428 var placeholder_list = {
   449   selectButtonMinor: 'toolbar.js',
   449   selectButtonMinor: 'toolbar.js',
   450   unselectAllButtonsMajor: 'toolbar.js',
   450   unselectAllButtonsMajor: 'toolbar.js',
   451   unselectAllButtonsMinor: 'toolbar.js',
   451   unselectAllButtonsMinor: 'toolbar.js',
   452   darken: 'fadefilter.js',
   452   darken: 'fadefilter.js',
   453   enlighten: 'fadefilter.js',
   453   enlighten: 'fadefilter.js',
       
   454   autofill_onload: 'autofill.js',
   454 }
   455 }
   455 
   456 
   456 var placeholder_instances = {};
   457 var placeholder_instances = {};
   457 
   458 
   458 for ( var i in placeholder_list )
   459 for ( var i in placeholder_list )