-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.js
31 lines (27 loc) · 810 Bytes
/
options.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
29
30
31
function ClearList(){
chrome.storage.sync.set({
blockedUserNames: ""
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'List cleared saved.';
PopulateList();
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function PopulateList(){
chrome.storage.sync.get('blockedUserNames', function(result){
var storedValues = result.blockedUserNames;
var text = "<ul>";
for (i = 0; i < storedValues.length; i++) {
text += "<li>" + storedValues[i] + "</li>";
}
text += "</ul>";
document.getElementById("users").innerHTML = text;
});
}
document.addEventListener('DOMContentLoaded', PopulateList);
document.getElementById('clearList').addEventListener('click',
ClearList);