Momentor (moment optimization)

This commit is contained in:
RainLoop Team 2015-03-07 04:32:06 +04:00
parent 7750587be1
commit 147dce6e4a
20 changed files with 331 additions and 173 deletions

View file

@ -6,7 +6,6 @@
var
_ = require('_'),
ko = require('ko'),
moment = require('moment'),
Utils = require('Common/Utils'),
@ -66,6 +65,7 @@
AdvancedSearchPopupView.prototype.buildSearchString = function ()
{
var
oM = null,
aResult = [],
sFrom = Utils.trim(this.from()),
sTo = Utils.trim(this.to()),
@ -117,7 +117,7 @@
if (-1 < this.selectedDateValue())
{
aResult.push('date:' + moment().subtract('days', this.selectedDateValue()).format('YYYY.MM.DD') + '/');
aResult.push('date:' + require('Common/Momentor').searchSubtractFormatDateHelper(this.selectedDateValue()) + '/');
}
if (sText && '' !== sText)

View file

@ -8,7 +8,6 @@
_ = require('_'),
$ = require('$'),
ko = require('ko'),
moment = require('moment'),
JSON = require('JSON'),
Jua = require('Jua'),
@ -19,7 +18,9 @@
Events = require('Common/Events'),
Links = require('Common/Links'),
HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
Momentor = require('Common/Momentor'),
Cache = require('Common/Cache'),
@ -716,7 +717,7 @@
this.savedOrSendingText(
0 < this.savedTime() ? Translator.i18n('COMPOSE/SAVED_TIME', {
'TIME': moment.unix(this.savedTime() - 1).format('LT')
'TIME': Momentor.format(this.savedTime() - 1, 'LT')
}) : ''
);
@ -806,12 +807,12 @@
if (-1 < sSignature.indexOf('{{DATE}}'))
{
sSignature = sSignature.replace(/{{DATE}}/g, moment().format('llll'));
sSignature = sSignature.replace(/{{DATE}}/g, Momentor.format(0, 'llll'));
}
if (-1 < sSignature.indexOf('{{TIME}}'))
{
sSignature = sSignature.replace(/{{TIME}}/g, moment().format('LT'));
sSignature = sSignature.replace(/{{TIME}}/g, Momentor.format(0, 'LT'));
}
if (-1 < sSignature.indexOf('{{MOMENT:'))
{
@ -834,7 +835,8 @@
if (aMoments && 0 < aMoments.length)
{
_.each(aMoments, function (aData) {
sSignature = sSignature.replace(aData[0], moment().format(aData[1]));
sSignature = sSignature.replace(
aData[0], Momentor.format(0, aData[1]));
});
}
@ -1031,7 +1033,7 @@
if ('' !== sComposeType && oMessage)
{
sDate = oMessage.fullFormatDateValue();
sDate = Momentor.format(oMessage.dateTimeStampInUTC(), 'FULL');
sSubject = oMessage.subject();
aDraftInfo = oMessage.aDraftInfo;