Update options.js of firefox webextension
This commit is contained in:
parent
da72cb46eb
commit
6dfcab813d
|
@ -1,13 +1,16 @@
|
||||||
var default_preferences = {"pbkdf2_level": 1000,
|
var default_preferences = {"pbkdf2_level": 1000,
|
||||||
"account_url": "https://gpass-demo.soutade.fr/demo"};
|
"account_url": "https://gpass-demo.soutade.fr/demo",
|
||||||
|
"crypto_v1_compatible": true};
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
var account_url = document.getElementById('account_url').value;
|
var account_url = document.getElementById('account_url').value;
|
||||||
var pbkdf2 = document.getElementById('pbkdf2').value;
|
var pbkdf2 = document.getElementById('pbkdf2').value;
|
||||||
|
var crypto_v1_compatible = document.getElementById('crypto_v1_compatible').checked;
|
||||||
|
|
||||||
browser.storage.local.set({
|
browser.storage.local.set({
|
||||||
"account_url":account_url,
|
"account_url":account_url,
|
||||||
"pbkdf2_level":pbkdf2
|
"pbkdf2_level":pbkdf2,
|
||||||
|
"crypto_v1_compatible": crypto_v1_compatible,
|
||||||
})
|
})
|
||||||
.then(function ok() { alert("Saved"); },
|
.then(function ok() { alert("Saved"); },
|
||||||
function err() { alert("Cannot save your preferences");}
|
function err() { alert("Cannot save your preferences");}
|
||||||
|
@ -18,6 +21,7 @@ function restoreOptions()
|
||||||
{
|
{
|
||||||
document.getElementById('account_url').value = default_preferences['account_url'];
|
document.getElementById('account_url').value = default_preferences['account_url'];
|
||||||
document.getElementById('pbkdf2').value = default_preferences['pbkdf2_level'];
|
document.getElementById('pbkdf2').value = default_preferences['pbkdf2_level'];
|
||||||
|
document.getElementById('crypto_v1_compatible').checked = default_preferences["crypto_v1_compatible"];
|
||||||
|
|
||||||
browser.storage.local.get().then(
|
browser.storage.local.get().then(
|
||||||
function(prefs)
|
function(prefs)
|
||||||
|
@ -27,6 +31,9 @@ function restoreOptions()
|
||||||
|
|
||||||
if (prefs.hasOwnProperty("pbkdf2_level"))
|
if (prefs.hasOwnProperty("pbkdf2_level"))
|
||||||
document.getElementById('pbkdf2').value = prefs["pbkdf2_level"];
|
document.getElementById('pbkdf2').value = prefs["pbkdf2_level"];
|
||||||
|
|
||||||
|
if (prefs.hasOwnProperty("crypto_v1_compatible"))
|
||||||
|
document.getElementById('crypto_v1_compatible').checked = prefs["crypto_v1_compatible"];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user