1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 17:02:27 +02:00

Condense list details in Support pane

Related commit:
- a3a43c7cb4
This commit is contained in:
Raymond Hill 2021-10-22 14:59:41 -04:00
parent 318469b005
commit d5cfd673dc
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1256,33 +1256,32 @@ const getSupportData = async function() {
const list = lists[listKey]; const list = lists[listKey];
if ( list.content !== 'filters' ) { continue; } if ( list.content !== 'filters' ) { continue; }
const used = µb.selectedFilterLists.includes(listKey); const used = µb.selectedFilterLists.includes(listKey);
const listDetails = {}; const listDetails = [];
if ( used ) { if ( used ) {
if ( typeof list.entryCount === 'number' ) { if ( typeof list.entryCount === 'number' ) {
listDetails['filters used/total'] = listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`);
`${list.entryUsedCount} / ${list.entryCount}`;
} }
if ( typeof list.writeTime === 'number' ) { if ( typeof list.writeTime === 'number' ) {
const last = Math.floor(( const delta = (Date.now() - list.writeTime) / 1000 | 0;
list.writeTime - const days = (delta / 86400) | 0;
Date.now() const hours = (delta % 86400) / 3600 | 0;
) / 864000) / 100; const minutes = (delta % 3600) / 60 | 0;
const next = Math.floor(( const parts = [];
list.writeTime + if ( days > 0 ) { parts.push(`${days}d`); }
list.updateAfter * 86400000 - if ( hours > 0 ) { parts.push(`${hours}h`); }
Date.now() if ( minutes > 0 ) { parts.push(`${minutes}m`); }
) / 864000) / 100; if ( parts.length === 0 ) { parts.push('now'); }
listDetails['updated last/next (days)'] = `${last} / ${next}`; listDetails.push(parts.join('.'));
} }
} }
if ( list.isDefault ) { if ( list.isDefault ) {
if ( used ) { if ( used ) {
defaultListset[listKey] = listDetails; defaultListset[listKey] = listDetails.join(', ');
} else { } else {
removedListset[listKey] = null; removedListset[listKey] = null;
} }
} else if ( used ) { } else if ( used ) {
addedListset[listKey] = listDetails; addedListset[listKey] = listDetails.join(', ');
} }
} }
if ( Object.keys(defaultListset).length === 0 ) { if ( Object.keys(defaultListset).length === 0 ) {
@ -1305,7 +1304,7 @@ const getSupportData = async function() {
extensionVersion: vAPI.app.version, extensionVersion: vAPI.app.version,
modifiedUserSettings, modifiedUserSettings,
modifiedHiddenSettings, modifiedHiddenSettings,
listset: { 'listset (total-discarded, last updated)': {
removed: removedListset, removed: removedListset,
added: addedListset, added: addedListset,
default: defaultListset, default: defaultListset,