32 lines
903 B
JavaScript
32 lines
903 B
JavaScript
|
var default_preferences = {"pkdbf2_level": 1000,
|
||
|
"account_url": "http://gpass-demo.soutade.fr/demo"};
|
||
|
|
||
|
function save() {
|
||
|
var account_url = document.getElementById('account_url').value;
|
||
|
var pkdbf2 = document.getElementById('pkdbf2').value;
|
||
|
|
||
|
chrome.storage.local.set({
|
||
|
'account_url': account_url,
|
||
|
'pkdbf2': pkdbf2,
|
||
|
}, function() {
|
||
|
alert('Saved');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
chrome.storage.local.get(null, function(prefs) {
|
||
|
if (!prefs.hasOwnProperty("account_url"))
|
||
|
account_url = default_preferences['account_url'];
|
||
|
else
|
||
|
account_url = prefs['account_url'];
|
||
|
|
||
|
if (!prefs.hasOwnProperty("pkdbf2_level"))
|
||
|
pkdbf2 = default_preferences['pkdbf2_level'];
|
||
|
else
|
||
|
pkdbf2 = prefs['pkdbf2_level'];
|
||
|
|
||
|
document.getElementById('account_url').value = account_url;
|
||
|
document.getElementById('pkdbf2').value = pkdbf2;
|
||
|
});
|
||
|
|
||
|
document.getElementById('save').addEventListener("click", save);
|