-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
38 lines (32 loc) · 969 Bytes
/
options.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
function saveOptions() {
chrome.storage.sync.set({
difficulty: $("#difficulty_select").val()
}, function() {
$("#options_modal").show();
});
}
function loadOptions() {
chrome.storage.sync.get("difficulty", function (settings) {
// If the difficulty is not yet set, set it to difficult
if (!settings.difficulty) {
chrome.storage.sync.set({
difficulty: "difficult"
});
settings.difficulty = "difficult";
}
$("#difficulty_select").val(settings.difficulty);
});
}
// Run on eval
loadOptions();
$("#btn_options_return").on('click', function() {
$("#options_modal").hide();
document.location.href = "popup.html";
});
$("#btn_options_stay").on('click', function() {
$("#options_modal").hide();
});
$("#options_save").on('click', saveOptions);
$("#btn_options_back").on('click', function() {
document.location.href = "popup.html";
});