-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
64 lines (42 loc) · 1.62 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
function getSearch(callback){
chrome.storage.sync.get("searchOption",callback);
}
function getColor(callback){
chrome.storage.sync.get("colorInversion",callback);
}
function getNotes(callback){
chrome.storage.sync.get("notes",callback);
}
document.addEventListener('DOMContentLoaded', function() {
var searchBox = document.getElementById("search");
searchBox.addEventListener("click",function(){
var checked = document.getElementById("search").checked;
chrome.storage.sync.set({ searchOption: checked });
});
var colorBox = document.getElementById("colorInversion");
colorBox.addEventListener("click",function(){
var checked = document.getElementById("colorInversion").checked;
chrome.storage.sync.set({colorInversion:checked});
//console.log("color");
//console.log(checked);
});
var notesBox = document.getElementById("notes");
notesBox.addEventListener("click",function(){
var checked = document.getElementById("notes").checked;
chrome.storage.sync.set({notes:checked});
console.log("notes");
console.log(cheked);
});
getSearch(function(searchOption){
document.getElementById("search").checked = searchOption['searchOption'];
});
getColor(function(colorInversion){
document.getElementById("colorInversion").checked = colorInversion['colorInversion'];
});
getNotes(function(notes){
document.getElementById("notes").checked = notes['notes'];
//if(document.getElementById("notes").checked === true){
// chrome.tabs.create({'url': "/options.html" } );
//}
});
});