diff --git a/README.md b/README.md index 590b21e06..35f44c5d8 100644 --- a/README.md +++ b/README.md @@ -75,23 +75,23 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf |js/* |1.14.0 |native |gzip 1.14 |gzip | |----------- |--------: |--------: |--------: |--------: | -|admin.js |2.130.942 |1.133.275 | 485.481 | 274.632 | -|app.js |4.184.455 |2.844.189 | 932.725 | 664.075 | +|admin.js |2.130.942 |1.130.247 | 485.481 | 273.277 | +|app.js |4.184.455 |2.840.968 | 932.725 | 662.061 | |boot.js | 671.522 | 44.029 | 169.502 | 15.460 | -|libs.js | 647.614 | 431.049 | 194.728 | 132.315 | +|libs.js | 647.614 | 426.949 | 194.728 | 131.409 | |polyfills.js | 325.834 | 0 | 71.825 | 0 | -|TOTAL js |7.960.367 |4.452.542 |1.854.261 |1.086.482 | +|TOTAL js |7.960.367 |4.442.193 |1.854.261 |1.082.207 | |js/min/* |1.14.0 |native |gzip 1.14 |gzip | |--------------- |--------: |--------: |--------: |--------: | -|admin.min.js | 252.147 | 153.095 | 73.657 | 43.734 | -|app.min.js | 511.202 | 378.695 |140.462 | 99.511 | +|admin.min.js | 252.147 | 152.759 | 73.657 | 43.564 | +|app.min.js | 511.202 | 378.335 |140.462 | 99.341 | |boot.min.js | 66.007 | 5.589 | 22.567 | 2.333 | -|libs.min.js | 572.545 | 387.636 |176.720 |122.519 | +|libs.min.js | 572.545 | 385.139 |176.720 |121.907 | |polyfills.min.js | 32.452 | 0 | 11.312 | 0 | -|TOTAL js/min |1.434.353 | 925.015 |424.718 |268.097 | +|TOTAL js/min |1.434.353 | 921.822 |424.718 |267.145 | -509.338 bytes (156.621 gzip) is not much, but it feels faster. +512.531 bytes (157.573 gzip) is not much, but it feels faster. |css/* |1.14.0 |native | diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 6eb91ccf5..f0f188cd9 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -7,19 +7,15 @@ import { Mime } from 'Common/Mime'; const $ = jQuery, $div = $('
'), - isArray = Array.isArray; - -var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => { - return (str, quote_style = 3, double_encode = true) => { - str = (''+str) - .replace(double_encode?de:se,'&') - .replace(gt,'<') - .replace(lt,'>') - .replace(bt,'`'); - if (quote_style & 1) { str = str.replace(sq,'''); } - return (quote_style & 2) ? str.replace(dq,'"') : str; - }; -})(/&/g,/&(?![\w#]+;)/gi,//g,/'/g,/"/g,/`/g); + isArray = Array.isArray, + htmlmap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }, + htmlspecialchars = str => (''+str).replace(/[&<>"']/g, m => htmlmap[m]); /** * @param {*} value @@ -89,15 +85,13 @@ export function simpleQueryParser(queryString) { * @returns {string} */ export function fakeMd5(len = 32) { - const line = '0123456789abcdefghijklmnopqrstuvwxyz', - lineLen = line.length; + const line = '0123456789abcdefghijklmnopqrstuvwxyz'; len = pInt(len); let result = ''; - while (result.length < len) { - result += line.substr(Math.round(Math.random() * lineLen), 1); - } + while (len--) + result += line.substr(Math.round(Math.random() * 36), 1); return result; } diff --git a/dev/External/ko.js b/dev/External/ko.js index 1b4c90b94..b4609240d 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -747,35 +747,33 @@ ko.bindingHandlers.emailsTags = { $el = $(element), fValue = fValueAccessor(), fAllBindings = fAllBindingsAccessor(), - fAutoCompleteSource = fAllBindings.autoCompleteSource || null, - inputDelimiters = [',', ';', '\n'], - fFocusCallback = (value) => { - if (fValue && fValue.focused) { - fValue.focused(!!value); - } - }; + inputDelimiters = [',', ';', '\n']; $el.inputosaurus({ parseOnBlur: true, allowDragAndDrop: true, - focusCallback: fFocusCallback, + focusCallback: value => { + if (fValue && fValue.focused) { + fValue.focused(!!value); + } + }, inputDelimiters: inputDelimiters, - autoCompleteSource: fAutoCompleteSource, - splitHook: (value) => { + autoCompleteSource: fAllBindings.autoCompleteSource || null, + splitHook: value => { const v = value.trim(); if (v && inputDelimiters.includes(v.substr(-1))) { return EmailModel.splitEmailLine(value); } return null; }, - parseHook: (input) => + parseHook: input => input.map(inputValue => { const values = EmailModel.parseEmailLine(inputValue); return values.length ? values : inputValue; }).flat(Infinity).map( item => (item.toLine ? [item.toLine(false), item] : [item, null]) ), - change: (event) => { + change: event => { $el.data('EmailsTagsValue', event.target.value); fValue(event.target.value); } diff --git a/dev/Model/Email.js b/dev/Model/Email.js index 147b29cc1..ac1adb1b8 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -1,4 +1,4 @@ -import { encodeHtml, isNonEmptyArray } from 'Common/Utils'; +import { encodeHtml } from 'Common/Utils'; 'use strict'; @@ -64,12 +64,10 @@ function _handleAddress(tokens) { comment: [], group: [], text: [] - - // Filter out