forked from CrestoneDigital/CartoDB-Translation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
29 lines (26 loc) · 865 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
function save_options() {
var language = document.getElementById('language').value
chrome.storage.sync.set({
language: language
}, function () {
// Update status to let user know options were saved.
var status = $('#status')
status.text('Changes Saved')
status.fadeIn()
setTimeout(function () {
status.fadeOut(500, function() {
status.text('')
});
}, 2000)
})
}
function restore_options() {
// Use default value color = 'red' and likesColor = true.
chrome.storage.sync.get({
language: 'en'
}, function (items) {
document.getElementById('language').value = items.language
})
}
document.addEventListener('DOMContentLoaded', restore_options)
document.getElementById('save').addEventListener('click', save_options)