More scrict rules

This commit is contained in:
RainLoop Team 2016-07-05 22:52:52 +03:00
parent 71b6407d61
commit fb2e492ce8
30 changed files with 126 additions and 89 deletions

View file

@ -210,7 +210,11 @@ module.exports = {
// 'no-lonely-if': 2, // 'no-lonely-if': 2,
// 'no-mixed-operators': 2, // 'no-mixed-operators': 2,
'no-mixed-spaces-and-tabs': 2, 'no-mixed-spaces-and-tabs': 2,
'no-multiple-empty-lines': 2, 'no-multiple-empty-lines': [2, {
"max": 1,
"maxEOF": 1,
"maxBOF": 1
}],
// 'no-negated-condition': 2, // 'no-negated-condition': 2,
// 'no-nested-ternary': 2, // 'no-nested-ternary': 2,
'no-new-object': 2, 'no-new-object': 2,

View file

@ -414,6 +414,46 @@ export const ContactPropertyType = {
'Custom': 250 'Custom': 250
}; };
/**
* @enum {number}
*/
export const Magics = {
'EventWhichMouseMiddle': 3,
'ifvisibleIdle10s': 10,
'BitLength2048': 2048,
'BitLength1024': 1024,
'Size50px': 50,
'Size20px': 20,
'Size1px': 1,
'Time1m': 60000,
'Time30s': 30000,
'Time7s': 7000,
'Time5s': 5000,
'Time3s': 3000,
'Time1s': 1000,
'Time500ms': 500,
'Time350ms': 350,
'Time250ms': 250,
'Time200ms': 200,
'Time100ms': 100,
'Time50ms': 50,
'Time20ms': 20
};
/**
* @enum {number}
*/
export const Ports = {
'Imap': 143,
'ImapSsl': 993,
'Smtp': 25,
'SmtpSsl': 465,
'SmtpStartTls': 587
};
/** /**
* @enum {number} * @enum {number}
*/ */

View file

