-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpopup.js
34 lines (33 loc) · 1.06 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
const userInput = document.getElementById('user');
const passInput = document.getElementById('pass');
const waitingTimeInput = document.getElementById('waitingtime');
chrome.storage.sync.get('user', function (data) {
if (!data.user) {
data.user = 'UMCAdmin';
chrome.storage.sync.set({ user: data.user });
}
userInput.value = data.user;
});
userInput.onchange = function(newval) {
chrome.storage.sync.set({ user: userInput.value });
}
chrome.storage.sync.get('pass', function (data) {
if (!data.pass) {
data.pass = 'MySecretPassword';
chrome.storage.sync.set({ pass: data.pass });
}
passInput.value = data.pass;
});
passInput.onchange = function(newval) {
chrome.storage.sync.set({ pass: passInput.value });
}
chrome.storage.sync.get('waitingTime', function (data) {
if (!data.waitingTime) {
data.waitingTime = '5';
chrome.storage.sync.set({ waitingTime: data.waitingTime });
}
waitingTimeInput.value = data.waitingTime;
});
waitingTimeInput.onchange = function(newval) {
chrome.storage.sync.set({ waitingTime: waitingTimeInput.value });
}