-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
24 lines (23 loc) · 758 Bytes
/
options.js
File metadata and controls
24 lines (23 loc) · 758 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
function save_options() {
let repetitionListening = document.getElementById('repetition').checked;
chrome.storage.sync.set({
repetitionListening: repetitionListening
}, function() {
let status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function restore_options() {
// Use default value repetitionListening = true.
chrome.storage.sync.get({
repetitionListening: false
}, function(items) {
document.getElementById('repetition').checked = items.repetitionListening;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);