-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
27 lines (23 loc) · 939 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function setBadgeAndShield(count, isPopup, loadingMessage, hasHighRiskDiv, noHighRiskDiv) {
console.log('Setting badge and shield with count:', count, isPopup);
// Hide loading message if we are in the popup context
if (isPopup && loadingMessage) {
loadingMessage.classList.add('hide');
}
if (!count) {
chrome.action.setBadgeText({ text: '' });
chrome.action.setIcon({ path: 'shield-128.png' });
if (isPopup && hasHighRiskDiv && noHighRiskDiv) {
hasHighRiskDiv.classList.add('hide');
noHighRiskDiv.classList.remove('hide');
}
return;
}
chrome.action.setBadgeText({ text: count.toString() });
chrome.action.setIcon({ path: "shield-danger.png" });
if (isPopup && hasHighRiskDiv && noHighRiskDiv) {
hasHighRiskDiv.classList.remove('hide');
noHighRiskDiv.classList.add('hide');
}
}
export { setBadgeAndShield };