includes/clientside/static/enano-lib-basic.js
changeset 650 e45183014778
parent 628 ab6f55abb17e
child 664 b164e05c5faa
equal deleted inserted replaced
649:74e03196fd43 650:e45183014778
   135 var is_dragging = false;
   135 var is_dragging = false;
   136 var current_ta  = false;
   136 var current_ta  = false;
   137 var startwidth  = false;
   137 var startwidth  = false;
   138 var startheight = false;
   138 var startheight = false;
   139 var do_width    = false;
   139 var do_width    = false;
   140 var ajax_load_icon = scriptPath + '/images/loading.gif';
   140 var ajax_load_icon = cdnPath + '/images/loading.gif';
   141 var editor_use_modal_window = false;
   141 var editor_use_modal_window = false;
   142 var Spry = {};
   142 var Spry = {};
   143 
   143 
   144 // You have an NSIS coder in your midst...
   144 // You have an NSIS coder in your midst...
   145 var MB_OK = 1;
   145 var MB_OK = 1;
   218 function load_component(file)
   218 function load_component(file)
   219 {
   219 {
   220   _load_component_running = true;
   220   _load_component_running = true;
   221   file = file.replace(/\.js$/, '');
   221   file = file.replace(/\.js$/, '');
   222   
   222   
   223   console.info('Loading component %s via AJAX', file);
   223   if ( loaded_components[file + '.js'] )
   224   
       
   225   if ( loaded_components[file] )
       
   226   {
   224   {
   227     // already loaded
   225     // already loaded
   228     return true;
   226     return true;
   229   }
   227   }
       
   228   
       
   229   console.info('Loading component %s via AJAX', file);
   230   
   230   
   231   load_show_win(file);
   231   load_show_win(file);
   232   
   232   
   233   // get an XHR instance
   233   // get an XHR instance
   234   var ajax = ajaxMakeXHR();
   234   var ajax = ajaxMakeXHR();
   250   return true;
   250   return true;
   251 }
   251 }
   252 
   252 
   253 function load_show_win(file)
   253 function load_show_win(file)
   254 {
   254 {
   255   var img = '<img style="margin-right: 5px" src="' + scriptPath + '/images/loading.gif" />';
   255   var img = '<img style="margin-right: 5px" src="' + cdnPath + '/images/loading.gif" />';
   256   if ( document.getElementById('_js_load_component') )
   256   if ( document.getElementById('_js_load_component') )
   257   {
   257   {
   258     document.getElementById('_js_load_component').innerHTML = img + msg_loading_component.replace('%component%', file);
   258     document.getElementById('_js_load_component').innerHTML = img + msg_loading_component.replace('%component%', file);
   259     return;
   259     return;
   260   }
   260   }
   266   ld.style.right = '5px';
   266   ld.style.right = '5px';
   267   ld.style.bottom = '0px';
   267   ld.style.bottom = '0px';
   268   ld.innerHTML = img + msg_loading_component.replace('%component%', file);
   268   ld.innerHTML = img + msg_loading_component.replace('%component%', file);
   269   ld.id = '_js_load_component';
   269   ld.id = '_js_load_component';
   270   
   270   
       
   271   // FYI: The base64 encoded image is a 70% opacity 1x1px white PNG.
   271   ld.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAA1JREFUCNdj+P///xkACcgDypG+nnEAAAAASUVORK5CYII=)';
   272   ld.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAA1JREFUCNdj+P///xkACcgDypG+nnEAAAAASUVORK5CYII=)';
   272   
   273   
   273   document.body.appendChild(ld);
   274   document.body.appendChild(ld);
   274 }
   275 }
   275 
   276 
   341   }
   342   }
   342 
   343 
   343   return true;
   344   return true;
   344 }
   345 }
   345 
   346 
       
   347 var autofill_check = function()
       
   348 {
       
   349   var inputs = document.getElementsByTagName('input');
       
   350   for ( var i = 0; i < inputs.length; i++ )
       
   351   {
       
   352     if ( inputs[i].className )
       
   353     {
       
   354       if ( inputs[i].className.match(/^autofill/) )
       
   355       {
       
   356         load_component('autofill');
       
   357         return;
       
   358       }
       
   359     }
       
   360     /*
       
   361     else if ( typeof(inputs[i].onkeyup) == 'function' )
       
   362     {
       
   363       var f = new String(inputs[i].onkeyup);
       
   364       if ( f.match(/AutofillUsername/) )
       
   365       {
       
   366         delete(f.onkeyup);
       
   367         f.className = 'autofill username';
       
   368         autofill_check();
       
   369         return;
       
   370       }
       
   371     }
       
   372     */
       
   373   }
       
   374 }
       
   375 
       
   376 addOnloadHook(autofill_check);
       
   377 
   346 var head = document.getElementsByTagName('head')[0];
   378 var head = document.getElementsByTagName('head')[0];
   347 
   379 
   348 // safari has window.console but not the .debug() method
   380 // safari has window.console but not the .debug() method
   349 if ( is_Safari && !window.console.debug )
   381 if ( is_Safari && !window.console.debug )
   350 {
   382 {
   375   if ( thefiles[f] == 'json.js' && KILL_SWITCH )
   407   if ( thefiles[f] == 'json.js' && KILL_SWITCH )
   376   {
   408   {
   377     // alert('kill switch and problem script');
   409     // alert('kill switch and problem script');
   378     continue;
   410     continue;
   379   }
   411   }
   380   script.src=scriptPath+"/includes/clientside/static/"+thefiles[f];
   412   script.src=cdnPath+"/includes/clientside/static/"+thefiles[f];
   381   head.appendChild(script);
   413   head.appendChild(script);
   382 }
   414 }
   383 
   415 
   384 // Do not remove the following comment, it is used by jsres.php.
   416 // Do not remove the following comment, it is used by jsres.php.
   385 /*!END_INCLUDER*/
   417 /*!END_INCLUDER*/