ES2015 first look / babeljs

This commit is contained in:
RainLoop Team 2015-11-15 03:23:16 +03:00
parent 5dcceaaca5
commit 445cd155e5
123 changed files with 3214 additions and 3680 deletions

View file

@ -121,7 +121,7 @@
{
bTrial = Utils.isUnd(bTrial) ? false : !!bTrial;
this.key(bTrial ? Consts.Values.RainLoopTrialKey : '');
this.key(bTrial ? Consts.RAINLOOP_TRIAL_KEY : '');
this.activateText('');
this.activateText.isError(false);
this.activationSuccessed(false);
@ -142,7 +142,7 @@
ActivatePopupView.prototype.validateSubscriptionKey = function ()
{
var sValue = this.key();
return '' === sValue || Consts.Values.RainLoopTrialKey === sValue ||
return '' === sValue || Consts.RAINLOOP_TRIAL_KEY === sValue ||
!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
};

View file

@ -380,7 +380,7 @@
if (!this.allowFolders)
{
sSentFolder = Consts.Values.UnuseOptionValue;
sSentFolder = Consts.UNUSED_OPTION_VALUE;
}
if ('' === sSentFolder)
@ -412,7 +412,7 @@
}
}
sSentFolder = Consts.Values.UnuseOptionValue === sSentFolder ? '' : sSentFolder;
sSentFolder = Consts.UNUSED_OPTION_VALUE === sSentFolder ? '' : sSentFolder;
Cache.setFolderHash(this.draftFolder(), '');
Cache.setFolderHash(sSentFolder, '');
@ -649,7 +649,7 @@
sDraftFolder = FolderStore.draftFolder()
;
if ('' !== sDraftFolder && Consts.Values.UnuseOptionValue !== sDraftFolder)
if ('' !== sDraftFolder && Consts.UNUSED_OPTION_VALUE !== sDraftFolder)
{
Cache.setFolderHash(sDraftFolder, '');
if (FolderStore.currentFolderFullNameRaw() === sDraftFolder)

View file

@ -68,7 +68,7 @@
this.contactsPage = ko.observable(1);
this.contactsPageCount = ko.computed(function () {
var iPage = window.Math.ceil(this.contactsCount() / Consts.Defaults.ContactsPerPage);
var iPage = window.Math.ceil(this.contactsCount() / Consts.CONTACTS_PER_PAGE);
return 0 >= iPage ? 1 : iPage;
}, this);
@ -679,7 +679,7 @@
{
var
self = this,
iOffset = (this.contactsPage() - 1) * Consts.Defaults.ContactsPerPage
iOffset = (this.contactsPage() - 1) * Consts.CONTACTS_PER_PAGE
;
this.bDropPageAfterDelete = false;
@ -722,7 +722,7 @@
self.contacts.loading(false);
self.viewClearSearch('' !== self.search());
}, iOffset, Consts.Defaults.ContactsPerPage, this.search());
}, iOffset, Consts.CONTACTS_PER_PAGE, this.search());
};
ContactsPopupView.prototype.onBuild = function (oDom)

View file

@ -74,16 +74,16 @@
this.name.focused = ko.observable(false);
this.imapServer = ko.observable('');
this.imapPort = ko.observable('' + Consts.Values.ImapDefaulPort);
this.imapPort = ko.observable('' + Consts.IMAP_DEFAULT_PORT);
this.imapSecure = ko.observable(Enums.ServerSecure.None);
this.imapShortLogin = ko.observable(false);
this.useSieve = ko.observable(false);
this.sieveAllowRaw = ko.observable(false);
this.sieveServer = ko.observable('');
this.sievePort = ko.observable('' + Consts.Values.SieveDefaulPort);
this.sievePort = ko.observable('' + Consts.SIEVE_DEFAULT_PORT);
this.sieveSecure = ko.observable(Enums.ServerSecure.None);
this.smtpServer = ko.observable('');
this.smtpPort = ko.observable('' + Consts.Values.SmtpDefaulPort);
this.smtpPort = ko.observable('' + Consts.SMTP_DEFAULT_PORT);
this.smtpSecure = ko.observable(Enums.ServerSecure.None);
this.smtpShortLogin = ko.observable(false);
this.smtpAuth = ko.observable(true);
@ -441,18 +441,18 @@
this.name.focused(false);
this.imapServer('');
this.imapPort('' + Consts.Values.ImapDefaulPort);
this.imapPort('' + Consts.IMAP_DEFAULT_PORT);
this.imapSecure(Enums.ServerSecure.None);
this.imapShortLogin(false);
this.useSieve(false);
this.sieveAllowRaw(false);
this.sieveServer('');
this.sievePort('' + Consts.Values.SieveDefaulPort);
this.sievePort('' + Consts.SIEVE_DEFAULT_PORT);
this.sieveSecure(Enums.ServerSecure.None);
this.smtpServer('');
this.smtpPort('' + Consts.Values.SmtpDefaulPort);
this.smtpPort('' + Consts.SMTP_DEFAULT_PORT);
this.smtpSecure(Enums.ServerSecure.None);
this.smtpShortLogin(false);
this.smtpAuth(true);

View file

