Changeset 1059
- Timestamp:
- 10/04/08 13:21:02 (2 months ago)
- Files:
-
- 1 modified
-
trunk/XinhaCore.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r1058 r1059 3331 3331 return true; 3332 3332 } 3333 3333 /* 3334 3334 if(!plugin_file) 3335 3335 { … … 3338 3338 plugin_file = dir + "/" + plugin; 3339 3339 } 3340 */ 3340 3341 3341 3342 Xinha._loadback(plugin_file, callback ? function() { callback(pluginName); } : null); … … 3374 3375 var retVal = true; 3375 3376 var nuPlugins = Xinha.cloneObject(plugins); 3376 3377 while ( nuPlugins.length ) 3378 { 3379 var p = nuPlugins.pop(); 3377 for ( var i=0;i<nuPlugins.length;i++ ) 3378 { 3379 var p = nuPlugins[i]; 3380 3381 if (Xinha.externalPlugins[p]) 3382 { 3383 url = Xinha.externalPlugins[p][0]+Xinha.externalPlugins[p][1]; 3384 } 3385 else 3386 { 3387 var dir = this.getPluginDir(p); 3388 var file = p + ".js"; 3389 url = dir + "/" + file; 3390 3391 if (typeof Xinha._pluginLoadStatus[p] == 'undefined') 3392 { 3393 if (!Xinha.ping(dir + "/" + file)) 3394 { 3395 file = p.replace(/([a-z])([A-Z])([a-z])/g, function (str, l1, l2, l3) { return l1 + "-" + l2.toLowerCase() + l3; }).toLowerCase() + ".js"; 3396 if (Xinha.ping(dir + "/" + file)) 3397 { 3398 url = dir + "/" + file; 3399 Xinha.externalPlugins[p] = [dir,'/'+ file]; 3400 Xinha.debugMsg('You use an obsolete naming scheme for the Xinha plugin '+p+'. Please rename '+file+' to '+p+'.js' ); 3401 } 3402 else 3403 { 3404 Xinha.debugMsg('Xinha was not able to find the plugin file '+url+'. Please make sure the plugin exist.') 3405 Xinha._pluginLoadStatus[p] = 'failed'; 3406 continue; 3407 } 3408 } 3409 } 3410 } 3411 3380 3412 if (p == 'FullScreen' && !Xinha.externalPlugins['FullScreen'] ) continue; //prevent trying to load FullScreen plugin from the plugins folder 3381 3413 3382 if ( typeof Xinha._pluginLoadStatus[p] == 'undefined' )3414 if ( typeof Xinha._pluginLoadStatus[p] == 'undefined' && typeof window[p] == 'undefined') 3383 3415 { 3384 3416 // Load it … … 3387 3419 function(plugin) 3388 3420 { 3421 Xinha.setLoadingMessage (Xinha._lc("Finishing")); 3389 3422 if ( typeof window[plugin] != 'undefined' ) 3390 3423 { … … 3400 3433 Xinha._pluginLoadStatus[plugin] = 'failed'; 3401 3434 } 3402 }, (Xinha.externalPlugins[p] ? Xinha.externalPlugins[p][0]+Xinha.externalPlugins[p][1] : url)3435 }, url 3403 3436 ); 3404 3437 retVal = false; … … 3435 3468 if ( callbackIfNotReady ) 3436 3469 { 3437 setTimeout(function() { if ( Xinha.loadPlugins(plugins, callbackIfNotReady) ) { callbackIfNotReady(); } }, 150);3470 setTimeout(function() { if ( Xinha.loadPlugins(plugins, callbackIfNotReady) ) { callbackIfNotReady(); } }, 50); 3438 3471 } 3439 3472 return retVal; … … 6219 6252 return ''; 6220 6253 } 6221 6254 }; 6255 Xinha.ping = function(url) 6256 { 6257 var req = null; 6258 req = Xinha.getXMLHTTPRequestObject(); 6259 6260 // Synchronous! 6261 req.open('HEAD', url, false); 6262 req.send(null); 6263 if ( req.status >= 400 ) 6264 { 6265 return false; 6266 } 6267 else 6268 { 6269 return true; 6270 } 6222 6271 }; 6223 6272 … … 7262 7311 Xinha.addDom0Event(window,'unload',Xinha.collectGarbageForIE); 7263 7312 } 7313 Xinha.debugMsg = function(text) 7314 { 7315 if (typeof console != 'undefined' && typeof console.log == 'function') console.log(text); 7316 } 7264 7317 Xinha.notImplemented = function(methodName) 7265 7318 {