@ -3,6 +3,8 @@ import {isUnd} from 'Common/Utils';
import {componentExportHelper} from 'Component/Abstract'; import {componentExportHelper} from 'Component/Abstract';
import {AbstractInput} from 'Component/AbstractInput'; import {AbstractInput} from 'Component/AbstractInput';
const DEFAULT_ROWS = 5;
class TextAreaComponent extends AbstractInput class TextAreaComponent extends AbstractInput
{ {
/** /**
@ -13,7 +15,7 @@ class TextAreaComponent extends AbstractInput
super(params); super(params);
this.rows = params.rows || 5; this.rows = params.rows || DEFAULT_ROWS;
this.spellcheck = isUnd(params.spellcheck) ? false : !!params.spellcheck; this.spellcheck = isUnd(params.spellcheck) ? false : !!params.spellcheck;
} }
} }

View file

@ -439,7 +439,6 @@ Knoin.prototype.startScreens = function(aScreensClasses)
}, this); }, this);
_.each(this.oScreens, function(oScreen) { _.each(this.oScreens, function(oScreen) {
if (oScreen && !oScreen.__started && oScreen.__start) if (oScreen && !oScreen.__started && oScreen.__start)
{ {

View file

@ -592,7 +592,6 @@ MessageModel.prototype.findAttachmentByContentLocation = function(sContentLocati
return oResult || null; return oResult || null;
}; };
/** /**
* @returns {string} * @returns {string}
*/ */

View file

@ -585,7 +585,6 @@ RemoteUserAjax.prototype.saveMessage = function(fCallback, sIdentityID, sMessage
}, Consts.SAVE_MESSAGE_AJAX_TIMEOUT); }, Consts.SAVE_MESSAGE_AJAX_TIMEOUT);
}; };
/** /**
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sMessageFolder * @param {string} sMessageFolder

View file

@ -50,7 +50,7 @@ function GeneralUserSettings()
return Utils.convertLangName(this.language()); return Utils.convertLangName(this.language());
}, this); }, this);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100}); this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': Enums.Magics.Time100ms});
this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.editorDefaultTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.editorDefaultTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
@ -121,7 +121,7 @@ GeneralUserSettings.prototype.onBuild = function()
self.languageTrigger(iSaveSettingsStep); self.languageTrigger(iSaveSettingsStep);
_.delay(function() { _.delay(function() {
self.languageTrigger(Enums.SaveSettingsStep.Idle); self.languageTrigger(Enums.SaveSettingsStep.Idle);
}, 1000); }, Enums.Magics.Time1s);
}; };
}; };
@ -163,7 +163,7 @@ GeneralUserSettings.prototype.onBuild = function()
Remote.saveSettings(null, { Remote.saveSettings(null, {
'DesktopNotifications': bValue ? '1' : '0' 'DesktopNotifications': bValue ? '1' : '0'
}); });
}, 3000); }, Enums.Magics.Time3s);
}); });
self.enableSoundNotification.subscribe(function(bValue) { self.enableSoundNotification.subscribe(function(bValue) {
@ -171,7 +171,7 @@ GeneralUserSettings.prototype.onBuild = function()
Remote.saveSettings(null, { Remote.saveSettings(null, {
'SoundNotification': bValue ? '1' : '0' 'SoundNotification': bValue ? '1' : '0'
}); });
}, 3000); }, Enums.Magics.Time3s);
}); });
self.replySameFolder.subscribe(function(bValue) { self.replySameFolder.subscribe(function(bValue) {
@ -179,7 +179,7 @@ GeneralUserSettings.prototype.onBuild = function()
Remote.saveSettings(null, { Remote.saveSettings(null, {
'ReplySameFolder': bValue ? '1' : '0' 'ReplySameFolder': bValue ? '1' : '0'
}); });
}, 3000); }, Enums.Magics.Time3s);
}); });
self.useThreads.subscribe(function(bValue) { self.useThreads.subscribe(function(bValue) {
@ -206,7 +206,7 @@ GeneralUserSettings.prototype.onBuild = function()
}); });
}); });
}, 50); }, Enums.Magics.Time50ms);
}; };
GeneralUserSettings.prototype.onShow = function() GeneralUserSettings.prototype.onShow = function()

View file

@ -70,7 +70,7 @@ function MessageUserStore()
return this.messageCurrentLoading(); return this.messageCurrentLoading();
}, this); }, this);
this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50}); this.messageLoadingThrottle = ko.observable(false).extend({'throttle': Enums.Magics.Time50ms});
this.messageFullScreenMode = ko.observable(false); this.messageFullScreenMode = ko.observable(false);
@ -82,7 +82,7 @@ function MessageUserStore()
this.onMessageResponse = _.bind(this.onMessageResponse, this); this.onMessageResponse = _.bind(this.onMessageResponse, this);
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30); this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, Enums.Magics.Time30s);
} }
MessageUserStore.prototype.computers = function() MessageUserStore.prototype.computers = function()
@ -174,7 +174,7 @@ MessageUserStore.prototype.subscribers = function()
oItem.newForAnimation(false); oItem.newForAnimation(false);
} }
}); });
}, 500)); }, Enums.Magics.Time500ms));
this.message.subscribe(function(oMessage) { this.message.subscribe(function(oMessage) {
@ -240,7 +240,7 @@ MessageUserStore.prototype.purgeMessageBodyCache = function()
{ {
_.delay(function() { _.delay(function() {
oMessagesDom.find('.rl-cache-purge').remove(); oMessagesDom.find('.rl-cache-purge').remove();
}, 300); }, Enums.Magics.Time350ms);
} }
} }
} }
@ -393,7 +393,7 @@ MessageUserStore.prototype.removeMessagesFromList = function(
_.each(aMessages, function(item) { _.each(aMessages, function(item) {
self.messageList.remove(item); self.messageList.remove(item);
}); });
}, 400); }, Enums.Magics.Time350ms);
} }
} }

View file

@ -198,7 +198,7 @@ NotificationUserStore.prototype.displayDesktopNotification = function(sImageSrc,
oLocalNotifications.close(); oLocalNotifications.close();
} }
}; };
}(oNotification)), 7000); }(oNotification)), Enums.Magics.Time7s);
} }
} }
}; };

View file

@ -83,7 +83,7 @@ SettingsUserStore.prototype.populate = function()
{ {
self.iAutoLogoutTimer = window.setTimeout(function() { self.iAutoLogoutTimer = window.setTimeout(function() {
Events.pub('rl.auto-logout'); Events.pub('rl.auto-logout');
}, self.autoLogout() * 1000 * 60); }, self.autoLogout() * Enums.Magics.Time1m);
} }
}); });

View file

@ -119,7 +119,7 @@ LoginAdminView.prototype.onShow = function()
_.delay(_.bind(function() { _.delay(_.bind(function() {
this.loginFocus(true); this.loginFocus(true);
}, this), 100); }, this), Enums.Magics.Time100ms);
}; };

View file

@ -3,6 +3,7 @@ var
_ = require('_'), _ = require('_'),
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Enums = require('Common/Enums'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView'); AbstractView = require('Knoin/AbstractView');
@ -61,7 +62,7 @@ MenuSettingsAdminView.prototype.onBuild = function(oDom)
} }
} }
}, 200)); }, Enums.Magics.Time200ms));
}; };
module.exports = MenuSettingsAdminView; module.exports = MenuSettingsAdminView;

View file

@ -519,7 +519,7 @@ function ComposePopupView()
_.delay(function() { _.delay(function() {
kn.showScreenPopup(require('View/Popup/Contacts'), kn.showScreenPopup(require('View/Popup/Contacts'),
[true, self.sLastFocusedField]); [true, self.sLastFocusedField]);
}, 200); }, Enums.Magics.Time200ms);
} }
}, function() { }, function() {
@ -586,7 +586,7 @@ function ComposePopupView()
this.bDisabeCloseOnEsc = true; this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.Compose; this.sDefaultKeyScope = Enums.KeyState.Compose;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200); this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Enums.Magics.Time200ms);
this.emailsSource = _.bind(this.emailsSource, this); this.emailsSource = _.bind(this.emailsSource, this);
this.autosaveFunction = _.bind(this.autosaveFunction, this); this.autosaveFunction = _.bind(this.autosaveFunction, this);
@ -613,7 +613,7 @@ ComposePopupView.prototype.autosaveFunction = function()
ComposePopupView.prototype.autosaveStart = function() ComposePopupView.prototype.autosaveStart = function()
{ {
window.clearTimeout(this.iTimer); window.clearTimeout(this.iTimer);
this.iTimer = window.setTimeout(this.autosaveFunction, 1000 * 60 * 1); this.iTimer = window.setTimeout(this.autosaveFunction, Enums.Magics.Time1m);
}; };
ComposePopupView.prototype.autosaveStop = function() ComposePopupView.prototype.autosaveStop = function()
@ -1361,7 +1361,7 @@ ComposePopupView.prototype.setFocusInPopup = function()
} }
} }
}, 100); }, Enums.Magics.Time100ms);
} }
}; };
@ -1451,7 +1451,7 @@ ComposePopupView.prototype.onBuild = function()
}); });
Events.sub('window.resize.real', this.resizerTrigger); Events.sub('window.resize.real', this.resizerTrigger);
Events.sub('window.resize.real', _.debounce(this.resizerTrigger, 50)); Events.sub('window.resize.real', _.debounce(this.resizerTrigger, Enums.Magics.Time50ms));
if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox) if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox)
{ {
@ -1478,7 +1478,7 @@ ComposePopupView.prototype.onBuild = function()
{ {
self.oEditor.resize(); self.oEditor.resize();
} }
}, 5000); }, Enums.Magics.Time5s);
}; };
ComposePopupView.prototype.driveCallback = function(sAccessToken, oData) ComposePopupView.prototype.driveCallback = function(sAccessToken, oData)

View file

@ -231,7 +231,7 @@ function ComposeOpenPgpPopupView()
self.submitRequest(false); self.submitRequest(false);
}, 10); }, Enums.Magics.Time20ms);
} }
else else
{ {

View file

@ -290,7 +290,7 @@ function ContactsPopupView()
_.delay(function() { _.delay(function() {
kn.showScreenPopup(require('View/Popup/Compose'), kn.showScreenPopup(require('View/Popup/Compose'),
[Enums.ComposeType.Empty, null, aToEmails, aCcEmails, aBccEmails]); [Enums.ComposeType.Empty, null, aToEmails, aCcEmails, aBccEmails]);
}, 200); }, Enums.Magics.Time200ms);
} }
return true; return true;
@ -338,7 +338,7 @@ function ContactsPopupView()
_.delay(function() { _.delay(function() {
self.viewSaveTrigger(bRes ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult); self.viewSaveTrigger(bRes ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult);
}, 300); }, Enums.Magics.Time350ms);
if (bRes) if (bRes)
{ {
@ -346,7 +346,7 @@ function ContactsPopupView()
_.delay(function() { _.delay(function() {
self.viewSaveTrigger(Enums.SaveSettingsStep.Idle); self.viewSaveTrigger(Enums.SaveSettingsStep.Idle);
}, 1000); }, Enums.Magics.Time1s);
} }
}, sRequestUid, this.viewID(), aProperties); }, sRequestUid, this.viewID(), aProperties);
@ -549,13 +549,11 @@ ContactsPopupView.prototype.removeCheckedOrSelectedContactsFromList = function()
} }
_.delay(function() { _.delay(function() {
_.each(aContacts, function(oContact) { _.each(aContacts, function(oContact) {
oKoContacts.remove(oContact); oKoContacts.remove(oContact);
Utils.delegateRunOnDestroy(oContact); Utils.delegateRunOnDestroy(oContact);
}); });
}, Enums.Magics.Time500ms);
}, 500);
} }
}; };
@ -578,7 +576,7 @@ ContactsPopupView.prototype.deleteSelectedContacts = function()
*/ */
ContactsPopupView.prototype.deleteResponse = function(sResult, oData) ContactsPopupView.prototype.deleteResponse = function(sResult, oData)
{ {
if (500 < (Enums.StorageResultType.Success === sResult && oData && oData.Time ? Utils.pInt(oData.Time) : 0)) if (Enums.Magics.Time500ms < (Enums.StorageResultType.Success === sResult && oData && oData.Time ? Utils.pInt(oData.Time) : 0))
{ {
this.reloadContactList(this.bDropPageAfterDelete); this.reloadContactList(this.bDropPageAfterDelete);
} }
@ -587,7 +585,7 @@ ContactsPopupView.prototype.deleteResponse = function(sResult, oData)
var self = this; var self = this;
_.delay(function() { _.delay(function() {
self.reloadContactList(self.bDropPageAfterDelete); self.reloadContactList(self.bDropPageAfterDelete);
}, 500); }, Enums.Magics.Time500ms);
} }
}; };

