-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
28 lines (27 loc) · 919 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
// Saves options to chrome.storage
function save_options() {
var jiraHost = document.getElementById('jiraHost').value;
chrome.storage.sync.set({
jiraHost: jiraHost,
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Options saved as ' + jiraHost;
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
// Restores option state using the preferences
// stored in chrome.storage.
function restore_options() {
// Use a sensible default JIRA host and provide an example for formatting
chrome.storage.sync.get({
jiraHost: 'jira.atlassian.com',
}, function(items) {
document.getElementById('jiraHost').value = items.jiraHost;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);