From b4fd763cebfb7f9497e12ca09b6271e1b39ac145 Mon Sep 17 00:00:00 2001 From: Alexander Georgievskiy Date: Tue, 7 Feb 2017 22:51:24 +0000 Subject: Add client select --- src/index.html | 8 ++++++++ src/js/index.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/index.html b/src/index.html index d2def05..1c2ffcf 100644 --- a/src/index.html +++ b/src/index.html @@ -253,6 +253,14 @@ +
+ +
+ +
+
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 @@ 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()) { @@ -701,6 +716,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"; @@ -1124,6 +1149,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(); -- cgit v1.2.3