mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
Update reply subject function
This commit is contained in:
parent
5a762f5066
commit
2390a4f575
8 changed files with 438 additions and 183 deletions
|
@ -439,22 +439,106 @@ Utils.removeSelection = function ()
|
|||
*/
|
||||
Utils.replySubjectAdd = function (sPrefix, sSubject)
|
||||
{
|
||||
sPrefix = Utils.trim(sPrefix.toUpperCase());
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
var
|
||||
oMatch = null,
|
||||
sResult = Utils.trim(sSubject)
|
||||
iIndex = 0,
|
||||
sResult = '',
|
||||
bDrop = false,
|
||||
sTrimmedPart = '',
|
||||
aSubject = [],
|
||||
aParts = [],
|
||||
bRe = 'RE' === sPrefix,
|
||||
bFwd = 'FWD' === sPrefix,
|
||||
bPrefixIsRe = !bFwd
|
||||
;
|
||||
|
||||
if (null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]) ||
|
||||
null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?[\\[\\(][\\d]+[\\]\\)][\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]))
|
||||
if ('' !== sSubject)
|
||||
{
|
||||
sResult = sPrefix + ': ' + Utils.trim(oMatch[1]);
|
||||
bDrop = false;
|
||||
|
||||
aParts = sSubject.split(':');
|
||||
for (iIndex = 0; iIndex < aParts.length; iIndex++)
|
||||
{
|
||||
sTrimmedPart = Utils.trim(aParts[iIndex]);
|
||||
if (!bDrop &&
|
||||
(/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart))
|
||||
)
|
||||
{
|
||||
if (!bRe)
|
||||
{
|
||||
bRe = !!(/^RE/i.test(sTrimmedPart));
|
||||
}
|
||||
|
||||
if (!bFwd)
|
||||
{
|
||||
bFwd = !!(/^FWD/i.test(sTrimmedPart));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aSubject.push(aParts[iIndex]);
|
||||
bDrop = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < aSubject.length)
|
||||
{
|
||||
sResult = Utils.trim(aSubject.join(':'));
|
||||
}
|
||||
}
|
||||
|
||||
if (bPrefixIsRe)
|
||||
{
|
||||
bRe = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult = sPrefix + ': ' + sSubject;
|
||||
bFwd = false;
|
||||
}
|
||||
|
||||
return sResult.replace(/[\s]+/g, ' ');
|
||||
return Utils.trim(
|
||||
(bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
|
||||
(bRe ? 'Re: ' : '') +
|
||||
(bFwd ? 'Fwd: ' : '') +
|
||||
sResult
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
{
|
||||
var
|
||||
iLimit = 30,
|
||||
mReg = /^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/ig,
|
||||
oMatch = null
|
||||
;
|
||||
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
do
|
||||
{
|
||||
iLimit--;
|
||||
|
||||
oMatch = mReg.exec(sSubject);
|
||||
if (!oMatch || Utils.isUnd(oMatch[0]))
|
||||
{
|
||||
oMatch = null;
|
||||
}
|
||||
|
||||
if (oMatch)
|
||||
{
|
||||
sSubject = sSubject.replace(mReg, 'Re:');
|
||||
}
|
||||
}
|
||||
while (oMatch || 0 < iLimit);
|
||||
|
||||
return sSubject.replace(/[\s]+/, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -492,10 +576,11 @@ Utils._replySubjectAdd_ = function (sPrefix, sSubject, bFixLongSubject)
|
|||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
Utils._fixLongSubject_ = function (sSubject)
|
||||
{
|
||||
var
|
||||
iCounter = 0,
|
||||
|
|
|
@ -6954,14 +6954,14 @@ class Actions
|
|||
$aResult = array('', '');
|
||||
if (0 < \strlen($sSubject))
|
||||
{
|
||||
$sDrop = false;
|
||||
$bDrop = false;
|
||||
$aPrefix = array();
|
||||
$aSuffix = array();
|
||||
|
||||
$aParts = \explode(':', $sSubject);
|
||||
foreach ($aParts as $sPart)
|
||||
{
|
||||
if (!$sDrop &&
|
||||
if (!$bDrop &&
|
||||
(\preg_match('/^(RE|FWD)$/i', \trim($sPart)) || \preg_match('/^(RE|FWD)[\[\(][\d]+[\]\)]$/i', \trim($sPart))))
|
||||
{
|
||||
$aPrefix[] = $sPart;
|
||||
|
@ -6969,7 +6969,7 @@ class Actions
|
|||
else
|
||||
{
|
||||
$aSuffix[] = $sPart;
|
||||
$sDrop = true;
|
||||
$bDrop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1236,22 +1236,106 @@ Utils.removeSelection = function ()
|
|||
*/
|
||||
Utils.replySubjectAdd = function (sPrefix, sSubject)
|
||||
{
|
||||
sPrefix = Utils.trim(sPrefix.toUpperCase());
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
var
|
||||
oMatch = null,
|
||||
sResult = Utils.trim(sSubject)
|
||||
iIndex = 0,
|
||||
sResult = '',
|
||||
bDrop = false,
|
||||
sTrimmedPart = '',
|
||||
aSubject = [],
|
||||
aParts = [],
|
||||
bRe = 'RE' === sPrefix,
|
||||
bFwd = 'FWD' === sPrefix,
|
||||
bPrefixIsRe = !bFwd
|
||||
;
|
||||
|
||||
if (null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]) ||
|
||||
null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?[\\[\\(][\\d]+[\\]\\)][\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]))
|
||||
if ('' !== sSubject)
|
||||
{
|
||||
sResult = sPrefix + ': ' + Utils.trim(oMatch[1]);
|
||||
bDrop = false;
|
||||
|
||||
aParts = sSubject.split(':');
|
||||
for (iIndex = 0; iIndex < aParts.length; iIndex++)
|
||||
{
|
||||
sTrimmedPart = Utils.trim(aParts[iIndex]);
|
||||
if (!bDrop &&
|
||||
(/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart))
|
||||
)
|
||||
{
|
||||
if (!bRe)
|
||||
{
|
||||
bRe = !!(/^RE/i.test(sTrimmedPart));
|
||||
}
|
||||
|
||||
if (!bFwd)
|
||||
{
|
||||
bFwd = !!(/^FWD/i.test(sTrimmedPart));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aSubject.push(aParts[iIndex]);
|
||||
bDrop = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < aSubject.length)
|
||||
{
|
||||
sResult = Utils.trim(aSubject.join(':'));
|
||||
}
|
||||
}
|
||||
|
||||
if (bPrefixIsRe)
|
||||
{
|
||||
bRe = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult = sPrefix + ': ' + sSubject;
|
||||
bFwd = false;
|
||||
}
|
||||
|
||||
return sResult.replace(/[\s]+/g, ' ');
|
||||
return Utils.trim(
|
||||
(bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
|
||||
(bRe ? 'Re: ' : '') +
|
||||
(bFwd ? 'Fwd: ' : '') +
|
||||
sResult
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
{
|
||||
var
|
||||
iLimit = 30,
|
||||
mReg = /^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/ig,
|
||||
oMatch = null
|
||||
;
|
||||
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
do
|
||||
{
|
||||
iLimit--;
|
||||
|
||||
oMatch = mReg.exec(sSubject);
|
||||
if (!oMatch || Utils.isUnd(oMatch[0]))
|
||||
{
|
||||
oMatch = null;
|
||||
}
|
||||
|
||||
if (oMatch)
|
||||
{
|
||||
sSubject = sSubject.replace(mReg, 'Re:');
|
||||
}
|
||||
}
|
||||
while (oMatch || 0 < iLimit);
|
||||
|
||||
return sSubject.replace(/[\s]+/, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1289,10 +1373,11 @@ Utils._replySubjectAdd_ = function (sPrefix, sSubject, bFixLongSubject)
|
|||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
Utils._fixLongSubject_ = function (sSubject)
|
||||
{
|
||||
var
|
||||
iCounter = 0,
|
||||
|
|
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1239,22 +1239,106 @@ Utils.removeSelection = function ()
|
|||
*/
|
||||
Utils.replySubjectAdd = function (sPrefix, sSubject)
|
||||
{
|
||||
sPrefix = Utils.trim(sPrefix.toUpperCase());
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
var
|
||||
oMatch = null,
|
||||
sResult = Utils.trim(sSubject)
|
||||
iIndex = 0,
|
||||
sResult = '',
|
||||
bDrop = false,
|
||||
sTrimmedPart = '',
|
||||
aSubject = [],
|
||||
aParts = [],
|
||||
bRe = 'RE' === sPrefix,
|
||||
bFwd = 'FWD' === sPrefix,
|
||||
bPrefixIsRe = !bFwd
|
||||
;
|
||||
|
||||
if (null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]) ||
|
||||
null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?[\\[\\(][\\d]+[\\]\\)][\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]))
|
||||
if ('' !== sSubject)
|
||||
{
|
||||
sResult = sPrefix + ': ' + Utils.trim(oMatch[1]);
|
||||
bDrop = false;
|
||||
|
||||
aParts = sSubject.split(':');
|
||||
for (iIndex = 0; iIndex < aParts.length; iIndex++)
|
||||
{
|
||||
sTrimmedPart = Utils.trim(aParts[iIndex]);
|
||||
if (!bDrop &&
|
||||
(/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart))
|
||||
)
|
||||
{
|
||||
if (!bRe)
|
||||
{
|
||||
bRe = !!(/^RE/i.test(sTrimmedPart));
|
||||
}
|
||||
|
||||
if (!bFwd)
|
||||
{
|
||||
bFwd = !!(/^FWD/i.test(sTrimmedPart));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aSubject.push(aParts[iIndex]);
|
||||
bDrop = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < aSubject.length)
|
||||
{
|
||||
sResult = Utils.trim(aSubject.join(':'));
|
||||
}
|
||||
}
|
||||
|
||||
if (bPrefixIsRe)
|
||||
{
|
||||
bRe = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult = sPrefix + ': ' + sSubject;
|
||||
bFwd = false;
|
||||
}
|
||||
|
||||
return sResult.replace(/[\s]+/g, ' ');
|
||||
return Utils.trim(
|
||||
(bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
|
||||
(bRe ? 'Re: ' : '') +
|
||||
(bFwd ? 'Fwd: ' : '') +
|
||||
sResult
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
{
|
||||
var
|
||||
iLimit = 30,
|
||||
mReg = /^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/ig,
|
||||
oMatch = null
|
||||
;
|
||||
|
||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/, ' '));
|
||||
|
||||
do
|
||||
{
|
||||
iLimit--;
|
||||
|
||||
oMatch = mReg.exec(sSubject);
|
||||
if (!oMatch || Utils.isUnd(oMatch[0]))
|
||||
{
|
||||
oMatch = null;
|
||||
}
|
||||
|
||||
if (oMatch)
|
||||
{
|
||||
sSubject = sSubject.replace(mReg, 'Re:');
|
||||
}
|
||||
}
|
||||
while (oMatch || 0 < iLimit);
|
||||
|
||||
return sSubject.replace(/[\s]+/, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1292,10 +1376,11 @@ Utils._replySubjectAdd_ = function (sPrefix, sSubject, bFixLongSubject)
|
|||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param {string} sSubject
|
||||
* @return {string}
|
||||
*/
|
||||
Utils.fixLongSubject = function (sSubject)
|
||||
Utils._fixLongSubject_ = function (sSubject)
|
||||
{
|
||||
var
|
||||
iCounter = 0,
|
||||
|
|
14
rainloop/v/0.0.0/static/js/app.min.js
vendored
14
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue