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

View file

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

View file

@ -1,5 +1,5 @@
import window from 'window'; 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'; import * as Settings from 'Storage/Settings';
const ROOT = './', const ROOT = './',
@ -306,7 +306,7 @@ export function openPgpWorkerPath() {
export function themePreviewLink(theme) { export function themePreviewLink(theme) {
let prefix = VERSION_PREFIX; let prefix = VERSION_PREFIX;
if ('@custom' === theme.substr(-7)) { if ('@custom' === theme.substr(-7)) {
theme = trim(theme.substring(0, theme.length - 7)); theme = theme.substring(0, theme.length - 7).trim();
prefix = WEB_PREFIX; 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 { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
import { Mime } from 'Common/Mime'; import { Mime } from 'Common/Mime';
const trim = $.trim;
const isArray = Array.isArray; const isArray = Array.isArray;
const decodeURIComponent = component => window.decodeURIComponent(component); 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); })(/&/g,/&(?![\w#]+;)/gi,/</g,/>/g,/'/g,/"/g,/`/g);
export { trim };
/** /**
* @param {*} value * @param {*} value
* @returns {boolean} * @returns {boolean}
@ -223,8 +220,8 @@ export function removeSelection() {
* @returns {string} * @returns {string}
*/ */
export function replySubjectAdd(prefix, subject) { export function replySubjectAdd(prefix, subject) {
prefix = trim(prefix.toUpperCase()); prefix = prefix.toUpperCase().trim();
subject = trim(subject.replace(/[\s]+/g, ' ')); subject = subject.replace(/[\s]+/g, ' ').trim();
let drop = false, let drop = false,
re = 'RE' === prefix, re = 'RE' === prefix,
@ -235,7 +232,7 @@ export function replySubjectAdd(prefix, subject) {
if (subject) { if (subject) {
subject.split(':').forEach(part => { 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 (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[[(][\d]+[\])]$/i.test(trimmedPart))) {
if (!re) { if (!re) {
re = !!/^RE/i.test(trimmedPart); re = !!/^RE/i.test(trimmedPart);
@ -257,7 +254,7 @@ export function replySubjectAdd(prefix, subject) {
fwd = false; 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 => { export const convertThemeName = theme => {
if ('@custom' === theme.substr(-7)) { if ('@custom' === theme.substr(-7)) {
theme = trim(theme.substring(0, theme.length - 7)); theme = theme.substring(0, theme.length - 7).trim();
} }
return trim( return theme
theme
.replace(/[^a-zA-Z0-9]+/g, ' ') .replace(/[^a-zA-Z0-9]+/g, ' ')
.replace(/([A-Z])/g, ' $1') .replace(/([A-Z])/g, ' $1')
.replace(/\s+/g, ' ') .replace(/\s+/g, ' ')
); .trim();
}; };
/** /**
@ -513,7 +509,7 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
value = pInt(value); value = pInt(value);
break; break;
case 'trim': case 'trim':
value = trim(value); value = value.trim();
break; break;
default: default:
value = pString(value); value = pString(value);
@ -566,18 +562,18 @@ export function htmlToPlain(html) {
text = ''; text = '';
const convertBlockquote = (blockquoteText) => { const convertBlockquote = (blockquoteText) => {
blockquoteText = '> ' + trim(blockquoteText).replace(/\n/gm, '\n> '); blockquoteText = '> ' + blockquoteText.trim().replace(/\n/gm, '\n> ');
return blockquoteText.replace(/(^|\n)([> ]+)/gm, (...args) => 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) => { const convertDivs = (...args) => {
if (args && 1 < args.length) { if (args && 1 < args.length) {
let divText = trim(args[1]); let divText = args[1].trim();
if (divText.length) { if (divText.length) {
divText = divText.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim, convertDivs); divText = divText.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim, convertDivs);
divText = '\n' + trim(divText) + '\n'; divText = '\n' + divText.trim() + '\n';
} }
return divText; return divText;
@ -594,7 +590,7 @@ export function htmlToPlain(html) {
.replace(/[\r]/gm, '') .replace(/[\r]/gm, '')
: '', : '',
fixAttibuteValue = (...args) => (args && 1 < args.length ? '' + args[1] + htmlspecialchars(args[2]) : ''), 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 text = html
.replace(/<p[^>]*><\/p>/gi, '') .replace(/<p[^>]*><\/p>/gi, '')
@ -1124,7 +1120,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount) {
* @returns {string} * @returns {string}
*/ */
export function getFileExtension(fileName) { export function getFileExtension(fileName) {
fileName = trim(fileName).toLowerCase(); fileName = fileName.toLowerCase().trim();
const result = fileName.split('.').pop(); const result = fileName.split('.').pop();
return result === fileName ? '' : result; return result === fileName ? '' : result;
@ -1138,7 +1134,7 @@ export function mimeContentType(fileName) {
let ext = '', let ext = '',
result = 'application/octet-stream'; result = 'application/octet-stream';
fileName = trim(fileName).toLowerCase(); fileName = fileName.toLowerCase().trim();
if ('winmail.dat' === fileName) { if ('winmail.dat' === fileName) {
return 'application/ms-tnef'; return 'application/ms-tnef';

View file

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

View file

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

View file

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

View file

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

View file

@ -8,7 +8,6 @@ import { i18n } from 'Common/Translator';
import { import {
pInt, pInt,
trim,
previewMessage, previewMessage,
windowResize, windowResize,
friendlySize, friendlySize,
@ -743,7 +742,7 @@ class MessageModel extends AbstractModel {
attr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url'; attr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
$('[' + attr + ']', this.body).each(function() { $('[' + attr + ']', this.body).each(function() {
const $this = $(this); // eslint-disable-line no-invalid-this 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 + '; ') : ''; style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + $this.attr(attr)); $this.attr('style', style + $this.attr(attr));
}); });
@ -792,7 +791,7 @@ class MessageModel extends AbstractModel {
if (attachment && attachment.linkPreview) { if (attachment && attachment.linkPreview) {
name = $this.attr('data-x-style-cid-name'); name = $this.attr('data-x-style-cid-name');
if (name) { if (name) {
style = trim($this.attr('style')); style = $this.attr('style').trim();
style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : ''; style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + name + ": url('" + attachment.linkPreview() + "')"); $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 { import {
CONTACTS_SYNC_AJAX_TIMEOUT, CONTACTS_SYNC_AJAX_TIMEOUT,
@ -855,7 +855,7 @@ class RemoteUserAjax extends AbstractAjaxRemote {
contactSave(fCallback, sRequestUid, sUid, aProperties) { contactSave(fCallback, sRequestUid, sUid, aProperties) {
this.defaultRequest(fCallback, 'ContactSave', { this.defaultRequest(fCallback, 'ContactSave', {
'RequestUid': sRequestUid, 'RequestUid': sRequestUid,
'Uid': trim(sUid), 'Uid': sUid.trim(),
'Properties': aProperties 'Properties': aProperties
}); });
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,6 @@ import $ from '$';
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums'; import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
import { import {
trim,
isNormal, isNormal,
pInt, pInt,
pString, pString,
@ -135,7 +134,7 @@ class MessageUserStore {
read: this.messageListSearch, read: this.messageListSearch,
write: (value) => { write: (value) => {
setHash( 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); 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'); $this.addClass('rl-bq-switcher hidden-bq');
$('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>') $('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>')
.insertBefore($this) .insertBefore($this)

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import $ from '$'; import $ from '$';
import { i18n } from 'Common/Translator'; 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'; import AccountStore from 'Stores/User/Account';
@ -232,7 +232,7 @@ class PgpUserStore {
} }
if (undefined !== text) { if (undefined !== text) {
dom.text(trim(text)); dom.text(text.trim());
} }
} }

View file

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

View file

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

View file

@ -1,7 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts'; import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
import { i18n, getNotification } from 'Common/Translator'; import { i18n, getNotification } from 'Common/Translator';
@ -112,7 +111,7 @@ class ActivatePopupView extends AbstractViewNext {
return ( return (
!value || !value ||
RAINLOOP_TRIAL_KEY === 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 ko from 'ko';
import { trim, delegateRun, log } from 'Common/Utils'; import { delegateRun, log } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp'; 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, 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; openpgpKeyring = PgpStore.openpgpKeyring;
let keyTrimmed = trim(this.key()); let keyTrimmed = this.key().trim();
if (/[\n]/.test(keyTrimmed)) { if (/[\n]/.test(keyTrimmed)) {
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n'); keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@ import $ from '$';
import ko from 'ko'; import ko from 'ko';
import key from 'key'; 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 { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals'; import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links'; import { mailBox, settings } from 'Common/Links';
@ -58,7 +58,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
() => () =>
FolderStore.currentFolder() && FolderStore.currentFolder() &&
FolderStore.currentFolder().isInbox() && 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 { import {
isNonEmptyArray, isNonEmptyArray,
trim,
windowResize, windowResize,
windowResizeCallback, windowResizeCallback,
inFocus, inFocus,
@ -95,8 +94,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.allowMessageActions = !!Settings.capa(Capa.MessageActions); this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions); this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.logoImg = trim(Settings.settingsGet('UserLogoMessage')); this.logoImg = (Settings.settingsGet('UserLogoMessage')||'').trim();
this.logoIframe = trim(Settings.settingsGet('UserIframeMessage')); this.logoIframe = (Settings.settingsGet('UserIframeMessage')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile'); this.mobile = !!Settings.appSettingsGet('mobile');

View file

@ -292,8 +292,8 @@
this.$indicators = this.$element.find('.carousel-indicators') this.$indicators = this.$element.find('.carousel-indicators')
this.options = options this.options = options
this.options.pause == 'hover' && this.$element this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this)) .on('mouseenter', this.pause.bind(this))
.on('mouseleave', $.proxy(this.cycle, this)) .on('mouseleave', this.cycle.bind(this))
} }
Carousel.prototype = { Carousel.prototype = {
@ -303,7 +303,7 @@
if (this.interval) clearInterval(this.interval); if (this.interval) clearInterval(this.interval);
this.options.interval this.options.interval
&& !this.paused && !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) && (this.interval = setInterval(this.next.bind(this), this.options.interval))
return this return this
} }
@ -831,7 +831,7 @@
var Modal = function (element, options) { var Modal = function (element, options) {
this.options = options this.options = options
this.$element = $(element) 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) this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
} }
@ -966,8 +966,8 @@
this.$backdrop.click( this.$backdrop.click(
this.options.backdrop == 'static' ? this.options.backdrop == 'static' ?
$.proxy(this.$element[0].focus, this.$element[0]) this.$element[0].focus.bind(this.$element[0])
: $.proxy(this.hide, this) : this.hide.bind(this)
) )
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@ -1101,12 +1101,12 @@
for (i = triggers.length; i--;) { for (i = triggers.length; i--;) {
trigger = triggers[i] trigger = triggers[i]
if (trigger == 'click') { 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') { } else if (trigger != 'manual') {
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventIn + '.' + this.type, this.options.selector, this.enter.bind(this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, this.leave.bind(this))
} }
} }
@ -1551,7 +1551,7 @@
* ========================== */ * ========================== */
function ScrollSpy(element, options) { function ScrollSpy(element, options) {
var process = $.proxy(this.process, this) var process = this.process.bind(this)
, $element = $(element).is('body') ? $(window) : $(element) , $element = $(element).is('body') ? $(window) : $(element)
, href , href
this.options = $.extend({}, $.fn.scrollspy.defaults, options) this.options = $.extend({}, $.fn.scrollspy.defaults, options)
@ -1915,7 +1915,7 @@
return this.shown ? this.hide() : this 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 return items ? this.process(items) : this
} }
@ -2000,19 +2000,19 @@
, listen: function () { , listen: function () {
this.$element this.$element
.on('focus', $.proxy(this.focus, this)) .on('focus', this.focus.bind(this))
.on('blur', $.proxy(this.blur, this)) .on('blur', this.blur.bind(this))
.on('keypress', $.proxy(this.keypress, this)) .on('keypress', this.keypress.bind(this))
.on('keyup', $.proxy(this.keyup, this)) .on('keyup', this.keyup.bind(this))
if (this.eventSupported('keydown')) { if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this)) this.$element.on('keydown', this.keydown.bind(this))
} }
this.$menu this.$menu
.on('click', $.proxy(this.click, this)) .on('click', this.click.bind(this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseenter', 'li', this.mouseenter.bind(this))
.on('mouseleave', 'li', $.proxy(this.mouseleave, this)) .on('mouseleave', 'li', this.mouseleave.bind(this))
} }
, eventSupported: function(eventName) { , eventSupported: function(eventName) {
@ -2192,8 +2192,8 @@
var Affix = function (element, options) { var Affix = function (element, options) {
this.options = $.extend({}, $.fn.affix.defaults, options) this.options = $.extend({}, $.fn.affix.defaults, options)
this.$window = $(window) this.$window = $(window)
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) .on('scroll.affix.data-api', this.checkPosition.bind(this))
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this)) .on('click.affix.data-api', (function () { setTimeout(this.checkPosition.bind(this), 1) }).bind(this))
this.$element = $(element) this.$element = $(element)
this.checkPosition() 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( ".ui-menu-item" )
.filter( function() { .filter( function() {
return regex.test( 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 // Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value; label = ui.item.attr( "aria-label" ) || item.value;
if ( label && $.trim( label ).length ) { if ( label && label.trim().length ) {
this.liveRegion.children().hide(); this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion ); $( "<div>" ).text( label ).appendTo( this.liveRegion );
} }
@ -2405,7 +2405,7 @@ $.widget( "ui.autocomplete", {
_response: function() { _response: function() {
var index = ++this.requestIndex; var index = ++this.requestIndex;
return $.proxy( function( content ) { return function( content ) {
if ( index === this.requestIndex ) { if ( index === this.requestIndex ) {
this.__response( content ); this.__response( content );
} }
@ -2414,7 +2414,7 @@ $.widget( "ui.autocomplete", {
if ( !this.pending ) { if ( !this.pending ) {
this._removeClass( "ui-autocomplete-loading" ); this._removeClass( "ui-autocomplete-loading" );
} }
}, this ); }.bind( this );
}, },
__response: function( content ) { __response: function( content ) {

File diff suppressed because one or more lines are too long