aboutsummaryrefslogtreecommitdiff
path: root/src/js/index.js
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-02-19 11:49:51 +1100
committerIan Coleman <coleman.ian@gmail.com>2017-02-19 11:49:51 +1100
commit29bf60f53ba17c76a0f2accd1bc1ff4644e8e56a (patch)
tree751972d646d8aec5fd6dafd67aa1b9dc49cc1288 /src/js/index.js
parenta2e3e8198943be8b30f4ed3f92d6e8b40836b6be (diff)
downloadBIP39-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/js/index.js')
-rw-r--r--src/js/index.js29
1 files changed, 17 insertions, 12 deletions
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