From d5cfd673dc73bd5938b51fb2d0d29d6eadb40689 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 22 Oct 2021 14:59:41 -0400 Subject: [PATCH] Condense list details in Support pane Related commit: - https://github.com/gorhill/uBlock/commit/a3a43c7cb43694d623476ecc1a9f2b646f740726 --- src/js/messaging.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index c44b6782b..df2705c18 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -1256,33 +1256,32 @@ const getSupportData = async function() { const list = lists[listKey]; if ( list.content !== 'filters' ) { continue; } const used = µb.selectedFilterLists.includes(listKey); - const listDetails = {}; + const listDetails = []; if ( used ) { if ( typeof list.entryCount === 'number' ) { - listDetails['filters used/total'] = - `${list.entryUsedCount} / ${list.entryCount}`; + listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`); } if ( typeof list.writeTime === 'number' ) { - const last = Math.floor(( - list.writeTime - - Date.now() - ) / 864000) / 100; - const next = Math.floor(( - list.writeTime + - list.updateAfter * 86400000 - - Date.now() - ) / 864000) / 100; - listDetails['updated last/next (days)'] = `${last} / ${next}`; + const delta = (Date.now() - list.writeTime) / 1000 | 0; + const days = (delta / 86400) | 0; + const hours = (delta % 86400) / 3600 | 0; + const minutes = (delta % 3600) / 60 | 0; + const parts = []; + if ( days > 0 ) { parts.push(`${days}d`); } + if ( hours > 0 ) { parts.push(`${hours}h`); } + if ( minutes > 0 ) { parts.push(`${minutes}m`); } + if ( parts.length === 0 ) { parts.push('now'); } + listDetails.push(parts.join('.')); } } if ( list.isDefault ) { if ( used ) { - defaultListset[listKey] = listDetails; + defaultListset[listKey] = listDetails.join(', '); } else { removedListset[listKey] = null; } } else if ( used ) { - addedListset[listKey] = listDetails; + addedListset[listKey] = listDetails.join(', '); } } if ( Object.keys(defaultListset).length === 0 ) { @@ -1305,7 +1304,7 @@ const getSupportData = async function() { extensionVersion: vAPI.app.version, modifiedUserSettings, modifiedHiddenSettings, - listset: { + 'listset (total-discarded, last updated)': { removed: removedListset, added: addedListset, default: defaultListset,