-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopdown.js
40 lines (33 loc) · 972 Bytes
/
popdown.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
function getSavedType(callback) {
chrome.storage.sync.get("methodtype", function (type) {
callback(type["methodtype"]);
});
}
function getSavedCats(callback) {
chrome.storage.sync.get("cats", function (type) {
callback(type["cats"]);
});
}
function saveType(type) {
chrome.storage.sync.set({"methodtype": type});
}
function saveCats(type) {
chrome.storage.sync.set({"cats": type});
}
document.addEventListener('DOMContentLoaded', function () {
var dropdown = document.getElementById('dropdown');
var catbox = document.getElementById('catbox');
getSavedType(function (savedType) {
if (savedType)
dropdown.value = savedType;
});
getSavedCats(function(cats) {
catbox.checked = cats;
});
dropdown.addEventListener('change', function() {
saveType(dropdown.value);
});
catbox.addEventListener('change', function(){
saveCats(catbox.checked);
})
});