-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
43 lines (30 loc) · 1.15 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
document.addEventListener('DOMContentLoaded', function () {
console.log('popup.js loaded');
// console.log($('#video'));
const array = ["english", "buttons", "fillpasswords"]
array.forEach(function (item, index) {
// console.log(item, index);
chrome.storage.sync.get([item], function (result) {
console.log(item + ' currently is ' + result[item]);
console.log(result[item] === false);
if (result[item] === false) {
$('#' + item).prop('checked', false);
}
if (item === "fillpasswords" && result[item] === undefined) {
$('#' + item).prop('checked', false);
}
});
});
$('html').click(function () {
console.log('clicked');
chrome.storage.sync.set({ english: ($('#english')[0].checked) }, function () {
// console.log('english is now set to ' + on);
});
chrome.storage.sync.set({ buttons: ($('#buttons')[0].checked) }, function () {
// console.log('buttons is now set to ' + on);
});
chrome.storage.sync.set({ fillpasswords: ($('#fillpasswords')[0].checked) }, function () {
// console.log('fillpasswords is now set to ' + on);
});
});
}, false);