芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/modules/AdminPanelWebclient/vue/src/utils/text.js
import { i18n } from 'boot/i18n' import typesUtils from './types' export default { getFriendlySize: function (sizeInBytes) { const bytesInKb = 1024 const bytesInMb = bytesInKb * bytesInKb const bytesInGb = bytesInKb * bytesInKb * bytesInKb sizeInBytes = typesUtils.pInt(sizeInBytes) if (sizeInBytes >= bytesInGb) { return typesUtils.roundNumber(sizeInBytes / bytesInGb, 1) + i18n.global.tc('COREWEBCLIENT.LABEL_GIGABYTES') } else if (sizeInBytes >= bytesInMb) { return typesUtils.roundNumber(sizeInBytes / bytesInMb, 1) + i18n.global.tc('COREWEBCLIENT.LABEL_MEGABYTES') } else if (sizeInBytes >= bytesInKb) { return typesUtils.roundNumber(sizeInBytes / bytesInKb, 0) + i18n.global.tc('COREWEBCLIENT.LABEL_KILOBYTES') } return sizeInBytes + i18n.global.tc('COREWEBCLIENT.LABEL_BYTES') }, encodeHtml: function (text) { if (typesUtils.isNonEmptyString(text)) { return text.toString() .replace(/&/g, '&').replace(//g, '>') .replace(/"/g, '"').replace(/'/g, ''') } return '' }, htmlToPlain: function (html) { return html .replace(/([^>]{1})
/gi, '$1\n') .replace(/