From b8c0bf39e930964d7e78afaa3edf6e46574d5c22 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Mon, 13 May 2024 16:02:09 +0800 Subject: [PATCH] display percentage completion in the extension icon --- scripts/GUI/entrypoints/iconindicator.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/GUI/entrypoints/iconindicator.js b/scripts/GUI/entrypoints/iconindicator.js index c96aa26..59bfada 100644 --- a/scripts/GUI/entrypoints/iconindicator.js +++ b/scripts/GUI/entrypoints/iconindicator.js @@ -39,13 +39,19 @@ class IconIndicator { "BadgeBackgroundColor": ICON_COLORS[`error`] }, {"tabId": ID}) : false; - if ((STATUS[`done`] && (typeof STATUS[`done`]).includes(`num`)) ? STATUS[`done`] >= 1 : false) { - global.read([`sites`, LOCATION, `analysis`, `Rating`, `Trust`]).then(async (RESULTS) => { + if (STATUS[`done`] && (typeof STATUS[`done`]).includes(`num`)) { + (STATUS[`done`] >= 1) + ? global.read([`sites`, LOCATION, `analysis`, `Rating`, `Trust`]).then(async (RESULTS) => { (RESULTS) ? BrowserIcon.set({ "BadgeText": await (new texts(`extensionIcon_product_`.concat(RESULTS))).symbol, "BadgeBackgroundColor": ICON_COLORS[`product_`.concat(RESULTS)] }, {"tabId": ID}) : false; - }) + }) + : ((STATUS[`done`] > 0) + ? BrowserIcon.set({ + "BadgeText": String(parseFloat(STATUS[`done`] * 100)).concat(`%`), + "BadgeBackgroundColor": ICON_COLORS[`loading`]}) + : false); }; }; });