-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathoptions.js
More file actions
37 lines (33 loc) · 1.07 KB
/
options.js
File metadata and controls
37 lines (33 loc) · 1.07 KB
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
$(document).ready(function () {
$("#notifications").bind("click", check_notifications);
$("#checkadd").bind("click", check_sync);
$("#checkreplace").bind("click", check_sync);
});
document.addEventListener('DOMContentLoaded', restore_options);
function restore_options() {
// Use default value color = 'red' and likesColor = true.
chrome.storage.local.get({
notifications: true,
add: true
}, function(items) {
document.getElementById('notifications').checked = items.notifications;
document.getElementById('checkadd').checked = items.add;
document.getElementById('checkreplace').checked = !(items.add);
});
}
function check_notifications(){
if(document.getElementById("notifications").checked) {
chrome.storage.local.set({'notifications': true}, function () {});
}
else{
chrome.storage.local.set({'notifications': false}, function () {});
}
}
function check_sync(){
if(document.getElementById("checkadd").checked){
chrome.storage.local.set({add: true}, function () {});
}
else{
chrome.storage.local.set({add: false}, function () {});
}
}