$.proxy is deprecated

$.trim is deprecated
This commit is contained in:
djmaze 2020-08-06 18:24:46 +02:00
parent ae1b7610fd
commit bbd9f49dcd
39 changed files with 153 additions and 173 deletions

View file

@ -2,7 +2,6 @@ import window from 'window';
import { bMobileDevice, bSafari } from 'Common/Globals';
import * as Links from 'Common/Links';
import * as Events from 'Common/Events';
import { trim } from 'Common/Utils';
class Audio {
notificator = null;
@ -76,9 +75,9 @@ class Audio {
}
clearName(name = '', ext = '') {
name = trim(name);
name = name.trim();
if (ext && '.' + ext === name.toLowerCase().substr((ext.length + 1) * -1)) {
name = trim(name.substr(0, name.length - 4));
name = name.substr(0, name.length - 4).trim();
}
return name || 'audio';

View file

@ -1,5 +1,5 @@
import { MessageSetAction } from 'Common/Enums';
import { trim, pInt } from 'Common/Utils';
import { pInt } from 'Common/Utils';
let FOLDERS_CACHE = {},
FOLDERS_NAME_CACHE = {},
@ -28,8 +28,7 @@ export function clear() {
* @returns {string}
*/
export function getUserPic(email, callback) {
email = trim(email);
callback('', email);
callback('', email.trim());
}
/**

View file

@ -1,5 +1,5 @@
import window from 'window';
import { pString, pInt, isNormal, trim } from 'Common/Utils';
import { pString, pInt, isNormal } from 'Common/Utils';
import * as Settings from 'Storage/Settings';
const ROOT = './',
@ -306,7 +306,7 @@ export function openPgpWorkerPath() {
export function themePreviewLink(theme) {
let prefix = VERSION_PREFIX;
if ('@custom' === theme.substr(-7)) {
theme = trim(theme.substring(0, theme.length - 7));
theme = theme.substring(0, theme.length - 7).trim();
prefix = WEB_PREFIX;
}

View file

@ -7,7 +7,6 @@ import { $win, $div, $hcont, dropdownVisibility, data as GlobalsData } from 'Com
import { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
import { Mime } from 'Common/Mime';
const trim = $.trim;
const isArray = Array.isArray;
const decodeURIComponent = component => window.decodeURIComponent(component);
@ -23,8 +22,6 @@ var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
};
})(/&/g,/&(?![\w#]+;)/gi,/</g,/>/g,/'/g,/"/g,/`/g);
export { trim };
/**
* @param {*} value
* @returns {boolean}
@ -223,8 +220,8 @@ export function removeSelection() {
* @returns {string}
*/
export function replySubjectAdd(prefix, subject) {
prefix = trim(prefix.toUpperCase());
subject = trim(subject.replace(/[\s]+/g, ' '));
prefix = prefix.toUpperCase().trim();
subject = subject.replace(/[\s]+/g, ' ').trim();
let drop = false,
re = 'RE' === prefix,
@ -235,7 +232,7 @@ export function replySubjectAdd(prefix, subject) {
if (subject) {
subject.split(':').forEach(part => {
const trimmedPart = trim(part);
const trimmedPart = part.trim();
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[[(][\d]+[\])]$/i.test(trimmedPart))) {
if (!re) {
re = !!/^RE/i.test(trimmedPart);
@ -257,7 +254,7 @@ export function replySubjectAdd(prefix, subject) {
fwd = false;
}
return trim((prefixIsRe ? 'Re: ' : 'Fwd: ') + (re ? 'Re: ' : '') + (fwd ? 'Fwd: ' : '') + trim(parts.join(':')));
return ((prefixIsRe ? 'Re: ' : 'Fwd: ') + (re ? 'Re: ' : '') + (fwd ? 'Fwd: ' : '') + parts.join(':').trim()).trim();
}
/**
@ -353,15 +350,14 @@ export function createCommandLegacy(context, fExecute, fCanExecute = true) {
*/
export const convertThemeName = theme => {
if ('@custom' === theme.substr(-7)) {
theme = trim(theme.substring(0, theme.length - 7));
theme = theme.substring(0, theme.length - 7).trim();
}
return trim(
theme
return theme
.replace(/[^a-zA-Z0-9]+/g, ' ')
.replace(/([A-Z])/g, ' $1')
.replace(/\s+/g, ' ')
);
.trim();
};
/**
@ -513,7 +509,7 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
value = pInt(value);
break;
case 'trim':
value = trim(value);
value = value.trim();
break;
default:
value = pString(value);
@ -566,18 +562,18 @@ export function htmlToPlain(html) {
text = '';
const convertBlockquote = (blockquoteText) => {
blockquoteText = '> ' + trim(blockquoteText).replace(/\n/gm, '\n> ');
blockquoteText = '> ' + blockquoteText.trim().replace(/\n/gm, '\n> ');
return blockquoteText.replace(/(^|\n)([> ]+)/gm, (...args) =>
args && 2 < args.length ? args[1] + trim(args[2].replace(/[\s]/g, '')) + ' ' : ''
args && 2 < args.length ? args[1] + args[2].replace(/[\s]/g, '').trim() + ' ' : ''
);
};
const convertDivs = (...args) => {
if (args && 1 < args.length) {
let divText = trim(args[1]);
let divText = args[1].trim();
if (divText.length) {
divText = divText.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim, convertDivs);
divText = '\n' + trim(divText) + '\n';
divText = '\n' + divText.trim() + '\n';
}
return divText;
@ -594,7 +590,7 @@ export function htmlToPlain(html) {
.replace(/[\r]/gm, '')
: '',
fixAttibuteValue = (...args) => (args && 1 < args.length ? '' + args[1] + htmlspecialchars(args[2]) : ''),
convertLinks = (...args) => (args && 1 < args.length ? trim(args[1]) : '');
convertLinks = (...args) => (args && 1 < args.length ? args[1].trim() : '');
text = html
.replace(/<p[^>]*><\/p>/gi, '')
@ -1124,7 +1120,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount) {
* @returns {string}
*/
export function getFileExtension(fileName) {
fileName = trim(fileName).toLowerCase();
fileName = fileName.toLowerCase().trim();
const result = fileName.split('.').pop();
return result === fileName ? '' : result;
@ -1138,7 +1134,7 @@ export function mimeContentType(fileName) {
let ext = '',
result = 'application/octet-stream';
fileName = trim(fileName).toLowerCase();
fileName = fileName.toLowerCase().trim();
if ('winmail.dat' === fileName) {
return 'application/ms-tnef';

View file

@ -1,5 +1,5 @@
import ko from 'ko';
import { trim, pInt } from 'Common/Utils';
import { pInt } from 'Common/Utils';
import { SaveSettingsStep } from 'Common/Enums';
import { AbstractComponent } from 'Component/Abstract';
@ -26,7 +26,7 @@ class AbstractInput extends AbstractComponent {
this.className = ko.computed(() => {
const size = ko.unwrap(this.size),
suffixValue = this.trigger ? ' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : '';
suffixValue = this.trigger ? ' ' + ('settings-saved-trigger-input ' + this.classForTrigger()).trim() : '';
return (0 < size ? 'span' + size : '') + suffixValue;
});

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { FileType } from 'Common/Enums';
import { bMobileDevice } from 'Common/Globals';
import { trim, pInt, isNonEmptyArray, getFileExtension, friendlySize } from 'Common/Utils';
import { pInt, isNonEmptyArray, getFileExtension, friendlySize } from 'Common/Utils';
import {
attachmentDownload,
attachmentPreview,
@ -26,8 +26,8 @@ const bAllowPdfPreview = !bMobileDevice && undefined !== window.navigator.mimeTy
export const staticFileType = (() => {
let cache = {};
return (ext, mimeType) => {
ext = trim(ext).toLowerCase();
mimeType = trim(mimeType).toLowerCase();
ext = ext.toLowerCase().trim();
mimeType = mimeType.toLowerCase().trim();
let key = ext + mimeType;
if (cache[key]) {
@ -237,8 +237,8 @@ class AttachmentModel extends AbstractModel {
initByJson(json) {
let bResult = false;
if (json && 'Object/Attachment' === json['@Object']) {
this.mimeType = trim((json.MimeType || '').toLowerCase());
this.fileName = trim(json.FileName);
this.mimeType = ((json.MimeType || '').toLowerCase()).trim();
this.fileName = json.FileName.trim();
this.estimatedSize = pInt(json.EstimatedSize);
this.isInline = !!json.IsInline;
this.isLinked = !!json.IsLinked;

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { ContactPropertyType } from 'Common/Enums';
import { trim, isNonEmptyArray, isNormal, pInt, pString } from 'Common/Utils';
import { isNonEmptyArray, isNormal, pInt, pString } from 'Common/Utils';
import { emptyContactPic } from 'Common/Links';
import { AbstractModel } from 'Knoin/AbstractModel';
@ -32,9 +32,9 @@ class ContactModel extends AbstractModel {
this.properties.forEach(property => {
if (property) {
if (ContactPropertyType.FirstName === property[0]) {
name = trim(property[1] + ' ' + name);
name = (property[1] + ' ' + name).trim();
} else if (ContactPropertyType.LastName === property[0]) {
name = trim(name + ' ' + property[1]);
name = (name + ' ' + property[1]).trim();
} else if (!email && ContactPropertyType.Email === property[0]) {
email = property[1];
}

View file

@ -1,5 +1,5 @@
import addressparser from 'emailjs-addressparser';
import { trim, encodeHtml, isNonEmptyArray } from 'Common/Utils';
import { encodeHtml, isNonEmptyArray } from 'Common/Utils';
class EmailModel {
email = '';
@ -82,10 +82,10 @@ class EmailModel {
initByJson(json) {
let result = false;
if (json && 'Object/Email' === json['@Object']) {
this.name = trim(json.Name);
this.email = trim(json.Email);
this.dkimStatus = trim(json.DkimStatus || '');
this.dkimValue = trim(json.DkimValue || '');
this.name = json.Name.trim();
this.email = json.Email.trim();
this.dkimStatus = (json.DkimStatus || '').trim();
this.dkimValue = (json.DkimValue || '').trim();
result = !!this.email;
this.clearDuplicateName();
@ -196,7 +196,7 @@ class EmailModel {
* @returns {boolean}
*/
parse(emailAddress) {
emailAddress = trim(emailAddress);
emailAddress = emailAddress.trim();
if (!emailAddress) {
return false;
}

View file

@ -8,7 +8,6 @@ import { i18n } from 'Common/Translator';
import {
pInt,
trim,
previewMessage,
windowResize,
friendlySize,
@ -743,7 +742,7 @@ class MessageModel extends AbstractModel {
attr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
$('[' + attr + ']', this.body).each(function() {
const $this = $(this); // eslint-disable-line no-invalid-this
let style = trim($this.attr('style'));
let style = $this.attr('style').trim();
style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + $this.attr(attr));
});
@ -792,7 +791,7 @@ class MessageModel extends AbstractModel {
if (attachment && attachment.linkPreview) {
name = $this.attr('data-x-style-cid-name');
if (name) {
style = trim($this.attr('style'));
style = $this.attr('style').trim();
style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + name + ": url('" + attachment.linkPreview() + "')");
}

View file

@ -1,4 +1,4 @@
import { pString, pInt, trim } from 'Common/Utils';
import { pString, pInt } from 'Common/Utils';
import {
CONTACTS_SYNC_AJAX_TIMEOUT,
@ -855,7 +855,7 @@ class RemoteUserAjax extends AbstractAjaxRemote {
contactSave(fCallback, sRequestUid, sUid, aProperties) {
this.defaultRequest(fCallback, 'ContactSave', {
'RequestUid': sRequestUid,
'Uid': trim(sUid),
'Uid': sUid.trim(),
'Properties': aProperties
});
}

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import Remote from 'Remote/Admin/Ajax';
@ -47,19 +47,19 @@ class BrandingAdminSettings {
this.title.subscribe((value) => {
Remote.saveAdminConfig(f1, {
'Title': trim(value)
'Title': value.trim()
});
});
this.loadingDesc.subscribe((value) => {
Remote.saveAdminConfig(f2, {
'LoadingDescription': trim(value)
'LoadingDescription': value.trim()
});
});
this.faviconUrl.subscribe((value) => {
Remote.saveAdminConfig(f3, {
'FaviconUrl': trim(value)
'FaviconUrl': value.trim()
});
});
}, Magics.Time50ms);

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, trim } from 'Common/Utils';
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender } from 'Common/Utils';
import { SaveSettingsStep, StorageResultType, Magics } from 'Common/Enums';
import { i18n } from 'Common/Translator';
@ -163,25 +163,25 @@ class ContactsAdminSettings {
this.contactsType.subscribe((value) => {
Remote.saveAdminConfig(f5, {
'ContactsPdoType': trim(value)
'ContactsPdoType': value.trim()
});
});
this.pdoDsn.subscribe((value) => {
Remote.saveAdminConfig(f1, {
'ContactsPdoDsn': trim(value)
'ContactsPdoDsn': value.trim()
});
});
this.pdoUser.subscribe((value) => {
Remote.saveAdminConfig(f3, {
'ContactsPdoUser': trim(value)
'ContactsPdoUser': value.trim()
});
});
this.pdoPassword.subscribe((value) => {
Remote.saveAdminConfig(f4, {
'ContactsPdoPassword': trim(value)
'ContactsPdoPassword': value.trim()
});
});

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import {
trim,
pInt,
settingsSaveHelperSimpleFunction,
changeTheme,
@ -91,7 +90,7 @@ class GeneralAdminSettings {
this.language.subscribe((value) => {
Remote.saveAdminConfig(f2, {
'Language': trim(value)
'Language': value.trim()
});
});
@ -101,7 +100,7 @@ class GeneralAdminSettings {
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
.then(() => {
Remote.saveAdminConfig(null, {
'LanguageAdmin': trim(value)
'LanguageAdmin': value.trim()
});
});
});
@ -109,7 +108,7 @@ class GeneralAdminSettings {
this.theme.subscribe((value) => {
changeTheme(value, this.themeTrigger);
Remote.saveAdminConfig(f3, {
'Theme': trim(value)
'Theme': value.trim()
});
});

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { settingsGet } from 'Storage/Settings';
import AppStore from 'Stores/Admin/App';
@ -42,7 +42,7 @@ class LoginAdminSettings {
this.defaultDomain.subscribe((value) => {
Remote.saveAdminConfig(f1, {
'LoginDefaultDomain': trim(value)
'LoginDefaultDomain': value.trim()
});
});
}, 50);

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { trim } from 'Common/Utils';
import { StorageResultType, Magics } from 'Common/Enums';
import { settingsGet } from 'Storage/Settings';
@ -76,9 +75,9 @@ class SecurityAdminSettings {
this.onNewAdminPasswordResponse = this.onNewAdminPasswordResponse.bind(this);
}
@command((self) => trim(self.adminLogin()) && self.adminPassword())
@command((self) => self.adminLogin().trim() && self.adminPassword())
saveNewAdminPasswordCommand() {
if (!trim(this.adminLogin())) {
if (!this.adminLogin().trim()) {
this.adminLoginError(true);
return false;
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { windowResizeCallback, trim, delegateRunOnDestroy } from 'Common/Utils';
import { windowResizeCallback, delegateRunOnDestroy } from 'Common/Utils';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
@ -61,7 +61,7 @@ class FiltersUserSettings {
@command((self) => self.haveChanges())
saveChangesCommand() {
if (!this.filters.saving()) {
if (this.filterRaw.active() && !trim(this.filterRaw())) {
if (this.filterRaw.active() && !this.filterRaw().trim()) {
this.filterRaw.error(true);
return false;
}

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { ClientSideKeyName, Notification, Magics } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { getNotification, i18n } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache';
@ -42,7 +41,7 @@ class FoldersUserSettings {
}
folderEditOnEnter(folder) {
const nameToEdit = folder ? trim(folder.nameForEdit()) : '';
const nameToEdit = folder ? folder.nameForEdit().trim() : '';
if (nameToEdit && folder.name() !== nameToEdit) {
Local.set(ClientSideKeyName.FoldersLashHash, '');

View file

@ -5,7 +5,6 @@ import $ from '$';
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
import {
trim,
isNormal,
pInt,
pString,
@ -135,7 +134,7 @@ class MessageUserStore {
read: this.messageListSearch,
write: (value) => {
setHash(
mailBox(FolderStore.currentFolderFullNameHash(), 1, trim(value.toString()), this.messageListThreadUid())
mailBox(FolderStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.messageListThreadUid())
);
}
});
@ -458,7 +457,7 @@ class MessageUserStore {
h = getRealHeight($this);
}
if (trim($this.text()) && (0 === h || 100 < h)) {
if ($this.text().trim() && (0 === h || 100 < h)) {
$this.addClass('rl-bq-switcher hidden-bq');
$('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>')
.insertBefore($this)

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import $ from '$';
import { i18n } from 'Common/Translator';
import { log, isNonEmptyArray, pString, trim } from 'Common/Utils';
import { log, isNonEmptyArray, pString } from 'Common/Utils';
import AccountStore from 'Stores/User/Account';
@ -232,7 +232,7 @@ class PgpUserStore {
}
if (undefined !== text) {
dom.text(trim(text));
dom.text(text.trim());
}
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { trim, triggerAutocompleteInputChange } from 'Common/Utils';
import { triggerAutocompleteInputChange } from 'Common/Utils';
import { StorageResultType, Notification, Magics } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
@ -65,8 +65,8 @@ class LoginAdminView extends AbstractViewNext {
this.loginError(false);
this.passwordError(false);
this.loginError(!trim(this.login()));
this.passwordError(!trim(this.password()));
this.loginError(!this.login().trim());
this.passwordError(!this.password().trim());
if (this.loginError() || this.passwordError()) {
return false;

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
@ -44,8 +43,8 @@ class AccountPopupView extends AbstractViewNext {
@command((self) => !self.submitRequest())
addAccountCommand() {
this.emailError(!trim(this.email()));
this.passwordError(!trim(this.password()));
this.emailError(!this.email().trim());
this.passwordError(!this.password().trim());
if (this.emailError() || this.passwordError()) {
return false;

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
import { i18n, getNotification } from 'Common/Translator';
@ -112,7 +111,7 @@ class ActivatePopupView extends AbstractViewNext {
return (
!value ||
RAINLOOP_TRIAL_KEY === value ||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(trim(value).replace(/[^A-Z0-9-]/gi, ''))
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(value.trim().replace(/[^A-Z0-9-]/gi, ''))
);
}
}

View file

@ -1,5 +1,5 @@
import ko from 'ko';
import { trim, delegateRun, log } from 'Common/Utils';
import { delegateRun, log } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -33,7 +33,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
const reg = /[-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}[\s\S]+?[-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}/gi,
openpgpKeyring = PgpStore.openpgpKeyring;
let keyTrimmed = trim(this.key());
let keyTrimmed = this.key().trim();
if (/[\n]/.test(keyTrimmed)) {
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { trim } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import MessageStore from 'Stores/User/Message';
@ -79,10 +78,10 @@ class AdvancedSearchPopupView extends AbstractViewNext {
buildSearchString() {
const result = [],
from_ = trim(this.from()),
to = trim(this.to()),
subject = trim(this.subject()),
text = trim(this.text()),
from_ = this.from().trim(),
to = this.to().trim(),
subject = this.subject().trim(),
text = this.text().trim(),
isPart = [],
hasPart = [];
@ -128,7 +127,7 @@ class AdvancedSearchPopupView extends AbstractViewNext {
result.push('text:' + this.buildSearchStringValue(text));
}
return trim(result.join(' '));
return result.join(' ').trim();
}
clearPopup() {

View file

@ -16,7 +16,6 @@ import {
} from 'Common/Enums';
import {
trim,
isNormal,
delegateRun,
isNonEmptyArray,
@ -68,11 +67,11 @@ class ComposePopupView extends AbstractViewNext {
const fEmailOutInHelper = (context, identity, name, isIn) => {
if (identity && context && identity[name]() && (isIn ? true : context[name]())) {
const identityEmail = identity[name]();
let list = trim(context[name]()).split(/[,]/);
let list = context[name]().trim().split(/[,]/);
list = list.filter(email => {
email = trim(email);
return email && trim(identityEmail) !== email;
email = email.trim();
return email && identityEmail.trim() !== email;
});
if (isIn) {
@ -343,9 +342,9 @@ class ComposePopupView extends AbstractViewNext {
@command((self) => self.canBeSentOrSaved())
sendCommand() {
const sTo = trim(this.to()),
sCc = trim(this.cc()),
sBcc = trim(this.bcc());
const sTo = this.to().trim(),
sCc = this.cc().trim(),
sBcc = this.bcc().trim();
let sSentFolder = FolderStore.sentFolder();
this.attachmentsInProcessError(false);
@ -638,7 +637,7 @@ class ComposePopupView extends AbstractViewNext {
if (this.modalVisibility() && !result) {
if (data && Notification.CantSaveMessage === data.ErrorCode) {
this.sendSuccessButSaveError(true);
this.savedErrorDesc(trim(i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
this.savedErrorDesc(i18n('COMPOSE/SAVED_ERROR_ON_SEND').trim());
} else {
message = getNotification(
data && data.ErrorCode ? data.ErrorCode : Notification.CantSendMessage,
@ -858,11 +857,11 @@ class ComposePopupView extends AbstractViewNext {
*/
addEmailsTo(fKoValue, emails) {
if (isNonEmptyArray(emails)) {
const value = trim(fKoValue()),
const value = fKoValue().trim(),
values = emails.map(item => item ? item.toLine(false) : null)
.filter((value, index, self) => !!value && self.indexOf(value) == index);
fKoValue(value + (value ? ', ' : '') + trim(values.join(', ')));
fKoValue(value + (value ? ', ' : '') + values.join(', ').trim());
}
}
@ -962,7 +961,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['reply', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.ReplyAll:
@ -973,7 +972,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['reply', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.references());
this.sReferences = (this.sInReplyTo + ' ' + message.references()).trim();
break;
case ComposeType.Forward:
@ -981,7 +980,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['forward', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.ForwardAsAttachment:
@ -989,7 +988,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['forward', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.Draft:
@ -1036,7 +1035,7 @@ class ComposePopupView extends AbstractViewNext {
'EMAIL': sFrom
});
sText = '<br /><br />' + sReplyTitle + ':' + '<br /><br />' + '<blockquote>' + trim(sText) + '</blockquote>';
sText = '<br /><br />' + sReplyTitle + ':' + '<br /><br />' + '<blockquote>' + sText.trim() + '</blockquote>';
break;
@ -1065,7 +1064,7 @@ class ComposePopupView extends AbstractViewNext {
': ' +
encodeHtml(sSubject) +
'<br /><br />' +
trim(sText) +
sText.trim() +
'<br /><br />';
break;

View file

@ -2,7 +2,7 @@ import $ from '$';
import ko from 'ko';
import key from 'key';
import { pString, log, trim, defautOptionsAfterRender } from 'Common/Utils';
import { pString, log, defautOptionsAfterRender } from 'Common/Utils';
import { Magics, KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';
@ -360,7 +360,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
rec = rec.join(', ').split(',');
rec = rec.map(value => {
email.clear();
email.parse(trim(value));
email.parse(value.trim());
return email.email || false;
}).filter(value => !!value);

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums';
import { IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT } from 'Common/Consts';
import { bMobileDevice } from 'Common/Globals';
import { trim, pInt, pString } from 'Common/Utils';
import { pInt, pString } from 'Common/Utils';
import { i18n } from 'Common/Translator';
import CapaAdminStore from 'Stores/Admin/Capa';
@ -356,24 +356,24 @@ class DomainPopupView extends AbstractViewNext {
this.edit(true);
this.name(trim(oDomain.Name));
this.imapServer(trim(oDomain.IncHost));
this.name(oDomain.Name.trim());
this.imapServer(oDomain.IncHost.trim());
this.imapPort('' + pInt(oDomain.IncPort));
this.imapSecure(trim(oDomain.IncSecure));
this.imapSecure(oDomain.IncSecure.trim());
this.imapShortLogin(!!oDomain.IncShortLogin);
this.useSieve(!!oDomain.UseSieve);
this.sieveAllowRaw(!!oDomain.SieveAllowRaw);
this.sieveServer(trim(oDomain.SieveHost));
this.sieveServer(oDomain.SieveHost.trim());
this.sievePort('' + pInt(oDomain.SievePort));
this.sieveSecure(trim(oDomain.SieveSecure));
this.smtpServer(trim(oDomain.OutHost));
this.sieveSecure(oDomain.SieveSecure.trim());
this.smtpServer(oDomain.OutHost.trim());
this.smtpPort('' + pInt(oDomain.OutPort));
this.smtpSecure(trim(oDomain.OutSecure));
this.smtpSecure(oDomain.OutSecure.trim());
this.smtpShortLogin(!!oDomain.OutShortLogin);
this.smtpAuth(!!oDomain.OutAuth);
this.smtpPhpMail(!!oDomain.OutUsePhpMail);
this.whiteList(trim(oDomain.WhiteList));
this.aliasName(trim(oDomain.AliasName));
this.whiteList(oDomain.WhiteList.trim());
this.aliasName(oDomain.AliasName.trim());
this.enableSmartPorts(true);
}

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { Notification } from 'Common/Enums';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { bMobileDevice } from 'Common/Globals';
import { trim, defautOptionsAfterRender, folderListOptionsBuilder } from 'Common/Utils';
import { defautOptionsAfterRender, folderListOptionsBuilder } from 'Common/Utils';
import FolderStore from 'Stores/User/Folder';
@ -62,7 +62,7 @@ class FolderCreateView extends AbstractViewNext {
}
simpleFolderNameValidation(sName) {
return /^[^\\/]+$/g.test(trim(sName));
return /^[^\\/]+$/g.test(sName.trim());
}
clearPopup() {

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { bMobileDevice } from 'Common/Globals';
import { trim, fakeMd5 } from 'Common/Utils';
import { fakeMd5 } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
@ -62,7 +62,7 @@ class IdentityPopupView extends AbstractViewNext {
}
if (!this.email.hasError()) {
this.email.hasError(!trim(this.email()));
this.email.hasError(!this.email().trim());
}
if (this.email.hasError()) {

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { trim, log, delegateRun, pInt } from 'Common/Utils';
import { log, delegateRun, pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -39,7 +39,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
const userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
this.email.error(!trim(this.email()));
this.email.error(!this.email().trim());
if (!openpgpKeyring || this.email.error()) {
return false;
}
@ -58,7 +58,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
.generateKey({
userIds: [userId],
numBits: pInt(this.keyBitLength()),
passphrase: trim(this.password())
passphrase: this.password().trim()
})
.then((keyPair) => {
this.submitRequest(false);

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim, isNormal } from 'Common/Utils';
import { isNormal } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import { HtmlEditor } from 'Common/HtmlEditor';
@ -49,8 +49,8 @@ class TemplatePopupView extends AbstractViewNext {
addTemplateCommand() {
this.populateBodyFromEditor();
this.name.error(!trim(this.name()));
this.body.error(!trim(this.body()) || ':HTML:' === trim(this.body()));
this.name.error(!this.name().trim());
this.body.error(!this.body().trim() || ':HTML:' === this.body().trim());
if (this.name.error() || this.body.error()) {
return false;

View file

@ -6,7 +6,6 @@ import AccountStore from 'Stores/User/Account';
import MessageStore from 'Stores/User/Message';
import { Capa, Magics, KeyState } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { settings } from 'Common/Links';
import * as Events from 'Common/Events';
@ -21,8 +20,8 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
constructor() {
super();
this.logoImg = trim(Settings.settingsGet('UserLogo'));
this.logoTitle = trim(Settings.settingsGet('UserLogoTitle'));
this.logoImg = (Settings.settingsGet('UserLogo')||'').trim();
this.logoTitle = (Settings.settingsGet('UserLogoTitle')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');

View file

@ -9,7 +9,7 @@ import {
Notification
} from 'Common/Enums';
import { trim, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
import { convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
import { $win } from 'Common/Globals';
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
@ -53,8 +53,8 @@ class LoginUserView extends AbstractViewNext {
this.additionalCode.visibility = ko.observable(false);
this.additionalCodeSignMe = ko.observable(false);
this.logoImg = trim(Settings.settingsGet('LoginLogo'));
this.loginDescription = trim(Settings.settingsGet('LoginDescription'));
this.logoImg = (Settings.settingsGet('LoginLogo')||'').trim();
this.loginDescription = (Settings.settingsGet('LoginDescription')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
@ -154,12 +154,12 @@ class LoginUserView extends AbstractViewNext {
this.emailError(false);
this.passwordError(false);
this.emailError(!trim(this.email()));
this.passwordError(!trim(this.password()));
this.emailError(!this.email().trim());
this.passwordError(!this.password().trim());
if (this.additionalCode.visibility()) {
this.additionalCode.error(false);
this.additionalCode.error(!trim(this.additionalCode()));
this.additionalCode.error(!this.additionalCode().trim());
}
if (

View file

@ -3,7 +3,7 @@ import $ from '$';
import ko from 'ko';
import key from 'key';
import { trim, isNormal, windowResize } from 'Common/Utils';
import { isNormal, windowResize } from 'Common/Utils';
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links';
@ -58,7 +58,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
() =>
FolderStore.currentFolder() &&
FolderStore.currentFolder().isInbox() &&
trim(MessageStore.messageListSearch()).includes('is:flagged')
MessageStore.messageListSearch().trim().includes('is:flagged')
);
}

View file

@ -20,7 +20,6 @@ import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAct
import {
isNonEmptyArray,
trim,
windowResize,
windowResizeCallback,
inFocus,
@ -95,8 +94,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.logoImg = trim(Settings.settingsGet('UserLogoMessage'));
this.logoIframe = trim(Settings.settingsGet('UserIframeMessage'));
this.logoImg = (Settings.settingsGet('UserLogoMessage')||'').trim();
this.logoIframe = (Settings.settingsGet('UserIframeMessage')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');

View file

@ -292,8 +292,8 @@
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
.on('mouseenter', this.pause.bind(this))
.on('mouseleave', this.cycle.bind(this))
}
Carousel.prototype = {
@ -303,7 +303,7 @@
if (this.interval) clearInterval(this.interval);
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
&& (this.interval = setInterval(this.next.bind(this), this.options.interval))
return this
}
@ -831,7 +831,7 @@
var Modal = function (element, options) {
this.options = options
this.$element = $(element)
.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
.on('click.dismiss.modal', '[data-dismiss="modal"]', this.hide.bind(this))
this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
}
@ -966,8 +966,8 @@
this.$backdrop.click(
this.options.backdrop == 'static' ?
$.proxy(this.$element[0].focus, this.$element[0])
: $.proxy(this.hide, this)
this.$element[0].focus.bind(this.$element[0])
: this.hide.bind(this)
)
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@ -1101,12 +1101,12 @@
for (i = triggers.length; i--;) {
trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
this.$element.on('click.' + this.type, this.options.selector, this.toggle.bind(this))
} else if (trigger != 'manual') {
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
this.$element.on(eventIn + '.' + this.type, this.options.selector, this.enter.bind(this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, this.leave.bind(this))
}
}
@ -1551,7 +1551,7 @@
* ========================== */
function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
var process = this.process.bind(this)
, $element = $(element).is('body') ? $(window) : $(element)
, href
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
@ -1915,7 +1915,7 @@
return this.shown ? this.hide() : this
}
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
items = $.isFunction(this.source) ? this.source(this.query, this.process.bind(this)) : this.source
return items ? this.process(items) : this
}
@ -2000,19 +2000,19 @@
, listen: function () {
this.$element
.on('focus', $.proxy(this.focus, this))
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
.on('focus', this.focus.bind(this))
.on('blur', this.blur.bind(this))
.on('keypress', this.keypress.bind(this))
.on('keyup', this.keyup.bind(this))
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
this.$element.on('keydown', this.keydown.bind(this))
}
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
.on('mouseleave', 'li', $.proxy(this.mouseleave, this))
.on('click', this.click.bind(this))
.on('mouseenter', 'li', this.mouseenter.bind(this))
.on('mouseleave', 'li', this.mouseleave.bind(this))
}
, eventSupported: function(eventName) {
@ -2192,8 +2192,8 @@
var Affix = function (element, options) {
this.options = $.extend({}, $.fn.affix.defaults, options)
this.$window = $(window)
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
.on('scroll.affix.data-api', this.checkPosition.bind(this))
.on('click.affix.data-api', (function () { setTimeout(this.checkPosition.bind(this), 1) }).bind(this))
this.$element = $(element)
this.checkPosition()
}

File diff suppressed because one or more lines are too long

View file

@ -1956,7 +1956,7 @@ $.widget( "ui.menu", {
.filter( ".ui-menu-item" )
.filter( function() {
return regex.test(
$.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
$( this ).children( ".ui-menu-item-wrapper" ).text().trim() );
} );
}
} );
@ -2221,7 +2221,7 @@ $.widget( "ui.autocomplete", {
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && $.trim( label ).length ) {
if ( label && label.trim().length ) {
this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion );
}
@ -2405,7 +2405,7 @@ $.widget( "ui.autocomplete", {
_response: function() {
var index = ++this.requestIndex;
return $.proxy( function( content ) {
return function( content ) {
if ( index === this.requestIndex ) {
this.__response( content );
}
@ -2414,7 +2414,7 @@ $.widget( "ui.autocomplete", {
if ( !this.pending ) {
this._removeClass( "ui-autocomplete-loading" );
}
}, this );
}.bind( this );
},
__response: function( content ) {

File diff suppressed because one or more lines are too long