Changeset 676

Show
Ignore:
Timestamp:
03/12/08 07:16:16 (9 months ago)
Author:
aranti..@gmail.com
Message:

Make the brace style more consistent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/config-service/src/chrome/chromeFiles/content/config.js

    r667 r676  
    2828  _notifyObservers: function(script, event, data) { 
    2929    var observers = this._observers.concat(script._observers); 
    30     for (var i = 0, observer; observer = observers[i]; i++) 
     30    for (var i = 0, observer; observer = observers[i]; i++) { 
    3131      observer.notifyEvent(script, event, data); 
     32    } 
    3233  }, 
    3334 
     
    4546    name = aScript._name.toLowerCase(); 
    4647 
    47     for (var i = 0, script; script = this._scripts[i]; i++) 
    48       if (script._namespace.toLowerCase() == namespace && script._name.toLowerCase() == name) 
     48    for (var i = 0, script; script = this._scripts[i]; i++) { 
     49      if (script._namespace.toLowerCase() == namespace  
     50        && script._name.toLowerCase() == name 
     51      ) { 
    4952        return i; 
     53      } 
     54    } 
    5055 
    5156    return -1; 
     
    139144        resourceNode.setAttribute("filename", imp._filename); 
    140145        resourceNode.setAttribute("mimetype", imp._mimetype); 
    141         if (imp._charset) 
     146        if (imp._charset) { 
    142147          resourceNode.setAttribute("charset", imp._charset); 
     148        } 
    143149 
    144150        scriptNode.appendChild(doc.createTextNode("\n\t\t")); 
     
    195201 
    196202      while ((result = lines[lnIdx++])) { 
    197         if (result.indexOf("// ==/UserScript==") == 0) 
     203        if (result.indexOf("// ==/UserScript==") == 0) { 
    198204          break; 
     205        } 
    199206 
    200207        var match = result.match(/\/\/ \@(\S+)\s+([^\n]+)/); 
     
    248255 
    249256    // if no meta info, default to reasonable values 
    250     if (script._name == null) 
    251       script._name = parseScriptName(uri); 
    252  
    253     if (script._namespace == null) 
    254       script._namespace = uri.host; 
    255  
    256     if (!script._description) 
    257       script._description = ""; 
    258  
    259     if (script._includes.length == 0) 
    260       script._includes.push("*"); 
     257    if (script._name == null) script._name = parseScriptName(uri); 
     258    if (script._namespace == null) script._namespace = uri.host; 
     259    if (!script._description) script._description = ""; 
     260    if (script._includes.length == 0) script._includes.push("*"); 
    261261 
    262262    return script; 
     
    267267 
    268268    var existingIndex = this._find(script); 
    269     if (existingIndex > -1) 
     269    if (existingIndex > -1) { 
    270270      this.uninstall(this._scripts[existingIndex], false); 
     271    } 
    271272 
    272273    script._initFile(script._tempFile); 
    273274    script._tempFile = null; 
    274275 
    275     for (var i = 0; i < script._requires.length; i++) 
     276    for (var i = 0; i < script._requires.length; i++) { 
    276277      script._requires[i]._initFile(); 
    277  
    278     for (var i = 0; i < script._resources.length; i++) 
     278    } 
     279 
     280    for (var i = 0; i < script._resources.length; i++) { 
    279281      script._resources[i]._initFile(); 
     282    } 
    280283 
    281284    this._scripts.push(script); 
     
    291294 
    292295    // watch out for cases like basedir="." and basedir="../gm_scripts" 
    293     if (!script._basedirFile.equals(this._scriptDir)) 
     296    if (!script._basedirFile.equals(this._scriptDir)) { 
    294297      // if script has its own dir, remove the dir + contents 
    295298      script._basedirFile.remove(true); 
    296     else 
     299    } else { 
    297300      // if script is in the root, just remove the file 
    298301      script._file.remove(false); 
    299  
    300     if (uninstallPrefs) // Remove saved preferences 
    301        GM_prefRoot.remove("scriptvals." + script._namespace + "/" + script._name + "."); 
     302    } 
     303 
     304    if (uninstallPrefs){ 
     305      // Remove saved preferences 
     306      GM_prefRoot.remove("scriptvals." + script._namespace + "/" + script._name + "."); 
     307    } 
    302308  }, 
    303309 
     
    315321 
    316322    // Make sure the user script is installed 
    317     if (from == -1) 
    318       return; 
     323    if (from == -1) return; 
    319324 
    320325    if (typeof destination == 'number') { // if destination is an offset 
     
    326331    } 
    327332 
    328     if (to == -1) 
    329       return; 
     333    if (to == -1) return; 
    330334 
    331335    var tmp = this._scripts.splice(from, 1)[0]; 
     
    336340  get _scriptDir() { 
    337341    var newDir = this._newScriptDir; 
    338     if (newDir.exists()) 
    339       return newDir; 
     342    if (newDir.exists()) return newDir; 
    340343 
    341344    var oldDir = this._oldScriptDir; 
    342     if (oldDir.exists()) 
    343       return oldDir; 
     345    if (oldDir.exists()) return oldDir; 
    344346 
    345347    // if we called this function, we want a script dir. 
     
    471473 
    472474    // If no Latin characters found - use default 
    473     if (!name) 
    474       name = "gm_script"; 
     475    if (!name) name = "gm_script"; 
    475476 
    476477    // 24 is a totally arbitrary max length 
    477     if (name.length > 24) 
    478       name = name.substring(0, 24); 
    479  
    480     if (ext) 
    481       name += "." + ext; 
     478    if (name.length > 24) name = name.substring(0, 24); 
     479 
     480    if (ext) name += "." + ext; 
    482481   
    483482    return name; 
     
    526525  _initFile: function() { 
    527526    var name = this._downloadUrl.substr(this._downloadUrl.lastIndexOf("/") + 1); 
    528     if(name.indexOf("?") > 0) 
     527    if(name.indexOf("?") > 0) { 
    529528      name = name.substr(0, name.indexOf("?")); 
     529    } 
    530530    name = this._script._initFileName(name, true); 
    531531