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