View file

@ -248,19 +248,18 @@ function DomainPopupView()
if (this.enableSmartPorts()) if (this.enableSmartPorts())
{ {
var iPort = Utils.pInt(this.imapPort()); var iPort = Utils.pInt(this.imapPort());
sValue = Utils.pString(sValue); switch (Utils.pString(sValue))
switch (sValue)
{ {
case '0': case '0':
if (993 === iPort) if (Enums.Ports.ImapSsl === iPort)
{ {
this.imapPort('143'); this.imapPort(Utils.pString(Enums.Ports.Imap));
} }
break; break;
case '1': case '1':
if (143 === iPort) if (Enums.Ports.Imap === iPort)
{ {
this.imapPort('993'); this.imapPort(Utils.pString(Enums.Ports.ImapSsl));
} }
break; break;
// no default // no default
@ -272,25 +271,24 @@ function DomainPopupView()
if (this.enableSmartPorts()) if (this.enableSmartPorts())
{ {
var iPort = Utils.pInt(this.smtpPort()); var iPort = Utils.pInt(this.smtpPort());
sValue = Utils.pString(sValue); switch (Utils.pString(sValue))
switch (sValue)
{ {
case '0': case '0':
if (465 === iPort || 587 === iPort) if (Enums.Ports.SmtpSsl === iPort || Enums.Ports.SmtpStartTls === iPort)
{ {
this.smtpPort('25'); this.smtpPort(Utils.pString(Enums.Ports.Smtp));
} }
break; break;
case '1': case '1':
if (25 === iPort || 587 === iPort) if (Enums.Ports.Smtp === iPort || Enums.Ports.SmtpStartTls === iPort)
{ {
this.smtpPort('465'); this.smtpPort(Utils.pString(Enums.Ports.SmtpSsl));
} }
break; break;
case '2': case '2':
if (25 === iPort || 465 === iPort) if (Enums.Ports.Smtp === iPort || Enums.Ports.SmtpSsl === iPort)
{ {
this.smtpPort('587'); this.smtpPort(Utils.pString(Enums.Ports.SmtpStartTls));
} }
break; break;
// no default // no default
@ -398,7 +396,6 @@ DomainPopupView.prototype.onHide = function()
this.sieveSettings(false); this.sieveSettings(false);
}; };
DomainPopupView.prototype.onShow = function(oDomain) DomainPopupView.prototype.onShow = function(oDomain)
{ {
this.saving(false); this.saving(false);

View file

@ -155,7 +155,6 @@ FilterPopupView.prototype.populateOptions = function()
]); ]);
}; };
FilterPopupView.prototype.removeCondition = function(oConditionToDelete) FilterPopupView.prototype.removeCondition = function(oConditionToDelete)
{ {
if (this.filter()) if (this.filter())

View file

@ -65,7 +65,7 @@ function FolderSystemPopupView()
'NullFolder': 'NullFolder' 'NullFolder': 'NullFolder'
}); });
}, 1000); }, Enums.Magics.Time1s);
fCallback = function() { fCallback = function() {

View file

@ -54,7 +54,7 @@ KeyboardShortcutsHelpPopupView.prototype.onBuild = function(oDom)
return true; return true;
}, 100)); }, Enums.Magics.Time100ms));
}; };
module.exports = KeyboardShortcutsHelpPopupView; module.exports = KeyboardShortcutsHelpPopupView;

