-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
41 lines (36 loc) · 1.31 KB
/
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
33
34
35
36
37
38
39
40
41
function save_options() {
var e = document.getElementById("currencySelect");
var currency = e.options[e.selectedIndex].value;
chrome.storage.sync.set({
currency: currency,
status: document.getElementById("onlineStatusCheckbox").checked
}, function() {
$("#saved").fadeIn('slow').delay(1000).hide(0);
});
}
function restore_options() {
chrome.storage.sync.get({
currency: 1,
status: true
}, function(items) {
document.getElementById('currencySelect').value = items.currency;
document.getElementById("onlineStatusCheckbox").checked = items.status;
});
var selectList = $('#currencySelect option');
selectList.sort(function(a,b){
a = a.text;
b = b.text;
return a.localeCompare(b);
});
$('#currencySelect').html(selectList);
$('#currencyLabel').text(chrome.i18n.getMessage("currency"));
$('#save').text(chrome.i18n.getMessage("save"));
$('#onlineStatusLabel').text(chrome.i18n.getMessage('onlineStatus'));
$('#faq-header').text(chrome.i18n.getMessage("faqHeader")).css("font-weight", "Bold");
$('#faq-content').html(chrome.i18n.getMessage("faqContent"));
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click', save_options);
$("#faq-header").click(function(){
$("#faq-content").toggle();
});