X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Findex.js;h=29cf06beca3009f30fbda9ba79218dacaa5ebc2a;hb=18f160099d4a319290501d9a5efb633e2acf53c9;hp=8c54cab6c13ac41b5a7051e8e9529f512c4f8198;hpb=5de5781ad732f71ba62d8a1640eb946e853e3c8a;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/src/js/index.js b/src/js/index.js index 8c54cab..29cf06b 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -23,9 +23,8 @@ var DOM = {}; DOM.network = $(".network"); - DOM.client = $(".client"); + DOM.bip32Client = $("#bip32-client"); DOM.phraseNetwork = $("#network-phrase"); - DOM.phraseClient = $("#client-phrase"); DOM.useEntropy = $(".use-entropy"); DOM.entropyContainer = $(".entropy-container"); DOM.entropy = $(".entropy"); @@ -79,7 +78,7 @@ function init() { // Events DOM.network.on("change", networkChanged); - DOM.client.on("change", clientChanged); + DOM.bip32Client.on("change", bip32ClientChanged); DOM.useEntropy.on("change", setEntropyVisibility); DOM.entropy.on("input", delayedEntropyChanged); DOM.entropyMnemonicLength.on("change", entropyChanged); @@ -120,15 +119,21 @@ rootKeyChanged(); } } - - function clientChanged(e) { - var clientIndex = e.target.value; - clients[clientIndex].onSelect(); - if (seed != null) { - phraseChanged(); + + function bip32ClientChanged(e) { + var clientIndex = DOM.bip32Client.val(); + if (clientIndex == "custom") { + DOM.bip32path.prop("readonly", false); } else { - rootKeyChanged(); + DOM.bip32path.prop("readonly", true); + clients[clientIndex].onSelect(); + if (seed != null) { + phraseChanged(); + } + else { + rootKeyChanged(); + } } } @@ -725,14 +730,14 @@ DOM.phraseNetwork.append(option); } } - + function populateClientSelect() { for (var i=0; i"); option.attr("value", i); option.text(client.name); - DOM.phraseClient.append(option); + DOM.bip32Client.append(option); } } @@ -1165,7 +1170,7 @@ }, }, ] - + var clients = [ { name: "Bitcoin Core",