mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 06:38:12 +01:00
whitespace fixes
This commit is contained in:
@@ -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()) + "<br/>" +
|
||||
"<table><tr align=\"left\" class=\"hl-Title\"><th>Name</th><th>Address</th></tr>";
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user