X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Findex.js;h=8c54cab6c13ac41b5a7051e8e9529f512c4f8198;hb=5de5781ad732f71ba62d8a1640eb946e853e3c8a;hp=4c947a4e215703704d7830956be7d6ad075b8ebd;hpb=49b21f122a232330f7efc499095d8d80f7895a20;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git 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();