forked from chaiko/tab_menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
29 lines (26 loc) · 828 Bytes
/
Copy pathoptions.js
File metadata and controls
29 lines (26 loc) · 828 Bytes
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
// Saves options to chrome.storage.sync.
function save_options() {
var mode = $("input[name=window-mode]:checked").val();
chrome.storage.sync.set({
windowMode: mode
}, function() {
// Update status to let user know options were saved.
$("#status").text("Options saved.");
$("#status").show().fadeOut(1500);
});
}
// Restores select box and checkbox state using the preferences
// stored in chrome.storage.
function restore_options() {
// Use default value color = 'red' and likesColor = true.
chrome.storage.sync.get({
windowMode: "current" // default value as current
}, function(items) {
console.log(items);
$("input[name=window-mode][value=" + items.windowMode + "]").prop("checked", true);
});
}
$(function() {
restore_options();
$("#save").on("click", save_options);
});