A lot small fixes

This commit is contained in:
RainLoop Team 2015-06-04 22:02:31 +04:00
parent 4457cdbc23
commit 09334159c2
38 changed files with 1496 additions and 239 deletions

View file

@ -7,7 +7,7 @@
window = require('window'),
_ = require('_'),
ko = require('ko'),
SimplePace = require('SimplePace'),
progressJs = require('progressJs'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
@ -208,7 +208,7 @@
Remote.licensing(function (sResult, oData) {
LicenseStore.licensingProcess(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && Utils.isNormal(oData.Result['Expired']))
{
LicenseStore.licenseValid(true);
@ -280,9 +280,9 @@
}
}
if (SimplePace)
if (progressJs)
{
SimplePace.set(100);
progressJs().end();
}
};

View file

@ -7,7 +7,7 @@
window = require('window'),
_ = require('_'),
$ = require('$'),
SimplePace = require('SimplePace'),
progressJs = require('progressJs'),
Tinycon = require('Tinycon'),
Enums = require('Common/Enums'),
@ -255,6 +255,7 @@
{
var
self = this,
sTrashFolder = FolderStore.trashFolder(),
sSpamFolder = FolderStore.spamFolder()
;
@ -262,11 +263,12 @@
var
bSpam = sSpamFolder === oItem['To'],
bTrash = sTrashFolder === oItem['To'],
bHam = !bSpam && sSpamFolder === oItem['From'] && Cache.getFolderInboxName() === oItem['To']
;
Remote.messagesMove(self.moveOrDeleteResponseHelper, oItem['From'], oItem['To'], oItem['Uid'],
bSpam ? 'SPAM' : (bHam ? 'HAM' : ''));
bSpam ? 'SPAM' : (bHam ? 'HAM' : ''), bSpam || bTrash);
});
this.oMoveCache = {};
@ -1305,9 +1307,9 @@
{
kn.hideLoading();
if (SimplePace)
if (progressJs)
{
SimplePace.set(100);
progressJs().end();
}
};
@ -1332,10 +1334,9 @@
bTwitter = Settings.settingsGet('AllowTwitterSocial')
;
if (SimplePace)
if (progressJs)
{
SimplePace.set(70);
SimplePace.sleep();
progressJs().set(70);
}
Globals.leftPanelDisabled.subscribe(function (bValue) {

46
dev/External/ko.js vendored
View file

@ -811,7 +811,7 @@
'parseOnBlur': true,
'allowDragAndDrop': true,
'focusCallback': fFocusCallback,
'inputDelimiters': [',', ';'],
'inputDelimiters': [',', ';', '\n'],
'autoCompleteSource': fAutoCompleteSource,
// 'elementHook': function (oEl, oItem) {
// if (oEl && oItem)
@ -821,23 +821,53 @@
// }
// },
'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) {
var aResult = [];
_.each(aInput, function (sInputValue) {
var
aM = null,
aValues = [],
sValue = Utils.trim(sInputValue),
oEmail = null
;
if ('' !== sValue)
{
oEmail = new EmailModel();
oEmail.mailsoParse(sValue);
return [oEmail.toLine(false), oEmail];
aM = sValue.match(/[@]/g);
if (aM && 0 < aM.length)
{
sValue = sValue.replace(/[\r\n]+/g, '; ').replace(/[\s]+/g, ' ');
aValues = EmailModel.splitHelper(sValue, ';');
_.each(aValues, function (sV) {
oEmail = new EmailModel();
oEmail.mailsoParse(sV);
if (oEmail.email)
{
aResult.push([oEmail.toLine(false), oEmail]);
}
else
{
aResult.push(['', null]);
}
});
}
else
{
aResult.push([sInputValue, null]);
}
}
else
{
aResult.push([sInputValue, null]);
}
return [sValue, null];
});
return aResult;
},
'change': _.bind(function (oEvent) {
$oEl.data('EmailsTagsValue', oEvent.target.value);

View file

@ -36,6 +36,49 @@
return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
};
/**
* @static
* @param {string} sLine
* @param {string=} sDelimiter = ';'
* @return {Array}
*/
EmailModel.splitHelper = function (sLine, sDelimiter)
{
sDelimiter = sDelimiter || ';';
sLine = sLine.replace(/[\r\n]+/g, '; ').replace(/[\s]+/g, ' ');
var
iIndex = 0,
iLen = sLine.length,
bAt = false,
sChar = '',
sResult = ''
;
for (; iIndex < iLen; iIndex++)
{
sChar = sLine.charAt(iIndex);
switch (sChar)
{
case '@':
bAt = true;
break;
case ' ':
if (bAt)
{
bAt = false;
sResult += sDelimiter;
}
break;
}
sResult += sChar;
}
return sResult.split(sDelimiter);
};
/**
* @type {string}
*/

View file

@ -727,13 +727,15 @@
* @param {string} sToFolder
* @param {Array} aUids
* @param {string=} sLearning
* @param {boolean=} bMarkAsRead
*/
RemoteUserAjax.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
RemoteUserAjax.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning, bMarkAsRead)
{
this.defaultRequest(fCallback, 'MessageMove', {
'FromFolder': sFolder,
'ToFolder': sToFolder,
'Uids': aUids.join(','),
'MarkAsRead': bMarkAsRead ? '1' : '0',
'Learning': sLearning || ''
}, null, '', ['MessageList']);
};

View file

@ -328,6 +328,8 @@
self = this,
iUnseenCount = 0,
oMessage = null,
sTrashFolder = FolderStore.trashFolder(),
sSpamFolder = FolderStore.spamFolder(),
aMessageList = this.messageList(),
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
@ -359,6 +361,11 @@
if (oToFolder)
{
if (sTrashFolder === oToFolder.fullNameRaw || sSpamFolder === oToFolder.fullNameRaw)
{
iUnseenCount = 0;
}
oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length);
if (0 < iUnseenCount)
{

View file

@ -239,7 +239,6 @@ html.cssanimations {
.e-spinner .bounce2 {
animation-delay: -0.16s;
}
}
@keyframes bouncedelay {