Changeset d5349d


Ignore:
Timestamp:
Oct 15, 2014, 4:27:45 PM (6 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
162a67
Parents:
71a4b1
Message:

cleanup for javascript strict mode

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • content/prefDialog/vI_prefDialog_FolderPicker.js

    r71a4b1 rd5349d  
    6060var tmplFolderPickerId = "msgStationeryFolderPicker";
    6161
    62 
    63 // patch for https://bugzilla.mozilla.org/show_bug.cgi?id=889022, see there
    64 if (Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo).ID != "postbox@postbox-inc.com")
    65 {
    66   Components.utils.import("resource:///modules/MailUtils.js");
    67 }
    68 
    69 if (typeof(GetMsgFolderFromUri) != "function") {
    70     function GetMsgFolderFromUri(uri, checkFolderAttributes)
    71     {
    72         let msgfolder = null;
    73         if (typeof MailUtils != 'undefined') {
    74         return MailUtils.getFolderForURI(uri, checkFolderAttributes);
    75         }
    76         try { // Postbox
    77         let resource = GetResourceFromUri(uri);
    78         msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
    79         if (checkFolderAttributes) {
    80             if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
    81             msgfolder = null;
    82             }
    83         }
    84         }
    85         catch (ex) {
    86         //dump("failed to get the folder resource\n");
    87         }
    88         return msgfolder;
    89     }
     62var _GetMsgFolderFromUri = function(uri, checkFolderAttributes)
     63{
     64    let msgfolder = null;
     65    if (typeof MailUtils != 'undefined') {
     66    return MailUtils.getFolderForURI(uri, checkFolderAttributes);
     67    }
     68    try { // Postbox
     69    let resource = GetResourceFromUri(uri);
     70    msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
     71    if (checkFolderAttributes) {
     72        if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
     73        msgfolder = null;
     74        }
     75    }
     76    }
     77    catch (ex) {
     78    //dump("failed to get the folder resource\n");
     79    }
     80    return msgfolder;
    9081}
    9182 
    92 function setDefaultCopiesAndFoldersPrefs(identity, server, accountData)
     83var setDefaultCopiesAndFoldersPrefs = function(identity, server, accountData)
    9384{
    9485    var am = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
     
    112103
    113104
    114 function onInitCopiesAndFolders()
     105var onInitCopiesAndFolders = function()
    115106{
    116107    SetSpecialFolderNamesWithDelims();
     
    141132
    142133// Initialize the picker mode choices (account/folder picker) into global vars
    143 function SetGlobalRadioElemChoices()
     134var SetGlobalRadioElemChoices = function()
    144135{
    145136    var pickerModeElement = document.getElementById("VIdent_identity.fccFolderPickerMode");
     
    165156 * preferences file.
    166157 */
    167 function SetFolderDisplay(pickerMode, disableMode,
     158var SetFolderDisplay = function(pickerMode, disableMode,
    168159                          radioElemPrefix,
    169160                          accountPickerId,
     
    231222// Create a set of global special folder vars to be suffixed to the
    232223// server URI of the selected account.
    233 function SetSpecialFolderNamesWithDelims()
     224var SetSpecialFolderNamesWithDelims = function()
    234225{
    235226    var folderDelim = "/";
     
    241232}
    242233
    243 function onSaveCopiesAndFolders()
     234var onSaveCopiesAndFolders = function()
    244235{
    245236    vI.SaveFolderSettings( gFccRadioElemChoice,
     
    269260
    270261// Check the Fcc Self item and setup associated picker state
    271 function setupFccItems()
     262var setupFccItems = function()
    272263{
    273264    var broadcaster = document.getElementById("VIdent_broadcaster_doFcc");
     
    285276
    286277// Set up picker settings for Sent Folder
    287 function SetupFccPickerState(pickerMode, accountPickerId, folderPickerId)
     278var SetupFccPickerState = function(pickerMode, accountPickerId, folderPickerId)
    288279{
    289280    switch (pickerMode) {
     
    308299
    309300// Enable and disable pickers based on the radio element clicked
    310 function SetPickerEnabling(enablePickerId, disablePickerId)
     301var SetPickerEnabling = function(enablePickerId, disablePickerId)
    311302{
    312303    var activePicker = document.getElementById(enablePickerId);
     
    318309
    319310// Set radio element choices and picker states
    320 function setPickersState(enablePickerId, disablePickerId, event)
     311var setPickersState = function(enablePickerId, disablePickerId, event)
    321312{
    322313    SetPickerEnabling(enablePickerId, disablePickerId);
     
    365356// This routine is to restore the correct radio element
    366357// state when the fcc self checkbox broadcasts the change
    367 function SetRadioButtons(selectPickerId, unselectPickerId)
     358var SetRadioButtons = function(selectPickerId, unselectPickerId)
    368359{
    369360    var activeRadioElem = document.getElementById(selectPickerId);
     
    377368vI.gTmplRadioElemChoice = gTmplRadioElemChoice;
    378369
     370// patch for https://bugzilla.mozilla.org/show_bug.cgi?id=889022, see there
     371Components.utils.import("resource:///modules/MailUtils.js");
     372if (typeof(GetMsgFolderFromUri) != "function") {
     373    var GetMsgFolderFromUri = _GetMsgFolderFromUri;
     374}
     375
    379376}});
  • content/prefDialog/vI_prefDialog_TB3FolderPicker.js

    r71a4b1 rd5349d  
    4646virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
    4747
    48 function InitFolderDisplays(msgFolder, accountPickerId, folderPickerId) {
     48var InitFolderDisplays = function(msgFolder, accountPickerId, folderPickerId) {
    4949    var accountPicker = document.getElementById(accountPickerId);
    5050    var folderPicker = document.getElementById(folderPickerId);
     
    5454
    5555// Initialize the folder display based on prefs values
    56 function InitFolderDisplay(folder, folderPicker) {
     56var InitFolderDisplay = function(folder, folderPicker) {
    5757    try {
    5858      folderPicker.firstChild.selectFolder(folder);
     
    6464
    6565// Capture any menulist changes
    66 function noteSelectionChange(radioItemId, aEvent)
     66var noteSelectionChange = function(radioItemId, aEvent)
    6767{
    6868    var checkedElem = document.getElementById(radioItemId);
     
    9393
    9494// Save folder settings and radio element choices
    95 function SaveFolderSettings(radioElemChoice,
     95var SaveFolderSettings = function(radioElemChoice,
    9696                            radioGroupId,
    9797                            folderSuffix,
  • content/vI_rdfDataTree.js

    r71a4b1 rd5349d  
    3939
    4040//prepares an object for easy comparison against another. for strings, lowercases them
    41 function prepareForComparison (element, field) {
     41var prepareForComparison = function(element, field) {
    4242    if (field == "changedCol") {
    4343        field = "changed"
     
    5252
    5353
    54 function rdfDataTree(treeType, rdfDatasource) {
     54var rdfDataTree = function(treeType, rdfDatasource) {
    5555    this.treeType = treeType;
    5656    this._rdfDatasource = rdfDatasource;
     
    282282        };
    283283        this.getCellProperties = function(row,col,props){
    284             if (rdfDataTreeCollection._braille) return;
    285             var aserv=Components.classes["@mozilla.org/atom-service;1"].
    286                 getService(Components.interfaces.nsIAtomService);
    287             if (typeof props == 'undefined') {
    288                 // Requires Gecko 22
    289                 switch (table[row][col.id.substr(0,col.id.indexOf("_"))]) {
    290                     case "yes": return aserv.getAtom("yes"); break;
    291                     case "no":  return aserv.getAtom("no"); break;
    292                 }
    293             } else {
    294                 // Obsolete since Gecko 22
    295                 switch (table[row][col.id.substr(0,col.id.indexOf("_"))]) {
    296                     case "yes": props.AppendElement(aserv.getAtom("yes")); break;
    297                     case "no":  props.AppendElement(aserv.getAtom("no")); break;
     284            var returnValue = null;
     285            if (!rdfDataTreeCollection._braille) {
     286                var aserv=Components.classes["@mozilla.org/atom-service;1"].
     287                    getService(Components.interfaces.nsIAtomService);
     288                if (typeof props == 'undefined') {
     289                    // Requires Gecko 22
     290                    switch (table[row][col.id.substr(0,col.id.indexOf("_"))]) {
     291                        case "yes": returnValue = aserv.getAtom("yes"); break;
     292                        case "no":  returnValue = aserv.getAtom("no"); break;
     293                    }
     294                } else {
     295                    // Obsolete since Gecko 22
     296                    switch (table[row][col.id.substr(0,col.id.indexOf("_"))]) {
     297                        case "yes": props.AppendElement(aserv.getAtom("yes")); break;
     298                        case "no":  props.AppendElement(aserv.getAtom("no")); break;
     299                    }
    298300                }
    299301            }
    300             return "";
     302            return returnValue;
    301303        };
    302304    },
     
    519521    }
    520522};
     523
    521524vI.rdfDataTreeCollection = rdfDataTreeCollection;
    522525vI.rdfDataTree = rdfDataTree;
  • modules/vI_account.js

    r71a4b1 rd5349d  
    483483  return account._account;
    484484};
    485 vIaccount_cleanupSystem = account.cleanupSystem;
    486 vIaccount_createAccount = account.createAccount;
    487 vIaccount_removeUsedVIAccount = account.removeUsedVIAccount;
     485var vIaccount_cleanupSystem = account.cleanupSystem;
     486var vIaccount_createAccount = account.createAccount;
     487var vIaccount_removeUsedVIAccount = account.removeUsedVIAccount;
  • modules/vI_accountUtils.js

    r71a4b1 rd5349d  
    5555function getAccountsArray() {
    5656    var accounts;
     57    function sortAccounts(a, b) {
     58        if (a.key == accountManager.defaultAccount.key)
     59        return -1;
     60        if (b.key == accountManager.defaultAccount.key)
     61        return 1;
     62        var aIsNews = a.incomingServer.type == "nntp";
     63        var bIsNews = b.incomingServer.type == "nntp";
     64        if (aIsNews && !bIsNews)
     65        return 1;
     66        if (bIsNews && !aIsNews)
     67        return -1;
     68
     69        var aIsLocal = a.incomingServer.type == "none";
     70        var bIsLocal = b.incomingServer.type == "none";
     71        if (aIsLocal && !bIsLocal)
     72        return 1;
     73        if (bIsLocal && !aIsLocal)
     74        return -1;
     75        return 0;
     76    }
    5777    if (Components.utils.import("resource:///modules/folderUtils.jsm") && Components.utils.import("resource:///modules/iteratorUtils.jsm")
    5878        && typeof(allAccountsSorted)=='function') {
     
    6888        // Ugly hack to work around bug 41133. :-(
    6989        accounts = accounts.filter(function isNonSuckyAccount(a) { return !!a.incomingServer; });
    70         function sortAccounts(a, b) {
    71             if (a.key == accountManager.defaultAccount.key)
    72             return -1;
    73             if (b.key == accountManager.defaultAccount.key)
    74             return 1;
    75             var aIsNews = a.incomingServer.type == "nntp";
    76             var bIsNews = b.incomingServer.type == "nntp";
    77             if (aIsNews && !bIsNews)
    78             return 1;
    79             if (bIsNews && !aIsNews)
    80             return -1;
    81 
    82             var aIsLocal = a.incomingServer.type == "none";
    83             var bIsLocal = b.incomingServer.type == "none";
    84             if (aIsLocal && !bIsLocal)
    85             return 1;
    86             if (bIsLocal && !aIsLocal)
    87             return -1;
    88             return 0;
    89         }
    9090        accounts.sort(sortAccounts);
    9191    }
Note: See TracChangeset for help on using the changeset viewer.