-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoptions.js
37 lines (30 loc) · 1.06 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
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
$("#reset_button").disabled = true;
$("#accept_reset_checkbox").onclick = clickAcceptReset;
$("#reset_button").onclick = resetWallet;
async function loadWallet() {
const values = await chrome.storage.local.get(["privkey", "mnemonic", "derivation"]);
$("#privkey").value = values.privkey || null;
$("#mnemonic").value = values.mnemonic || null;
$("#derivation").value = values.derivation || null;
$("#privkey").disabled = true;
$("#mnemonic").disabled = true;
$("#derivation").disabled = true;
}
function clickAcceptReset() {
if ($("#accept_reset_checkbox").checked) {
$("#reset_button").disabled = false;
} else {
$("#reset_button").disabled = true;
}
}
async function resetWallet() {
await chrome.storage.local.clear();
$("#privkey").value = null;
$("#mnemonic").value = null;
$("#derivation").value = null;
$("#accept_reset_checkbox").checked = false;
$("#reset_button").disabled = true;
}
loadWallet().catch(e => console.error(e));