-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.js
More file actions
26 lines (25 loc) · 770 Bytes
/
Copy pathoptions.js
File metadata and controls
26 lines (25 loc) · 770 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
// Saves options to chrome.storage
function save_options() {
var hourly = document.getElementById('hourly').value;
chrome.storage.sync.set({
hourlyWage: hourly,
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
// Restores preferences stored in chrome.storage.
function restore_options() {
chrome.storage.sync.get({
hourlyWage: 25,
}, function(items) {
document.getElementById('hourly').value = 25;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);