@ -36,7 +36,7 @@
this.folderName = ko.observable('');
this.folderName.focused = ko.observable(false);
this.selectedParentValue = ko.observable(Consts.Values.UnuseOptionValue);
this.selectedParentValue = ko.observable(Consts.UNUSED_OPTION_VALUE);
this.parentFolderSelectList = ko.computed(function () {

View file

@ -39,7 +39,7 @@
this.folderSelectList = ko.computed(function () {
return Utils.folderListOptionsBuilder([], FolderStore.folderList(), FolderStore.folderListSystemNames(), [
['', this.sChooseOnText],
[Consts.Values.UnuseOptionValue, this.sUnuseText]
[Consts.UNUSED_OPTION_VALUE, this.sUnuseText]
], null, null, null, null, null, true);
}, this);

View file

@ -19,7 +19,7 @@
LanguageStore = require('Stores/Language'),
AppStore = require('Stores/User/App'),
Local = require('Storage/Client'),
Local = require('Storage/Client.jsx'),
Settings = require('Storage/Settings'),
Remote = require('Remote/User/Ajax'),

View file

@ -159,7 +159,7 @@
}, this);
this.isSpamDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === FolderStore.spamFolder();
return Consts.UNUSED_OPTION_VALUE === FolderStore.spamFolder();
}, this);
this.isTrashFolder = ko.computed(function () {
@ -183,7 +183,7 @@
}, this);
this.isArchiveDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === FolderStore.archiveFolder();
return Consts.UNUSED_OPTION_VALUE === FolderStore.archiveFolder();
}, this);
this.isArchiveVisible = ko.computed(function () {

View file

@ -10,9 +10,6 @@
ko = require('ko'),
key = require('key'),
// PhotoSwipe = require('PhotoSwipe'),
// PhotoSwipeUI_Default = require('PhotoSwipeUI_Default'),
Consts = require('Common/Consts'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
@ -31,7 +28,7 @@
FolderStore = require('Stores/User/Folder'),
MessageStore = require('Stores/User/Message'),
Local = require('Storage/Client'),
Local = require('Storage/Client.jsx'),
Settings = require('Storage/Settings'),
Remote = require('Remote/User/Ajax'),
@ -298,7 +295,7 @@
this.viewLineAsCss = ko.observable('');
this.viewViewLink = ko.observable('');
this.viewDownloadLink = ko.observable('');
this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
this.viewUserPic = ko.observable(Consts.DATA_IMAGE_USER_DOT_PIC);
this.viewUserPicVisible = ko.observable(false);
this.viewIsImportant = ko.observable(false);
this.viewIsFlagged = ko.observable(false);
@ -385,7 +382,7 @@
if (sPic !== self.viewUserPic() && sLastEmail === sEmail)
{
self.viewUserPicVisible(false);
self.viewUserPic(Consts.DataImages.UserDotPic);
self.viewUserPic(Consts.DATA_IMAGE_USER_DOT_PIC);
if ('' !== sPic)
{
self.viewUserPicVisible(true);
@ -691,92 +688,6 @@
this.oHeaderDom = $('.messageItemHeader', oDom);
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
/*
this.pswpDom = $('.pswp', oDom)[0];
if (this.pswpDom)
{
oDom
.on('click', '.attachmentImagePreview.visible', function (oEvent) {
var
iIndex = 0,
oPs = null,
oEl = oEvent.currentTarget || null,
aItems = []
// fThumbBoundsFn = function (index) {
// var oRes = null, oEl = aItems[index], oPos = null;
// if (oEl && oEl.el)
// {
// oPos = oEl.el.find('.iconBG').offset();
// oRes = oPos && oPos.top && oPos.left ?
// {x: oPos.left, y: oPos.top, w: 60} : null;
// }
//
// return oRes;
// }
;
oDom.find('.attachmentImagePreview.visible').each(function (index, oSubElement) {
var
$oItem = $(oSubElement)
;
if (oEl === oSubElement)
{
iIndex = index;
}
aItems.push({
'w': 600, 'h': 400,
'src': $oItem.attr('href'),
'title': $oItem.attr('title') || ''
});
});
if (aItems && 0 < aItems.length)
{
Globals.useKeyboardShortcuts(false);
oPs = new PhotoSwipe(self.pswpDom, PhotoSwipeUI_Default, aItems, {
'index': iIndex,
'bgOpacity': 0.85,
'loadingIndicatorDelay': 500,
'errorMsg': '<div class="pswp__error-msg">' + sErrorMessage + '</div>',
'showHideOpacity': true,
'tapToToggleControls': false,
// 'getThumbBoundsFn': fThumbBoundsFn,
'timeToIdle': 0,
'timeToIdleOutside': 0,
'history': false,
'arrowEl': 1 < aItems.length,
'counterEl': 1 < aItems.length,
'shareEl': false
});
oPs.listen('imageLoadComplete', function(index, item) {
if (item && item.img && item.img.width && item.img.height)
{
item.w = item.img.width;
item.h = item.img.height;
oPs.updateSize(true);
}
});
oPs.listen('close', function() {
Globals.useKeyboardShortcuts(true);
});
oPs.init();
}
return false;
});
}
*/
oDom
.on('click', 'a', function (oEvent) {
// setup maito protocol
@ -1061,7 +972,7 @@
*/
MessageViewMailBoxUserView.prototype.isSpamDisabled = function ()
{
return MessageStore.message() && FolderStore.spamFolder() === Consts.Values.UnuseOptionValue;
return MessageStore.message() && FolderStore.spamFolder() === Consts.UNUSED_OPTION_VALUE;
};
/**
@ -1077,7 +988,7 @@
*/
MessageViewMailBoxUserView.prototype.isArchiveDisabled = function ()
{
return MessageStore.message() && FolderStore.archiveFolder() === Consts.Values.UnuseOptionValue;
return MessageStore.message() && FolderStore.archiveFolder() === Consts.UNUSED_OPTION_VALUE;
};
/**