-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions.js
32 lines (30 loc) · 909 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
// Saves options to chrome.storage
function save_options() {
var teamcityurl = document.getElementById('teamcityurl').value;
var buildtype = document.getElementById('buildtype').value;
chrome.storage.sync.set({
teamcityUrl: teamcityurl,
buildType: buildtype
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function withOptions(withOptionsFunc) {
chrome.storage.sync.get({
teamcityUrl: 'http://localhost/',
buildType: ''
}, function(items) {
withOptionsFunc(items);
});
}
function restore_options() {
withOptions(function (items) {
document.getElementById('teamcityurl').value = items.teamcityUrl;
document.getElementById('buildtype').value = items.buildType;
});
}