-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
28 lines (25 loc) · 1019 Bytes
/
popup.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
28
'use strict';
import { setBadgeAndShield } from "./utils.js";
chrome.storage.sync.get(['totalHighRiskExtensions', 'highRiskExtensionsReason'], function (result) {
if (!result || !result.totalHighRiskExtensions) {
setBadgeAndShield(0, true)
return
}
chrome.management.getAll(extensions => {
var highRiskExtensions = ''
var highRiskExtensionsCount = ''
for (let i = 0; i < extensions.length; i++) {
const extension = extensions[i]
if (result.highRiskExtensionsReason[extension.id]) {
highRiskExtensions += `<li>${extension.name} - <span>${result.highRiskExtensionsReason[extension.id]}</span></li>`
highRiskExtensionsCount++
}
}
if (!highRiskExtensionsCount) {
setBadgeAndShield(0, true)
return
}
setBadgeAndShield(highRiskExtensionsCount, true)
document.getElementById('highRiskExtensions').innerHTML = highRiskExtensions
})
});