$.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

@ -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() + "')");
}