diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-02-19 12:38:39 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-02-19 12:38:39 +1100 |
commit | 56530adc0419de9e26ba8bcd4a0c9181600a8665 (patch) | |
tree | 0b539d52ce10c4ba0c015d1cb72b37fba44aad23 | |
parent | cdfaaf00c6fb48b9b5d1070ea8ca89e451f071bd (diff) | |
download | BIP39-56530adc0419de9e26ba8bcd4a0c9181600a8665.tar.gz BIP39-56530adc0419de9e26ba8bcd4a0c9181600a8665.tar.zst BIP39-56530adc0419de9e26ba8bcd4a0c9181600a8665.zip |
BIP32 client select compiled into standalone
-rw-r--r-- | bip39-standalone.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index de74d80..c42896f 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -372,6 +372,15 @@ | |||
372 | </p> | 372 | </p> |
373 | </div> | 373 | </div> |
374 | <div class="form-group"> | 374 | <div class="form-group"> |
375 | <label for="bip32-client" class="col-sm-2 control-label" data-translate>Client</label> | ||
376 | <div class="col-sm-10"> | ||
377 | <select id="bip32-client" class="client form-control"> | ||
378 | <option value="custom">Custom derivation path</option> | ||
379 | <!-- populated by javascript --> | ||
380 | </select> | ||
381 | </div> | ||
382 | </div> | ||
383 | <div class="form-group"> | ||
375 | <label for="bip32-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label> | 384 | <label for="bip32-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label> |
376 | <div class="col-sm-10"> | 385 | <div class="col-sm-10"> |
377 | <input id="bip32-path" type="text" class="path form-control" value="m/0"> | 386 | <input id="bip32-path" type="text" class="path form-control" value="m/0"> |
@@ -397,6 +406,18 @@ | |||
397 | </div> | 406 | </div> |
398 | </div> | 407 | </div> |
399 | <div class="form-group"> | 408 | <div class="form-group"> |
409 | <label for="core-path" class="col-sm-2 control-label" data-translate>Multibit</label> | ||
410 | <div class="col-sm-10"> | ||
411 | <p class="form-control no-border"> | ||
412 | <span data-translate-html>Use path <code>m/0'/0</code>.</span> | ||
413 | </p> | ||
414 | <p class="form-control no-border"> | ||
415 | <span data-translate>For more info see</span> | ||
416 | <a href="https://multibit.org/" target="_blank">MultiBit HD</a> | ||
417 | </p> | ||
418 | </div> | ||
419 | </div> | ||
420 | <div class="form-group"> | ||
400 | <label class="col-sm-2 control-label" data-translate>Block Explorers</label> | 421 | <label class="col-sm-2 control-label" data-translate>Block Explorers</label> |
401 | <div class="col-sm-10"> | 422 | <div class="col-sm-10"> |
402 | <p class="form-control no-border"> | 423 | <p class="form-control no-border"> |
@@ -41224,6 +41245,7 @@ window.Entropy = new (function() { | |||
41224 | 41245 | ||
41225 | var DOM = {}; | 41246 | var DOM = {}; |
41226 | DOM.network = $(".network"); | 41247 | DOM.network = $(".network"); |
41248 | DOM.bip32Client = $("#bip32-client"); | ||
41227 | DOM.phraseNetwork = $("#network-phrase"); | 41249 | DOM.phraseNetwork = $("#network-phrase"); |
41228 | DOM.useEntropy = $(".use-entropy"); | 41250 | DOM.useEntropy = $(".use-entropy"); |
41229 | DOM.entropyContainer = $(".entropy-container"); | 41251 | DOM.entropyContainer = $(".entropy-container"); |
@@ -41278,6 +41300,7 @@ window.Entropy = new (function() { | |||
41278 | function init() { | 41300 | function init() { |
41279 | // Events | 41301 | // Events |
41280 | DOM.network.on("change", networkChanged); | 41302 | DOM.network.on("change", networkChanged); |
41303 | DOM.bip32Client.on("change", bip32ClientChanged); | ||
41281 | DOM.useEntropy.on("change", setEntropyVisibility); | 41304 | DOM.useEntropy.on("change", setEntropyVisibility); |
41282 | DOM.entropy.on("input", delayedEntropyChanged); | 41305 | DOM.entropy.on("input", delayedEntropyChanged); |
41283 | DOM.entropyMnemonicLength.on("change", entropyChanged); | 41306 | DOM.entropyMnemonicLength.on("change", entropyChanged); |
@@ -41303,6 +41326,7 @@ window.Entropy = new (function() { | |||
41303 | hidePending(); | 41326 | hidePending(); |
41304 | hideValidationError(); | 41327 | hideValidationError(); |
41305 | populateNetworkSelect(); | 41328 | populateNetworkSelect(); |
41329 | populateClientSelect(); | ||
41306 | } | 41330 | } |
41307 | 41331 | ||
41308 | // Event handlers | 41332 | // Event handlers |
@@ -41318,6 +41342,23 @@ window.Entropy = new (function() { | |||
41318 | } | 41342 | } |
41319 | } | 41343 | } |
41320 | 41344 | ||
41345 | function bip32ClientChanged(e) { | ||
41346 | var clientIndex = DOM.bip32Client.val(); | ||
41347 | if (clientIndex == "custom") { | ||
41348 | DOM.bip32path.prop("readonly", false); | ||
41349 | } | ||
41350 | else { | ||
41351 | DOM.bip32path.prop("readonly", true); | ||
41352 | clients[clientIndex].onSelect(); | ||
41353 | if (seed != null) { | ||
41354 | phraseChanged(); | ||
41355 | } | ||
41356 | else { | ||
41357 | rootKeyChanged(); | ||
41358 | } | ||
41359 | } | ||
41360 | } | ||
41361 | |||
41321 | function setEntropyVisibility() { | 41362 | function setEntropyVisibility() { |
41322 | if (isUsingOwnEntropy()) { | 41363 | if (isUsingOwnEntropy()) { |
41323 | DOM.entropyContainer.removeClass("hidden"); | 41364 | DOM.entropyContainer.removeClass("hidden"); |
@@ -41912,6 +41953,16 @@ window.Entropy = new (function() { | |||
41912 | } | 41953 | } |
41913 | } | 41954 | } |
41914 | 41955 | ||
41956 | function populateClientSelect() { | ||
41957 | for (var i=0; i<clients.length; i++) { | ||
41958 | var client = clients[i]; | ||
41959 | var option = $("<option>"); | ||
41960 | option.attr("value", i); | ||
41961 | option.text(client.name); | ||
41962 | DOM.bip32Client.append(option); | ||
41963 | } | ||
41964 | } | ||
41965 | |||
41915 | function getLanguage() { | 41966 | function getLanguage() { |
41916 | var defaultLanguage = "english"; | 41967 | var defaultLanguage = "english"; |
41917 | // Try to get from existing phrase | 41968 | // Try to get from existing phrase |
@@ -42342,6 +42393,30 @@ window.Entropy = new (function() { | |||
42342 | }, | 42393 | }, |
42343 | ] | 42394 | ] |
42344 | 42395 | ||
42396 | var clients = [ | ||
42397 | { | ||
42398 | name: "Bitcoin Core", | ||
42399 | onSelect: function() { | ||
42400 | DOM.bip32path.val("m/0'/0'"); | ||
42401 | DOM.hardenedAddresses.prop('checked', true); | ||
42402 | }, | ||
42403 | }, | ||
42404 | { | ||
42405 | name: "blockchain.info", | ||
42406 | onSelect: function() { | ||
42407 | DOM.bip32path.val("m/44'/0'/0'"); | ||
42408 | DOM.hardenedAddresses.prop('checked', false); | ||
42409 | }, | ||
42410 | }, | ||
42411 | { | ||
42412 | name: "MultiBit HD", | ||
42413 | onSelect: function() { | ||
42414 | DOM.bip32path.val("m/0'/0"); | ||
42415 | DOM.hardenedAddresses.prop('checked', false); | ||
42416 | }, | ||
42417 | } | ||
42418 | ] | ||
42419 | |||
42345 | init(); | 42420 | init(); |
42346 | 42421 | ||
42347 | })(); | 42422 | })(); |