-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanagement.js
24 lines (21 loc) · 978 Bytes
/
management.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
document.addEventListener("DOMContentLoaded", function () {
var permissionListTextarea = document.getElementById("permissionList");
var saveButton = document.getElementById("saveButton");
// Recupera le permissions correnti dallo storage locale
chrome.storage.local.get("permissions", function (result) {
var permissions = result.permissions || [];
permissionListTextarea.value = JSON.stringify(permissions, null, 2);
});
// Salva le permissions nello storage locale quando il pulsante "Save" viene premuto
saveButton.addEventListener("click", function () {
var permissions = permissionListTextarea.value;
try {
permissions = JSON.parse(permissions);
chrome.storage.local.set({ permissions: permissions }, function () {
alert("Permissions saved successfully.");
});
} catch (error) {
alert("Invalid JSON format. Please enter a valid JSON array.");
}
});
});