1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

Fix reported "Storage used:" when info is not available

This commit is contained in:
Raymond Hill 2020-04-29 10:00:58 -04:00
parent 3efee017cf
commit 23633b388d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -117,10 +117,9 @@ const exportToFile = async function() {
/******************************************************************************/
const onLocalDataReceived = function(details) {
let storageUsed;
let v, unit;
if ( typeof details.storageUsed === 'number' ) {
let v = details.storageUsed;
let unit;
v = details.storageUsed;
if ( v < 1e3 ) {
unit = 'genericBytes';
} else if ( v < 1e6 ) {
@ -133,13 +132,14 @@ const onLocalDataReceived = function(details) {
v /= 1e9;
unit = 'GB';
}
storageUsed = vAPI.i18n('storageUsed')
.replace('{{value}}', v.toLocaleString(undefined, { maximumSignificantDigits: 3 }))
.replace('{{unit}}', vAPI.i18n(unit));
} else {
storageUsed = '?';
v = '?';
unit = '';
}
uDom.nodeFromId('storageUsed').textContent = storageUsed;
uDom.nodeFromId('storageUsed').textContent =
vAPI.i18n('storageUsed')
.replace('{{value}}', v.toLocaleString(undefined, { maximumSignificantDigits: 3 }))
.replace('{{unit}}', unit && vAPI.i18n(unit) || '');
const timeOptions = {
weekday: 'long',