-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
22 lines (20 loc) · 705 Bytes
/
options.js
File metadata and controls
22 lines (20 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function save_options() {
var api = document.getElementById('wptk').value;
chrome.storage.sync.set({
savedApi: api,
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Success! WebPageTest API key saved!';
setTimeout(function() {
status.textContent = '';
}, 15000);
});
}
document.getElementById('save').addEventListener('click', save_options);
function restore_options() {
chrome.storage.sync.get({"savedApi": ''}, function(items) {
document.getElementById('wptk').value = items.savedApi;
});
}
document.addEventListener('DOMContentLoaded', restore_options);