From: iancoleman Date: Sun, 19 Feb 2017 00:23:41 +0000 (+1100) Subject: Merge pull request #55 from galeksandrp/patch-1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=5de5781ad732f71ba62d8a1640eb946e853e3c8a;hp=49b21f122a232330f7efc499095d8d80f7895a20;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git Merge pull request #55 from galeksandrp/patch-1 Add client select --- diff --git a/src/index.html b/src/index.html index 9003f89..7dc53a7 100644 --- a/src/index.html +++ b/src/index.html @@ -253,6 +253,14 @@ +
+ +
+ +
+
@@ -393,7 +401,7 @@
- +

Use path m/44'/0'/0'. @@ -403,6 +411,13 @@ Can be used with: blockchain.info

+

+ Use path m/0'/0. +

+

+ Can be used with: + MultiBit HD +

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 @@ var DOM = {}; DOM.network = $(".network"); + DOM.client = $(".client"); DOM.phraseNetwork = $("#network-phrase"); + DOM.phraseClient = $("#client-phrase"); DOM.useEntropy = $(".use-entropy"); DOM.entropyContainer = $(".entropy-container"); DOM.entropy = $(".entropy"); @@ -77,6 +79,7 @@ function init() { // Events DOM.network.on("change", networkChanged); + DOM.client.on("change", clientChanged); DOM.useEntropy.on("change", setEntropyVisibility); DOM.entropy.on("input", delayedEntropyChanged); DOM.entropyMnemonicLength.on("change", entropyChanged); @@ -102,6 +105,7 @@ hidePending(); hideValidationError(); populateNetworkSelect(); + populateClientSelect(); } // Event handlers @@ -116,6 +120,17 @@ rootKeyChanged(); } } + + function clientChanged(e) { + var clientIndex = e.target.value; + clients[clientIndex].onSelect(); + if (seed != null) { + phraseChanged(); + } + else { + rootKeyChanged(); + } + } function setEntropyVisibility() { if (isUsingOwnEntropy()) { @@ -710,6 +725,16 @@ DOM.phraseNetwork.append(option); } } + + function populateClientSelect() { + for (var i=0; i"); + option.attr("value", i); + option.text(client.name); + DOM.phraseClient.append(option); + } + } function getLanguage() { var defaultLanguage = "english"; @@ -1140,6 +1165,30 @@ }, }, ] + + var clients = [ + { + name: "Bitcoin Core", + onSelect: function() { + DOM.bip32path.val("m/0'/0'"); + DOM.hardenedAddresses.prop('checked', true); + }, + }, + { + name: "blockchain.info", + onSelect: function() { + DOM.bip32path.val("m/44'/0'/0'"); + DOM.hardenedAddresses.prop('checked', false); + }, + }, + { + name: "MultiBit HD", + onSelect: function() { + DOM.bip32path.val("m/0'/0"); + DOM.hardenedAddresses.prop('checked', false); + }, + } + ] init();