gPass/chrome_addon/options.js

33 lines
906 B
JavaScript
Raw Normal View History

var default_preferences = {"pbkdf2_level": 1000,
"account_url": "https://gpass-demo.soutade.fr/demo"
};
2015-01-27 21:10:55 +01:00
function save() {
var account_url = document.getElementById('account_url').value;
var pbkdf2 = document.getElementById('pbkdf2').value;
2015-01-27 21:10:55 +01:00
chrome.storage.local.set({
'account_url': account_url,
'pbkdf2': pbkdf2,
2015-01-27 21:10:55 +01:00
}, 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("pbkdf2_level"))
pbkdf2 = default_preferences['pbkdf2_level'];
2015-01-27 21:10:55 +01:00
else
pbkdf2 = prefs['pbkdf2_level'];
2015-01-27 21:10:55 +01:00
document.getElementById('account_url').value = account_url;
document.getElementById('pbkdf2').value = pbkdf2;
2015-01-27 21:10:55 +01:00
});
document.getElementById('save').addEventListener("click", save);