diff --git a/content/addressbook.js b/content/addressbook.js index 7aba2cee..d30c2825 100644 --- a/content/addressbook.js +++ b/content/addressbook.js @@ -31,7 +31,7 @@ liberator.Addressbook = function () //{{{ //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - + const abManager = Components.classes["@mozilla.org/abmanager;1"] .getService(Components.interfaces.nsIAbManager); const rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"] @@ -45,15 +45,15 @@ liberator.Addressbook = function () //{{{ // TODO: add option for a format specifier, like: // :set displayname=%l, %f - function generateDisplayName(firstName, lastName) + function generateDisplayName(firstName, lastName) { if (firstName && lastName) return lastName + ", " + firstName; else if (firstName) return firstName; - else if (lastName) + else if (lastName) return lastName; - else + else return ""; } @@ -72,7 +72,7 @@ liberator.Addressbook = function () //{{{ /////////////////////////////////////////////////////////////////////////////{{{ var modes = liberator.config.mailModes || [liberator.modes.NORMAL]; - + liberator.mappings.add(modes, ["a"], "Open a prompt to save a new addressbook entry for the sender of the selected message", function () @@ -82,7 +82,7 @@ liberator.Addressbook = function () //{{{ { to = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor; } - catch (e) { liberator.beep();} + catch (e) { liberator.beep(); } if (!to) return; @@ -90,12 +90,12 @@ liberator.Addressbook = function () //{{{ var address = to.substring(to.indexOf("<") + 1, to.indexOf(">")); var displayName = to.substr(0, to.indexOf("<") - 1); - if (/^\S+\s+\S+\s*$/.test(displayName)) + if (/^\S+\s+\S+\s*$/.test(displayName)) { var names = displayName.split(/\s+/); displayName = "-firstname=" + names[0].replace(/"/g, "") + " -lastname=" + names[1].replace(/"/g, ""); - } + } else { displayName = "-name=\"" + displayName.replace(/"/g, "") + "\""; @@ -126,7 +126,7 @@ liberator.Addressbook = function () //{{{ var firstName = liberator.commands.getOption(res.opts, "-firstname", null); var lastName = liberator.commands.getOption(res.opts, "-lastname", null); var displayName = liberator.commands.getOption(res.opts, "-name", null); - if (!displayName) + if (!displayName) displayName = generateDisplayName(firstName, lastName); if (liberator.addressbook.add(mailAddr, firstName, lastName, displayName)) @@ -148,10 +148,10 @@ liberator.Addressbook = function () //{{{ /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - + return { - add: function(address, firstname, lastname, displayName) + add: function (address, firstname, lastname, displayName) { var directory = getDirectoryFromURI(kPersonalAddressbookURI); var card = Components.classes["@mozilla.org/addressbook/cardproperty;1"] @@ -169,7 +169,7 @@ liberator.Addressbook = function () //{{{ }, // TODO: add telephone number support - list: function(filter, newMail) + list: function (filter, newMail) { var addresses = []; var dirs = abManager.directories; @@ -179,15 +179,15 @@ liberator.Addressbook = function () //{{{ { var addrbook = dirs.getNext().QueryInterface(Components.interfaces.nsIAbDirectory); var cards = addrbook.childCards; - while(cards.hasMoreElements()) + while (cards.hasMoreElements()) { var card = cards.getNext().QueryInterface(Components.interfaces.nsIAbCard); var mail = card.primaryEmail || ""; var displayName = card.displayName; - if (!displayName) + if (!displayName) displayName = generateDisplayName(card.firstName, card.lastName); - - if (displayName.toLowerCase().indexOf(lowerFilter) > -1 + + if (displayName.toLowerCase().indexOf(lowerFilter) > -1 || card.primaryEmail.toLowerCase().indexOf(lowerFilter) > -1) addresses.push([displayName, card.primaryEmail]); } @@ -195,21 +195,21 @@ liberator.Addressbook = function () //{{{ if (addresses.length < 1) { liberator.echoerr("E94: No matching contact for " + filter, liberator.commandline.FORCE_SINGLELINE); - return false; + return false; } - if (newMail) + if (newMail) { // Now we have to create a new message var args = new Object(); - args.to = addresses.map(function(address) - { - return "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\""; + args.to = addresses.map(function (address) + { + return "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\""; }).join(", "); liberator.mail.composeNewMail(args); - } - else + } + else { var list = ":" + liberator.util.escapeHTML(liberator.commandline.getCommand()) + "
" + ""; diff --git a/content/completion.js b/content/completion.js index f6a8c48b..4ce03ac9 100644 --- a/content/completion.js +++ b/content/completion.js @@ -181,7 +181,7 @@ liberator.Completion = function () //{{{ searchEngineSuggest: function (filter, engineAliases) { if (!filter) - return [0,null]; + return [0, null]; var engineList = (engineAliases || liberator.options["suggestengines"]).split(","); var responseType = "application/x-suggestions+json"; @@ -218,7 +218,7 @@ liberator.Completion = function () //{{{ // make sure we receive strings, otherwise a man-in-the-middle attack // could return objects which toString() method could be called to // execute untrusted code - if(typeof(item) != "string") + if (typeof item != "string") return; completions.push([(matches ? matches[1] : "") + item, engine.name + " suggestion"]); diff --git a/content/hints.js b/content/hints.js index a8e7b91f..9e67424e 100644 --- a/content/hints.js +++ b/content/hints.js @@ -433,7 +433,8 @@ liberator.Hints = function () //{{{ } // the current word matches same characters as the previous word - if (wcIdx > 0) { + if (wcIdx > 0) + { var prevCharIdx = charIdx; // now check if it matches additional characters for (; wcIdx < word.length && charIdx < chars.length; wcIdx++, charIdx++) @@ -458,7 +459,8 @@ liberator.Hints = function () //{{{ } // the current word doesn't match same characters as the previous word, just // try to match the next characters - else { + else + { var prevCharIdx = charIdx; for (var i = 0; i < word.length && charIdx < chars.length; i++, charIdx++) { @@ -466,7 +468,8 @@ liberator.Hints = function () //{{{ break; } - if (prevCharIdx == charIdx) { + if (prevCharIdx == charIdx) + { if (! allowWordOverleaping) return false; } @@ -502,7 +505,8 @@ liberator.Hints = function () //{{{ return true; } - for (; strIdx < strings.length; strIdx++) { + for (; strIdx < strings.length; strIdx++) + { if (strings[strIdx].length != 0) return false; } diff --git a/content/io.js b/content/io.js index 700842c2..e314e41d 100644 --- a/content/io.js +++ b/content/io.js @@ -70,7 +70,7 @@ liberator.IO = function () //{{{ }); // mkv[imperatorrc] or mkm[uttatorrc] - liberator.commands.add(["mk" + extname.substr(0,1) + "[" + extname.substr(1) + "rc]"], + liberator.commands.add(["mk" + extname.substr(0, 1) + "[" + extname.substr(1) + "rc]"], "Write current key mappings and changed options to the config file", function (args, special) { diff --git a/content/mail.js b/content/mail.js index 7e3d506f..afc433ba 100644 --- a/content/mail.js +++ b/content/mail.js @@ -626,7 +626,7 @@ liberator.Mail = function () //{{{ addresses = addresses.concat(mailargs.cc); // TODO: is there a better way to check for validity? - if (addresses.some(function(recipient) { return !(/\S@\S+\.\S/.test(recipient)); })) + if (addresses.some(function (recipient) { return !(/\S@\S+\.\S/.test(recipient)); })) { liberator.echoerr("Exxx: Invalid e-mail address"); return; diff --git a/content/tabs.js b/content/tabs.js index 16bea810..6170c123 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -34,18 +34,18 @@ liberator.Tabs = function () //{{{ ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ var tabmail; - var getBrowser = (function(){ + var getBrowser = (function () { if (liberator.config.hostApplication == "Thunderbird") { - return function() + return function () { if (!tabmail) { tabmail = document.getElementById('tabmail'); - tabmail.__defineGetter__('mTabContainer',function(){ return this.tabContainer; }); - tabmail.__defineGetter__('mTabs',function(){ return this.tabContainer.childNodes; }); - tabmail.__defineGetter__('mCurrentTab',function(){ return this.tabContainer.selectedItem; }); - tabmail.__defineGetter__('mStrip',function(){ return this.tabStrip; }); + tabmail.__defineGetter__('mTabContainer', function () { return this.tabContainer; }); + tabmail.__defineGetter__('mTabs', function () { return this.tabContainer.childNodes; }); + tabmail.__defineGetter__('mCurrentTab', function () { return this.tabContainer.selectedItem; }); + tabmail.__defineGetter__('mStrip', function () { return this.tabStrip; }); } return tabmail; }; @@ -605,7 +605,7 @@ liberator.Tabs = function () //{{{ liberator.beep(); }; } - return function() { return null; }; + return function () { return null; }; })(); if (typeof count != "number" || count < 1)
NameAddress