forked from CS410Assignments/CourseProject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
69 lines (64 loc) · 2.31 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const pBg = document.querySelector('#pBg');
const pFg = document.querySelector('#pFg');
const lpBg = document.querySelector('#lpBg');
const lpFg = document.querySelector('#lpFg');
const neuBg = document.querySelector('#neuBg');
const neuFg = document.querySelector('#neuFg');
const lnBg = document.querySelector('#lnBg');
const lnFg = document.querySelector('#lnFg');
const nBg = document.querySelector('#nBg');
const nFg = document.querySelector('#nFg');
const onRadioButton = document.querySelector('#on');
const offRadioButton = document.querySelector('#off');
chrome.storage.local.get([
'pBg', 'pFg', 'lpBg', 'lpFg', 'neuBg', 'neuFg', 'lnBg', 'lnFg', 'nBg', 'nFg', 'on'
]).then((result) => {
pBg.value = result.pBg;
pFg.value = result.pFg;
lpBg.value = result.lpBg;
lpFg.value = result.lpFg;
neuBg.value = result.neuBg;
neuFg.value = result.neuFg;
lnBg.value = result.lnBg;
lnFg.value = result.lnFg;
nBg.value = result.nBg;
nFg.value = result.nFg;
onRadioButton.checked = result.on;
offRadioButton.checked = !result.on;
});
pBg.addEventListener('input', (event) => {
chrome.storage.local.set({ pBg: event.target.value });
});
pFg.addEventListener('input', (event) => {
chrome.storage.local.set({ pFg: event.target.value });
});
lpBg.addEventListener('input', (event) => {
chrome.storage.local.set({ lpBg: event.target.value });
});
lpFg.addEventListener('input', (event) => {
chrome.storage.local.set({ lpFg: event.target.value });
});
neuBg.addEventListener('input', (event) => {
chrome.storage.local.set({ neuBg: event.target.value });
});
neuFg.addEventListener('input', (event) => {
chrome.storage.local.set({ neuFg: event.target.value });
});
lnBg.addEventListener('input', (event) => {
chrome.storage.local.set({ lnBg: event.target.value });
});
lnFg.addEventListener('input', (event) => {
chrome.storage.local.set({ lnFg: event.target.value });
});
nBg.addEventListener('input', (event) => {
chrome.storage.local.set({ nBg: event.target.value });
});
nFg.addEventListener('input', (event) => {
chrome.storage.local.set({ nFg: event.target.value });
});
onRadioButton.addEventListener('click', (event) => {
chrome.storage.local.set({ on: true });
});
offRadioButton.addEventListener('click', (event) => {
chrome.storage.local.set({ on: false });
});