From 3edf9abccf645c9630eac9ec3f085dcfd486c227 Mon Sep 17 00:00:00 2001 From: Elliot Date: Thu, 8 Apr 2021 22:22:16 -0400 Subject: [PATCH] Fix favicon loading so it does not block data storage --- src/data/storage.js | 2 +- src/popup/popup.js | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/data/storage.js b/src/data/storage.js index 16e8565..f9eb674 100644 --- a/src/data/storage.js +++ b/src/data/storage.js @@ -107,7 +107,7 @@ async function updateAkitaData(originData, data, typeOfData, isMonetizedData) { updateTimeSpent(originData, originStats, data, isMonetizedData); break; case AKITA_DATA_TYPE.ORIGIN_FAVICON: // Only for a monetized origin - await updateOriginFavicon(originData, data); + updateOriginFavicon(originData, data); break; default: // console.log("invalid data type provided"); diff --git a/src/popup/popup.js b/src/popup/popup.js index 284a51d..6453756 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -384,25 +384,26 @@ function createTopSiteDetailEls(originData, originStats) { textEl(`Crunching time spent numbers...`) ]); } + } else { + setContentOfEl(timeSpentEl, [textEl(`Crunching time spent numbers...`)]); } - // Set visit count text - let visitCountText = ``; const visitCount = originData.originVisitData.numberOfVisits; - if (visitCount === 0) { - // Don't set the visit count text - } else if (visitCount === 1) { - visitCountText = `${visitCount} time`; - } else { - visitCountText = `${visitCount} times`; - } + + // Set visit count text let visitCountEl = paragraphEl(); - if (visitCountText !== ``) { + if (visitCount > 0) { const percentVisits = getPercentVisitsToOriginOutOfTotal(originData, originStats); if (percentVisits > 0) { + let timeText; + if (visitCount > 1) { + timeText = `times`; + } else { + timeText = `time`; + } setContentOfEl(visitCountEl, [ textEl(`You've visited `), - strongEl(visitCountText), + strongEl(`${visitCount} ${timeText}`), textEl(`, which is `), strongEl(`${percentVisits}%`), textEl(` of your total website visits.`) @@ -412,6 +413,10 @@ function createTopSiteDetailEls(originData, originStats) { textEl(`Counting up visits...`) ]); } + } else { + setContentOfEl(visitCountEl, [ + textEl(`Counting up visits...`) + ]); } // Set payment data text