View file

@ -83,7 +83,7 @@ function MessageOpenPgpPopupView()
this.cancelCommand(); this.cancelCommand();
this.resultCallback(oPrivateKey); this.resultCallback(oPrivateKey);
}, this), 100); }, this), Enums.Magics.Time100ms);
}, function() { }, function() {
return !this.submitRequest(); return !this.submitRequest();

View file

@ -3,6 +3,7 @@ var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
PgpStore = require('Stores/User/Pgp'), PgpStore = require('Stores/User/Pgp'),
@ -24,7 +25,7 @@ function NewOpenPgpKeyPopupView()
this.name = ko.observable(''); this.name = ko.observable('');
this.password = ko.observable(''); this.password = ko.observable('');
this.keyBitLength = ko.observable(2048); this.keyBitLength = ko.observable(Enums.Magics.BitLength2048);
this.submitRequest = ko.observable(false); this.submitRequest = ko.observable(false);
@ -90,7 +91,7 @@ function NewOpenPgpKeyPopupView()
self.submitRequest(false); self.submitRequest(false);
} }
}, 100); }, Enums.Magics.Time100ms);
return true; return true;
}); });
@ -108,7 +109,7 @@ NewOpenPgpKeyPopupView.prototype.clearPopup = function()
this.email(''); this.email('');
this.email.error(false); this.email.error(false);
this.keyBitLength(2048); this.keyBitLength(Enums.Magics.BitLength2048);
}; };
NewOpenPgpKeyPopupView.prototype.onShow = function() NewOpenPgpKeyPopupView.prototype.onShow = function()

