aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriancoleman <coleman.ian@gmail.com>2017-02-19 11:23:41 +1100
committerGitHub <noreply@github.com>2017-02-19 11:23:41 +1100
commit5de5781ad732f71ba62d8a1640eb946e853e3c8a (patch)
treef4d2853ce988201ff32bf731d670c22fdf9d43a1 /src
parent49b21f122a232330f7efc499095d8d80f7895a20 (diff)
parentb4fd763cebfb7f9497e12ca09b6271e1b39ac145 (diff)
downloadBIP39-5de5781ad732f71ba62d8a1640eb946e853e3c8a.tar.gz
BIP39-5de5781ad732f71ba62d8a1640eb946e853e3c8a.tar.zst
BIP39-5de5781ad732f71ba62d8a1640eb946e853e3c8a.zip
Merge pull request #55 from galeksandrp/patch-1
Add client select
Diffstat (limited to 'src')
-rw-r--r--src/index.html17
-rw-r--r--src/js/index.js49
2 files changed, 65 insertions, 1 deletions
diff --git a/src/index.html b/src/index.html
index 9003f89..7dc53a7 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>
@@ -393,7 +401,7 @@
393 </div> 401 </div>
394 </div> 402 </div>
395 <div class="form-group"> 403 <div class="form-group">
396 <label class="col-sm-2 control-label" data-translate>Block Explorers</label> 404 <label class="col-sm-2 control-label" data-translate>Block Explorers and other clients</label>
397 <div class="col-sm-10"> 405 <div class="col-sm-10">
398 <p class="form-control no-border"> 406 <p class="form-control no-border">
399 <span data-translate-html>Use path <code>m/44'/0'/0'</code>.</span> 407 <span data-translate-html>Use path <code>m/44'/0'/0'</code>.</span>
@@ -403,6 +411,13 @@
403 <span data-translate>Can be used with</span>: 411 <span data-translate>Can be used with</span>:
404 <a href="https://blockchain.info/" target="_blank">blockchain.info</a> 412 <a href="https://blockchain.info/" target="_blank">blockchain.info</a>
405 </p> 413 </p>
414 <p class="form-control no-border">
415 <span data-translate-html>Use path <code>m/0'/0</code>.</span>
416 </p>
417 <p class="form-control no-border">
418 <span data-translate>Can be used with</span>:
419 <a href="https://multibit.org/" target="_blank">MultiBit HD</a>
420 </p>
406 </div> 421 </div>
407 </div> 422 </div>
408 </form> 423 </form>
diff --git a/src/js/index.js b/src/js/index.js
index 4c947a4..8c54cab 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()) {
@@ -710,6 +725,16 @@
710 DOM.phraseNetwork.append(option); 725 DOM.phraseNetwork.append(option);
711 } 726 }
712 } 727 }
728
729 function populateClientSelect() {
730 for (var i=0; i<clients.length; i++) {
731 var client = clients[i];
732 var option = $("<option>");
733 option.attr("value", i);
734 option.text(client.name);
735 DOM.phraseClient.append(option);
736 }
737 }
713 738
714 function getLanguage() { 739 function getLanguage() {
715 var defaultLanguage = "english"; 740 var defaultLanguage = "english";
@@ -1140,6 +1165,30 @@
1140 }, 1165 },
1141 }, 1166 },
1142 ] 1167 ]
1168
1169 var clients = [
1170 {
1171 name: "Bitcoin Core",
1172 onSelect: function() {
1173 DOM.bip32path.val("m/0'/0'");
1174 DOM.hardenedAddresses.prop('checked', true);
1175 },
1176 },
1177 {
1178 name: "blockchain.info",
1179 onSelect: function() {
1180 DOM.bip32path.val("m/44'/0'/0'");
1181 DOM.hardenedAddresses.prop('checked', false);
1182 },
1183 },
1184 {
1185 name: "MultiBit HD",
1186 onSelect: function() {
1187 DOM.bip32path.val("m/0'/0");
1188 DOM.hardenedAddresses.prop('checked', false);
1189 },
1190 }
1191 ]
1143 1192
1144 init(); 1193 init();
1145 1194