diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-02-19 11:49:51 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-02-19 11:49:51 +1100 |
commit | 29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a (patch) | |
tree | 751972d646d8aec5fd6dafd67aa1b9dc49cc1288 /src | |
parent | a2e3e8198943be8b30f4ed3f92d6e8b40836b6be (diff) | |
download | BIP39-29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a.tar.gz BIP39-29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a.tar.zst BIP39-29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a.zip |
Client select has 'custom derivation path' option
* Specific clients cause derivation path input to be readonly
* Rename ambiguous variable client-phrase to bip32-client
Diffstat (limited to 'src')
-rw-r--r-- | src/index.html | 5 | ||||
-rw-r--r-- | 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 @@ | |||
368 | </p> | 368 | </p> |
369 | </div> | 369 | </div> |
370 | <div class="form-group"> | 370 | <div class="form-group"> |
371 | <label for="client-phrase" class="col-sm-2 control-label" data-translate>Client</label> | 371 | <label for="bip32-client" class="col-sm-2 control-label" data-translate>Client</label> |
372 | <div class="col-sm-10"> | 372 | <div class="col-sm-10"> |
373 | <select id="client-phrase" class="client form-control"> | 373 | <select id="bip32-client" class="client form-control"> |
374 | <option value="custom">Custom derivation path</option> | ||
374 | <!-- populated by javascript --> | 375 | <!-- populated by javascript --> |
375 | </select> | 376 | </select> |
376 | </div> | 377 | </div> |
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 @@ | |||
23 | 23 | ||
24 | var DOM = {}; | 24 | var DOM = {}; |
25 | DOM.network = $(".network"); | 25 | DOM.network = $(".network"); |
26 | DOM.client = $(".client"); | 26 | DOM.bip32Client = $("#bip32-client"); |
27 | DOM.phraseNetwork = $("#network-phrase"); | 27 | DOM.phraseNetwork = $("#network-phrase"); |
28 | DOM.phraseClient = $("#client-phrase"); | ||
29 | DOM.useEntropy = $(".use-entropy"); | 28 | DOM.useEntropy = $(".use-entropy"); |
30 | DOM.entropyContainer = $(".entropy-container"); | 29 | DOM.entropyContainer = $(".entropy-container"); |
31 | DOM.entropy = $(".entropy"); | 30 | DOM.entropy = $(".entropy"); |
@@ -79,7 +78,7 @@ | |||
79 | function init() { | 78 | function init() { |
80 | // Events | 79 | // Events |
81 | DOM.network.on("change", networkChanged); | 80 | DOM.network.on("change", networkChanged); |
82 | DOM.client.on("change", clientChanged); | 81 | DOM.bip32Client.on("change", bip32ClientChanged); |
83 | DOM.useEntropy.on("change", setEntropyVisibility); | 82 | DOM.useEntropy.on("change", setEntropyVisibility); |
84 | DOM.entropy.on("input", delayedEntropyChanged); | 83 | DOM.entropy.on("input", delayedEntropyChanged); |
85 | DOM.entropyMnemonicLength.on("change", entropyChanged); | 84 | DOM.entropyMnemonicLength.on("change", entropyChanged); |
@@ -120,15 +119,21 @@ | |||
120 | rootKeyChanged(); | 119 | rootKeyChanged(); |
121 | } | 120 | } |
122 | } | 121 | } |
123 | 122 | ||
124 | function clientChanged(e) { | 123 | function bip32ClientChanged(e) { |
125 | var clientIndex = e.target.value; | 124 | var clientIndex = DOM.bip32Client.val(); |
126 | clients[clientIndex].onSelect(); | 125 | if (clientIndex == "custom") { |
127 | if (seed != null) { | 126 | DOM.bip32path.prop("readonly", false); |
128 | phraseChanged(); | ||
129 | } | 127 | } |
130 | else { | 128 | else { |
131 | rootKeyChanged(); | 129 | DOM.bip32path.prop("readonly", true); |
130 | clients[clientIndex].onSelect(); | ||
131 | if (seed != null) { | ||
132 | phraseChanged(); | ||
133 | } | ||
134 | else { | ||
135 | rootKeyChanged(); | ||
136 | } | ||
132 | } | 137 | } |
133 | } | 138 | } |
134 | 139 | ||
@@ -725,14 +730,14 @@ | |||
725 | DOM.phraseNetwork.append(option); | 730 | DOM.phraseNetwork.append(option); |
726 | } | 731 | } |
727 | } | 732 | } |
728 | 733 | ||
729 | function populateClientSelect() { | 734 | function populateClientSelect() { |
730 | for (var i=0; i<clients.length; i++) { | 735 | for (var i=0; i<clients.length; i++) { |
731 | var client = clients[i]; | 736 | var client = clients[i]; |
732 | var option = $("<option>"); | 737 | var option = $("<option>"); |
733 | option.attr("value", i); | 738 | option.attr("value", i); |
734 | option.text(client.name); | 739 | option.text(client.name); |
735 | DOM.phraseClient.append(option); | 740 | DOM.bip32Client.append(option); |
736 | } | 741 | } |
737 | } | 742 | } |
738 | 743 | ||