View file

@ -79,7 +79,7 @@ function PluginPopupView()
this.bDisabeCloseOnEsc = true; this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.All; this.sDefaultKeyScope = Enums.KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200); this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Enums.Magics.Time200ms);
kn.constructorEnd(this); kn.constructorEnd(this);
} }

View file

@ -91,10 +91,9 @@ function TwoFactorConfigurationPopupView()
this.viewTwoFactorStatus = ko.computed(function() { this.viewTwoFactorStatus = ko.computed(function() {
Translator.trigger(); Translator.trigger();
return Translator.i18n( return Translator.i18n(this.twoFactorStatus() ?
this.twoFactorStatus() ? 'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC' : 'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
); );
}, this); }, this);
@ -111,7 +110,6 @@ function TwoFactorConfigurationPopupView()
kn.extendAsViewModel(['View/Popup/TwoFactorConfiguration', 'TwoFactorConfigurationPopupView'], TwoFactorConfigurationPopupView); kn.extendAsViewModel(['View/Popup/TwoFactorConfiguration', 'TwoFactorConfigurationPopupView'], TwoFactorConfigurationPopupView);
_.extend(TwoFactorConfigurationPopupView.prototype, AbstractView.prototype); _.extend(TwoFactorConfigurationPopupView.prototype, AbstractView.prototype);
TwoFactorConfigurationPopupView.prototype.showSecret = function() TwoFactorConfigurationPopupView.prototype.showSecret = function()
{ {
this.secreting(true); this.secreting(true);

View file

@ -72,7 +72,7 @@ AbstractSystemDropDownUserView.prototype.accountClick = function(oAccount, oEven
_.delay(function() { _.delay(function() {
AccountStore.accounts.loading(false); AccountStore.accounts.loading(false);
}, 1000); }, Enums.Magics.Time1s);
} }
return true; return true;

View file

@ -212,7 +212,7 @@ function LoginUserView()
_.delay(function() { _.delay(function() {
self.additionalCode.focused(true); self.additionalCode.focused(true);
}, 100); }, Enums.Magics.Time100ms);
} }
else if (oData.Admin) else if (oData.Admin)
{ {
@ -476,7 +476,7 @@ LoginUserView.prototype.onBuild = function()
}); });
}, 50); }, Enums.Magics.Time50ms);
Utils.triggerAutocompleteInputChange(true); Utils.triggerAutocompleteInputChange(true);
}; };
@ -500,7 +500,7 @@ LoginUserView.prototype.selectLanguageOnTab = function(bShift)
var self = this; var self = this;
_.delay(function() { _.delay(function() {
self.emailFocus(true); self.emailFocus(true);
}, 5); }, Enums.Magics.Time50ms);
return false; return false;
} }

