Changeset 1066 for trunk


Ignore:
Timestamp:
10/06/08 18:55:02 (10 years ago)
Author:
ray
Message:

#1292 test if renaming doesn't screw up history

Location:
trunk
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r1063 r1066  
    33503350      var file = pluginName + ".js"; 
    33513351      url = dir + "/" + file; 
    3352           loadUrl(url); 
    3353       Xinha.ping(url, null, function(){ 
    3354                         Xinha.removeFromParent(document.getElementById(url)); 
    3355                         file = pluginName.replace(/([a-z])([A-Z])([a-z])/g, function (str, l1, l2, l3) { return l1 + "-" + l2.toLowerCase() + l3; }).toLowerCase() + ".js"; 
    3356                 url = dir + "/" + file; 
    3357                         loadUrl(url); 
    3358                         Xinha.ping(url,  
    3359                                 function(){Xinha.debugMsg('You are using an obsolete naming scheme for the Xinha plugin '+pluginName+'. Please rename '+file+' to '+pluginName+'.js' );},  
    3360                                 function(){ 
    3361                                         Xinha._pluginLoadStatus[pluginName] = 'failed'; 
    3362                                         Xinha.debugMsg('Xinha was not able to find the plugin file '+url+'. Please make sure the plugin exist.') 
    3363                                         Xinha.removeFromParent(document.getElementById(url)); 
    3364                         }); 
    3365                 }); 
     3352      //try loading using new naming scheme unconditionally 
     3353      loadUrl(url);  
     3354      //check for file existance 
     3355      Xinha.ping(url, 
     3356        // on success do nothing, all OK 
     3357        null,  
     3358        //on fail try old naming scheme 
     3359        function(){  
     3360          //clean script tag for failed url 
     3361          Xinha.removeFromParent(document.getElementById(url)); 
     3362          file = pluginName.replace(/([a-z])([A-Z])([a-z])/g, function (str, l1, l2, l3) { return l1 + "-" + l2.toLowerCase() + l3; }).toLowerCase() + ".js"; 
     3363          url = dir + "/" + file; 
     3364          //load 
     3365          loadUrl(url);  
     3366          //check for file existance 
     3367          Xinha.ping(url,  
     3368            //on success issue informational message to console 
     3369            function(){Xinha.debugMsg('You are using an obsolete naming scheme for the Xinha plugin '+pluginName+'. Please rename '+file+' to '+pluginName+'.js', 'warn' );},  
     3370            //on fail inform loadPlugins() of fail and issue warning to console 
     3371            function(){ 
     3372            Xinha._pluginLoadStatus[pluginName] = 'failed'; 
     3373            Xinha.debugMsg('Xinha was not able to find the plugin file '+url+'. Please make sure the plugin exist.', 'warn') 
     3374            Xinha.removeFromParent(document.getElementById(url)); 
     3375          }); 
     3376      }); 
    33663377    } 
    33673378  } 
     
    73027313  Xinha.addDom0Event(window,'unload',Xinha.collectGarbageForIE); 
    73037314} 
    7304 Xinha.debugMsg = function(text) 
    7305 { 
    7306   if (typeof console != 'undefined' && typeof console.log == 'function') console.log(text); 
    7307   if (typeof opera != 'undefined' && typeof opera.postError == 'function') opera.postError(text); 
     7315/** Print some message to Firebug, Webkit, or Opera console 
     7316 *  
     7317 * @param {String} text 
     7318 * @param {String} level one of 'warn', 'info', or empty  
     7319 */ 
     7320Xinha.debugMsg = function(text, level) 
     7321{ 
     7322  if (typeof console != 'undefined' && typeof console.log == 'function') 
     7323  { 
     7324    if (level && level == 'warn' && typeof console.warn == 'function') 
     7325    { 
     7326      console.warn(text) 
     7327    } 
     7328    else if (level && level == 'info' && typeof console.info == 'function') 
     7329    { 
     7330      console.info(text) 
     7331    } 
     7332    else console.log(text); 
     7333  } 
     7334  else if (typeof opera != 'undefined' && typeof opera.postError == 'function') opera.postError(text); 
    73087335   
    73097336} 
Note: See TracChangeset for help on using the changeset viewer.