mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Fix reported "Storage used:" when info is not available
This commit is contained in:
parent
3efee017cf
commit
23633b388d
1 changed files with 8 additions and 8 deletions
|
@ -117,10 +117,9 @@ const exportToFile = async function() {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
const onLocalDataReceived = function(details) {
|
const onLocalDataReceived = function(details) {
|
||||||
let storageUsed;
|
let v, unit;
|
||||||
if ( typeof details.storageUsed === 'number' ) {
|
if ( typeof details.storageUsed === 'number' ) {
|
||||||
let v = details.storageUsed;
|
v = details.storageUsed;
|
||||||
let unit;
|
|
||||||
if ( v < 1e3 ) {
|
if ( v < 1e3 ) {
|
||||||
unit = 'genericBytes';
|
unit = 'genericBytes';
|
||||||
} else if ( v < 1e6 ) {
|
} else if ( v < 1e6 ) {
|
||||||
|
@ -133,13 +132,14 @@ const onLocalDataReceived = function(details) {
|
||||||
v /= 1e9;
|
v /= 1e9;
|
||||||
unit = 'GB';
|
unit = 'GB';
|
||||||
}
|
}
|
||||||
storageUsed = vAPI.i18n('storageUsed')
|
|
||||||
.replace('{{value}}', v.toLocaleString(undefined, { maximumSignificantDigits: 3 }))
|
|
||||||
.replace('{{unit}}', vAPI.i18n(unit));
|
|
||||||
} else {
|
} 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 = {
|
const timeOptions = {
|
||||||
weekday: 'long',
|
weekday: 'long',
|
||||||
|
|
Loading…
Reference in a new issue