View file

@ -143,7 +143,7 @@ FolderListMailBoxUserView.prototype.onBuild = function(oDom)
var var
iIndex = -1, iIndex = -1,
iKeyCode = handler && 'up' === handler.shortcut ? 38 : 40, iKeyCode = handler && 'up' === handler.shortcut ? Enums.EventKeyCode.Up : Enums.EventKeyCode.Down,
$items = $('.b-folders .e-item .e-link:not(.hidden):visible', oDom); $items = $('.b-folders .e-item .e-link:not(.hidden):visible', oDom);
if (event && $items.length) if (event && $items.length)
@ -154,11 +154,11 @@ FolderListMailBoxUserView.prototype.onBuild = function(oDom)
$items.eq(iIndex).removeClass('focused'); $items.eq(iIndex).removeClass('focused');
} }
if (38 === iKeyCode && 0 < iIndex) if (Enums.EventKeyCode.Up === iKeyCode && 0 < iIndex)
{ {
iIndex -= 1; iIndex -= 1;
} }
else if (40 === iKeyCode && iIndex < $items.length - 1) else if (Enums.EventKeyCode.Down === iKeyCode && iIndex < $items.length - 1)
{ {
iIndex += 1; iIndex += 1;
} }
@ -220,7 +220,7 @@ FolderListMailBoxUserView.prototype.messagesDropOver = function(oFolder)
oFolder.collapsed(false); oFolder.collapsed(false);
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, true); require('App/User').default.setExpandedFolder(oFolder.fullNameHash, true);
Utils.windowResize(); Utils.windowResize();
}, 500); }, Enums.Magics.Time500ms);
} }
}; };

View file

@ -429,7 +429,7 @@ MessageListMailBoxUserView.prototype.goToUpUpOrDownDown = function(bUp)
self.gotoPage(bUp ? oPrev : oNext); self.gotoPage(bUp ? oPrev : oNext);
} }
}, 350); }, Enums.Magics.Time350ms);
return true; return true;
}; };
@ -461,7 +461,7 @@ MessageListMailBoxUserView.prototype.searchEnterAction = function()
MessageListMailBoxUserView.prototype.printableMessageCountForDeletion = function() MessageListMailBoxUserView.prototype.printableMessageCountForDeletion = function()
{ {
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length; var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : ''; return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : ''; // eslint-disable-line no-magic-numbers
}; };
MessageListMailBoxUserView.prototype.cancelSearch = function() MessageListMailBoxUserView.prototype.cancelSearch = function()
@ -772,7 +772,7 @@ MessageListMailBoxUserView.prototype.onBuild = function(oDom)
if (!Globals.bMobileDevice && ifvisible && Settings.capa(Enums.Capa.Prefetch)) if (!Globals.bMobileDevice && ifvisible && Settings.capa(Enums.Capa.Prefetch))
{ {
ifvisible.setIdleDuration(10); ifvisible.setIdleDuration(Enums.Magics.ifvisibleIdle10s);
ifvisible.idle(function() { ifvisible.idle(function() {
self.prefetchNextTick(); self.prefetchNextTick();
@ -980,7 +980,7 @@ MessageListMailBoxUserView.prototype.prefetchNextTick = function()
{ {
self.prefetchNextTick(); self.prefetchNextTick();
} }
}, 1000); }, Enums.Magics.Time1s);
}, oMessage.folderFullNameRaw, oMessage.uid); }, oMessage.folderFullNameRaw, oMessage.uid);
} }

View file

