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