From 29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Sun, 19 Feb 2017 11:49:51 +1100 Subject: [PATCH] Client select has 'custom derivation path' option * Specific clients cause derivation path input to be readonly * Rename ambiguous variable client-phrase to bip32-client --- src/index.html | 5 +++-- src/js/index.js | 29 +++++++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/index.html b/src/index.html index a5ac637..5495fe9 100644 --- a/src/index.html +++ b/src/index.html @@ -368,9 +368,10 @@

- +
- +
diff --git a/src/js/index.js b/src/js/index.js index 8c54cab..22bf599 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -23,9 +23,8 @@ var DOM = {}; DOM.network = $(".network"); - DOM.client = $(".client"); + DOM.bip32Client = $("#bip32-client"); DOM.phraseNetwork = $("#network-phrase"); - DOM.phraseClient = $("#client-phrase"); DOM.useEntropy = $(".use-entropy"); DOM.entropyContainer = $(".entropy-container"); DOM.entropy = $(".entropy"); @@ -79,7 +78,7 @@ function init() { // Events DOM.network.on("change", networkChanged); - DOM.client.on("change", clientChanged); + DOM.bip32Client.on("change", bip32ClientChanged); DOM.useEntropy.on("change", setEntropyVisibility); DOM.entropy.on("input", delayedEntropyChanged); DOM.entropyMnemonicLength.on("change", entropyChanged); @@ -120,15 +119,21 @@ rootKeyChanged(); } } - - function clientChanged(e) { - var clientIndex = e.target.value; - clients[clientIndex].onSelect(); - if (seed != null) { - phraseChanged(); + + function bip32ClientChanged(e) { + var clientIndex = DOM.bip32Client.val(); + if (clientIndex == "custom") { + DOM.bip32path.prop("readonly", false); } else { - rootKeyChanged(); + DOM.bip32path.prop("readonly", true); + clients[clientIndex].onSelect(); + if (seed != null) { + phraseChanged(); + } + else { + rootKeyChanged(); + } } } @@ -725,14 +730,14 @@ DOM.phraseNetwork.append(option); } } - + function populateClientSelect() { for (var i=0; i"); option.attr("value", i); option.text(client.name); - DOM.phraseClient.append(option); + DOM.bip32Client.append(option); } } -- 2.41.0