jshint -> eslint

This commit is contained in:
RainLoop Team 2016-06-27 23:54:38 +03:00
parent 40b3f929e9
commit 77a1d3f3df
100 changed files with 716 additions and 811 deletions

View file

@ -49,4 +49,4 @@
module.exports = AccountModel;
}());
}());

View file

@ -550,4 +550,4 @@
module.exports = AttachmentModel;
}());
}());

View file

@ -127,4 +127,4 @@
module.exports = ComposeAttachmentModel;
}());
}());

View file

@ -73,16 +73,16 @@
var bResult = false;
if (oItem && 'Object/Contact' === oItem['@Object'])
{
this.idContact = Utils.pInt(oItem['IdContact']);
this.display = Utils.pString(oItem['Display']);
this.readOnly = !!oItem['ReadOnly'];
this.idContact = Utils.pInt(oItem.IdContact);
this.display = Utils.pString(oItem.Display);
this.readOnly = !!oItem.ReadOnly;
if (Utils.isNonEmptyArray(oItem['Properties']))
if (Utils.isNonEmptyArray(oItem.Properties))
{
_.each(oItem['Properties'], function (oProperty) {
if (oProperty && oProperty['Type'] && Utils.isNormal(oProperty['Value']) && Utils.isNormal(oProperty['TypeStr']))
_.each(oItem.Properties, function (oProperty) {
if (oProperty && oProperty.Type && Utils.isNormal(oProperty.Value) && Utils.isNormal(oProperty.TypeStr))
{
this.properties.push([Utils.pInt(oProperty['Type']), Utils.pString(oProperty['Value']), Utils.pString(oProperty['TypeStr'])]);
this.properties.push([Utils.pInt(oProperty.Type), Utils.pString(oProperty.Value), Utils.pString(oProperty.TypeStr)]);
}
}, this);
}
@ -137,4 +137,4 @@
module.exports = ContactModel;
}());
}());

View file

@ -34,8 +34,8 @@
this.placeholder = ko.observable(sPlaceholder || '');
this.placeholderValue = ko.computed(function () {
var sPlaceholder = this.placeholder();
return sPlaceholder ? Translator.i18n(sPlaceholder) : '';
var value = this.placeholder();
return value ? Translator.i18n(value) : '';
}, this);
this.largeValue = ko.computed(function () {
@ -49,4 +49,4 @@
module.exports = ContactPropertyModel;
}());
}());

View file

@ -218,8 +218,12 @@
{
if (bWrapWithLink)
{
sResult = Utils.encodeHtml('"' + this.name + '" <') +
'<a href="mailto:' + Utils.encodeHtml('"' + this.name + '" <' + this.email + '>') + '" target="_blank" tabindex="-1">' + Utils.encodeHtml(sResult) + '</a>' + Utils.encodeHtml('>');
sResult = Utils.encodeHtml('"' + this.name + '" <') + '<a href="mailto:' +
Utils.encodeHtml('"' + this.name + '" <' + this.email + '>') +
'" target="_blank" tabindex="-1">' +
Utils.encodeHtml(sResult) +
'</a>' +
Utils.encodeHtml('>');
}
else
{
@ -268,9 +272,9 @@
substr_replace = function (str, replace, start, length) {
if (start < 0) {
start = start + str.length;
start += str.length;
}
length = length !== undefined ? length : str.length;
length = typeof length !== 'undefined' ? length : str.length;
if (length < 0) {
length = length + str.length - start;
}
@ -399,4 +403,4 @@
module.exports = EmailModel;
}());
}());

View file