@ -547,7 +547,7 @@ MessageViewMailBoxUserView.prototype.checkHeaderHeight = function()
if (this.oHeaderDom) if (this.oHeaderDom)
{ {
this.viewBodyTopValue(this.message() ? this.oHeaderDom.height() + this.viewBodyTopValue(this.message() ? this.oHeaderDom.height() +
20 /* padding-(top/bottom): 20px */ + 1 /* borded-bottom: 1px */ : 0); Enums.Magics.Size20px /* padding-(top/bottom): 20px */ + Enums.Magics.Size1px /* borded-bottom: 1px */ : 0);
} }
}; };
@ -661,13 +661,13 @@ MessageViewMailBoxUserView.prototype.onBuild = function(oDom)
Events.sub('window.resize', _.throttle(function() { Events.sub('window.resize', _.throttle(function() {
_.delay(fCheckHeaderHeight, 1); _.delay(fCheckHeaderHeight, 1);
_.delay(fCheckHeaderHeight, 200); _.delay(fCheckHeaderHeight, Enums.Magics.Time200ms);
_.delay(fCheckHeaderHeight, 500); _.delay(fCheckHeaderHeight, Enums.Magics.Time500ms);
}, 50)); }, Enums.Magics.Time50ms));
this.showFullInfo.subscribe(function(value) { this.showFullInfo.subscribe(function(value) {
Utils.windowResize(); Utils.windowResize();
Utils.windowResize(250); Utils.windowResize(Enums.Magics.Time200ms);
Local.set(Enums.ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'); Local.set(Enums.ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
}); });
@ -695,7 +695,7 @@ MessageViewMailBoxUserView.prototype.onBuild = function(oDom)
oDom oDom
.on('click', 'a', function(oEvent) { .on('click', 'a', function(oEvent) {
// setup maito protocol // setup maito protocol
return !(!!oEvent && 3 !== oEvent.which && Utils.mailToHelper( return !(!!oEvent && Enums.Magics.EventWhichMouseMiddle !== oEvent.which && Utils.mailToHelper(
$(this).attr('href'), Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null $(this).attr('href'), Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null
)); ));
}) })
@ -1033,11 +1033,11 @@ MessageViewMailBoxUserView.prototype.scrollMessageToTop = function()
{ {
if (this.oMessageScrollerDom) if (this.oMessageScrollerDom)
{ {
if (50 < this.oMessageScrollerDom.scrollTop()) if (Enums.Size50px < this.oMessageScrollerDom.scrollTop())
{ {
this.oMessageScrollerDom this.oMessageScrollerDom
.scrollTop(50) .scrollTop(Enums.Size50px)
.animate({'scrollTop': 0}, 200); .animate({'scrollTop': 0}, Enums.Time200ms);
} }
else else
{ {
@ -1192,7 +1192,7 @@ MessageViewMailBoxUserView.prototype.showImages = function(oMessage)
MessageViewMailBoxUserView.prototype.printableCheckedMessageCount = function() MessageViewMailBoxUserView.prototype.printableCheckedMessageCount = function()
{ {
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length; var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : ''; return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : ''; // eslint-disable-line no-magic-numbers
}; };
/** /**

View file

@ -2,12 +2,12 @@
import window from 'window'; import window from 'window';
import {Promise} from 'es6-promise-polyfill/promise.js'; import {Promise} from 'es6-promise-polyfill/promise.js';
import {jassl} from 'jassl';
import {progressJs} from '../vendors/progress.js/src/progress.js'; import {progressJs} from '../vendors/progress.js/src/progress.js';
import {jassl} from 'jassl';
window.jassl = jassl;
window.Promise = window.Promise || Promise; window.Promise = window.Promise || Promise;
window.progressJs = window.progressJs || progressJs(); window.progressJs = window.progressJs || progressJs();
window.jassl = jassl;
window.progressJs.onbeforeend(() => { window.progressJs.onbeforeend(() => {
const _$ = window.$; const _$ = window.$;
@ -16,7 +16,7 @@ window.progressJs.onbeforeend(() => {
_$('.progressjs-container').hide(); _$('.progressjs-container').hide();
window.setTimeout(() => { window.setTimeout(() => {
_$('.progressjs-container').remove(); _$('.progressjs-container').remove();
}, 200); }, 200); // eslint-disable-line no-magic-numbers
} }
}); });

View file

@ -86,6 +86,6 @@
"pikaday": "^1.4.0", "pikaday": "^1.4.0",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"rimraf": "*", "rimraf": "*",
"webpack": "2.1.0-beta.13" "webpack": "^2.1.0-beta.15"
} }
} }