233 // get an XHR instance |
233 // get an XHR instance |
234 var ajax = ajaxMakeXHR(); |
234 var ajax = ajaxMakeXHR(); |
235 |
235 |
236 file = file + '.js'; |
236 file = file + '.js'; |
237 var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + file : scriptPath + '/includes/clientside/static/' + file; |
237 var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + file : scriptPath + '/includes/clientside/static/' + file; |
238 ajax.open('GET', uri, false); |
238 try |
239 ajax.send(null); |
239 { |
240 if ( ajax.readyState == 4 && ajax.status == 200 ) |
240 ajax.open('GET', uri, false); |
241 { |
241 ajax.onreadystatechange = function() |
242 onload_hooks = new Array(); |
242 { |
243 eval_global(ajax.responseText); |
243 if ( this.readyState == 4 && this.status != 200 ) |
|
244 { |
|
245 alert('There was a problem loading a script from the server. Please check your network connection.'); |
|
246 load_hide_win(); |
|
247 throw('load_component(): XHR for component ' + file + ' failed'); |
|
248 } |
|
249 } |
|
250 ajax.send(null); |
|
251 // async request, so if status != 200 at this point then we're screwed |
|
252 if ( ajax.readyState == 4 && ajax.status == 200 ) |
|
253 { |
|
254 onload_hooks = new Array(); |
|
255 eval_global(ajax.responseText); |
|
256 load_hide_win(); |
|
257 runOnloadHooks(); |
|
258 } |
|
259 } |
|
260 catch(e) |
|
261 { |
|
262 alert('There was a problem loading a script from the server. Please check your network connection.'); |
244 load_hide_win(); |
263 load_hide_win(); |
245 runOnloadHooks(); |
264 console.info("Component loader exception is shown below."); |
|
265 console.debug(e); |
|
266 throw('load_component(): XHR for component ' + file + ' failed'); |
246 } |
267 } |
247 |
268 |
248 loaded_components[file] = true; |
269 loaded_components[file] = true; |
249 _load_component_running = false; |
270 _load_component_running = false; |
250 return true; |
271 return true; |