aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/index.html8
-rw-r--r--src/js/index.js49
2 files changed, 57 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html
index d2def05..1c2ffcf 100644
--- a/src/index.html
+++ b/src/index.html
@@ -254,6 +254,14 @@
254 </div> 254 </div>
255 </div> 255 </div>
256 <div class="form-group"> 256 <div class="form-group">
257 <label for="client-phrase" class="col-sm-2 control-label" data-translate>Client</label>
258 <div class="col-sm-10">
259 <select id="client-phrase" class="client form-control">
260 <!-- populated by javascript -->
261 </select>
262 </div>
263 </div>
264 <div class="form-group">
257 <label for="root-key" class="col-sm-2 control-label" data-translate>BIP32 Root Key</label> 265 <label for="root-key" class="col-sm-2 control-label" data-translate>BIP32 Root Key</label>
258 <div class="col-sm-10"> 266 <div class="col-sm-10">
259 <textarea id="root-key" class="root-key form-control" data-show-qr></textarea> 267 <textarea id="root-key" class="root-key form-control" data-show-qr></textarea>
diff --git a/src/js/index.js b/src/js/index.js
index c3c0a4a..f593b3a 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -23,7 +23,9 @@
23 23
24 var DOM = {}; 24 var DOM = {};
25 DOM.network = $(".network"); 25 DOM.network = $(".network");
26 DOM.client = $(".client");
26 DOM.phraseNetwork = $("#network-phrase"); 27 DOM.phraseNetwork = $("#network-phrase");
28 DOM.phraseClient = $("#client-phrase");
27 DOM.useEntropy = $(".use-entropy"); 29 DOM.useEntropy = $(".use-entropy");
28 DOM.entropyContainer = $(".entropy-container"); 30 DOM.entropyContainer = $(".entropy-container");
29 DOM.entropy = $(".entropy"); 31 DOM.entropy = $(".entropy");
@@ -77,6 +79,7 @@
77 function init() { 79 function init() {
78 // Events 80 // Events
79 DOM.network.on("change", networkChanged); 81 DOM.network.on("change", networkChanged);
82 DOM.client.on("change", clientChanged);
80 DOM.useEntropy.on("change", setEntropyVisibility); 83 DOM.useEntropy.on("change", setEntropyVisibility);
81 DOM.entropy.on("input", delayedEntropyChanged); 84 DOM.entropy.on("input", delayedEntropyChanged);
82 DOM.entropyMnemonicLength.on("change", entropyChanged); 85 DOM.entropyMnemonicLength.on("change", entropyChanged);
@@ -102,6 +105,7 @@
102 hidePending(); 105 hidePending();
103 hideValidationError(); 106 hideValidationError();
104 populateNetworkSelect(); 107 populateNetworkSelect();
108 populateClientSelect();
105 } 109 }
106 110
107 // Event handlers 111 // Event handlers
@@ -116,6 +120,17 @@
116 rootKeyChanged(); 120 rootKeyChanged();
117 } 121 }
118 } 122 }
123
124 function clientChanged(e) {
125 var clientIndex = e.target.value;
126 clients[clientIndex].onSelect();
127 if (seed != null) {
128 phraseChanged();
129 }
130 else {
131 rootKeyChanged();
132 }
133 }
119 134
120 function setEntropyVisibility() { 135 function setEntropyVisibility() {
121 if (isUsingOwnEntropy()) { 136 if (isUsingOwnEntropy()) {
@@ -701,6 +716,16 @@
701 DOM.phraseNetwork.append(option); 716 DOM.phraseNetwork.append(option);
702 } 717 }
703 } 718 }
719
720 function populateClientSelect() {
721 for (var i=0; i<clients.length; i++) {
722 var client = clients[i];
723 var option = $("<option>");
724 option.attr("value", i);
725 option.text(client.name);
726 DOM.phraseClient.append(option);
727 }
728 }
704 729
705 function getLanguage() { 730 function getLanguage() {
706 var defaultLanguage = "english"; 731 var defaultLanguage = "english";
@@ -1124,6 +1149,30 @@
1124 }, 1149 },
1125 }, 1150 },
1126 ] 1151 ]
1152
1153 var clients = [
1154 {
1155 name: "Bitcoin Core",
1156 onSelect: function() {
1157 DOM.bip32path.val("m/0'/0'");
1158 DOM.hardenedAddresses.prop('checked', true);
1159 },
1160 },
1161 {
1162 name: "blockchain.info",
1163 onSelect: function() {
1164 DOM.bip32path.val("m/44'/0'/0'");
1165 DOM.hardenedAddresses.prop('checked', false);
1166 },
1167 },
1168 {
1169 name: "MultiBit HD",
1170 onSelect: function() {
1171 DOM.bip32path.val("m/0'/0");
1172 DOM.hardenedAddresses.prop('checked', false);
1173 },
1174 }
1175 ]
1127 1176
1128 init(); 1177 init();
1129 1178