@ -79,12 +79,12 @@
{
case Enums.FiltersAction.MoveTo:
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
'FOLDER': fGetRealFolderName(sActionValue)
FOLDER: fGetRealFolderName(sActionValue)
});
break;
case Enums.FiltersAction.Forward:
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
'EMAIL': sActionValue
EMAIL: sActionValue
});
break;
case Enums.FiltersAction.Vacation:
@ -211,23 +211,23 @@
FilterModel.prototype.toJson = function ()
{
return {
'ID': this.id,
'Enabled': this.enabled() ? '1' : '0',
'Name': this.name(),
'ConditionsType': this.conditionsType(),
'Conditions': _.map(this.conditions(), function (oItem) {
ID: this.id,
Enabled: this.enabled() ? '1' : '0',
Name: this.name(),
ConditionsType: this.conditionsType(),
Conditions: _.map(this.conditions(), function (oItem) {
return oItem.toJson();
}),
'ActionValue': this.actionValue(),
'ActionValueSecond': this.actionValueSecond(),
'ActionValueThird': this.actionValueThird(),
'ActionValueFourth': this.actionValueFourth(),
'ActionType': this.actionType(),
ActionValue: this.actionValue(),
ActionValueSecond: this.actionValueSecond(),
ActionValueThird: this.actionValueThird(),
ActionValueFourth: this.actionValueFourth(),
ActionType: this.actionType(),
'Stop': this.actionNoStop() ? '0' : '1',
'Keep': this.actionKeep() ? '1' : '0',
'MarkAsRead': this.actionMarkAsRead() ? '1' : '0'
Stop: this.actionNoStop() ? '0' : '1',
Keep: this.actionKeep() ? '1' : '0',
MarkAsRead: this.actionMarkAsRead() ? '1' : '0'
};
};
@ -252,33 +252,33 @@
var bResult = false;
if (oItem && 'Object/Filter' === oItem['@Object'])
{
this.id = Utils.pString(oItem['ID']);
this.name(Utils.pString(oItem['Name']));
this.enabled(!!oItem['Enabled']);
this.id = Utils.pString(oItem.ID);
this.name(Utils.pString(oItem.Name));
this.enabled(!!oItem.Enabled);
this.conditionsType(Utils.pString(oItem['ConditionsType']));
this.conditionsType(Utils.pString(oItem.ConditionsType));
this.conditions([]);
if (Utils.isNonEmptyArray(oItem['Conditions']))
if (Utils.isNonEmptyArray(oItem.Conditions))
{
this.conditions(_.compact(_.map(oItem['Conditions'], function (aData) {
this.conditions(_.compact(_.map(oItem.Conditions, function (aData) {
var oFilterCondition = new FilterConditionModel();
return oFilterCondition && oFilterCondition.parse(aData) ?
oFilterCondition : null;
})));
}
this.actionType(Utils.pString(oItem['ActionType']));
this.actionType(Utils.pString(oItem.ActionType));
this.actionValue(Utils.pString(oItem['ActionValue']));
this.actionValueSecond(Utils.pString(oItem['ActionValueSecond']));
this.actionValueThird(Utils.pString(oItem['ActionValueThird']));
this.actionValueFourth(Utils.pString(oItem['ActionValueFourth']));
this.actionValue(Utils.pString(oItem.ActionValue));
this.actionValueSecond(Utils.pString(oItem.ActionValueSecond));
this.actionValueThird(Utils.pString(oItem.ActionValueThird));
this.actionValueFourth(Utils.pString(oItem.ActionValueFourth));
this.actionNoStop(!oItem['Stop']);
this.actionKeep(!!oItem['Keep']);
this.actionMarkAsRead(!!oItem['MarkAsRead']);
this.actionNoStop(!oItem.Stop);
this.actionKeep(!!oItem.Keep);
this.actionMarkAsRead(!!oItem.MarkAsRead);
bResult = true;
}
@ -322,4 +322,4 @@
module.exports = FilterModel;
}());
}());

View file

@ -77,12 +77,12 @@
FilterConditionModel.prototype.parse = function (oItem)
{
if (oItem && oItem['Field'] && oItem['Type'])
if (oItem && oItem.Field && oItem.Type)
{
this.field(Utils.pString(oItem['Field']));
this.type(Utils.pString(oItem['Type']));
this.value(Utils.pString(oItem['Value']));
this.valueSecond(Utils.pString(oItem['ValueSecond']));
this.field(Utils.pString(oItem.Field));
this.type(Utils.pString(oItem.Type));
this.value(Utils.pString(oItem.Value));
this.valueSecond(Utils.pString(oItem.ValueSecond));
return true;
}
@ -93,10 +93,10 @@
FilterConditionModel.prototype.toJson = function ()
{
return {
'Field': this.field(),
'Type': this.type(),
'Value': this.value(),
'ValueSecond': this.valueSecond()
Field: this.field(),
Type: this.type(),
Value: this.value(),
ValueSecond: this.valueSecond()
};
};
@ -114,4 +114,4 @@
module.exports = FilterConditionModel;
}());
}());

View file

@ -376,4 +376,4 @@
module.exports = FolderModel;
}());
}());

View file

@ -49,4 +49,4 @@
module.exports = IdentityModel;
}());
}());

View file

@ -56,7 +56,7 @@
if (MessageSimpleModel.prototype.initByJson.call(this, oJson))
{
this.priority = Utils.pInt(oJson.Priority);
this.priority = Utils.inArray(this.priority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
this.priority = Utils.inArray(this.priority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
this.priority : Enums.MessagePriority.Normal;
this.hash = Utils.pString(oJson.Hash);
@ -86,4 +86,4 @@
module.exports = MessageFullModel;
}());
}());

View file

@ -171,4 +171,4 @@
module.exports = MessageSimpleModel;
}());
}());

View file

@ -108,3 +108,4 @@
module.exports = OpenPgpKeyModel;
}());

View file

@ -61,10 +61,10 @@
var bResult = false;
if (oItem && 'Object/Template' === oItem['@Object'])
{
this.id = Utils.pString(oItem['ID']);
this.name = Utils.pString(oItem['Name']);
this.body = Utils.pString(oItem['Body']);
this.populated = !!oItem['Populated'];
this.id = Utils.pString(oItem.ID);
this.name = Utils.pString(oItem.Name);
this.body = Utils.pString(oItem.Body);
this.populated = !!oItem.Populated;
bResult = true;
}
@ -74,4 +74,4 @@
module.exports = TemplateModel;
}());
}());