diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2014-09-30 10:03:53 +1000 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2014-09-30 10:15:51 +1000 |
commit | d6cedc9405e5f5751c8635f59ed3ff6876460776 (patch) | |
tree | 00c15e7dcd79b044508564ed3d070339677af1bf /bip39-standalone.html | |
parent | 3b40653ff11985c5b31d300ade711b3f7fd03459 (diff) | |
download | BIP39-d6cedc9405e5f5751c8635f59ed3ff6876460776.tar.gz BIP39-d6cedc9405e5f5751c8635f59ed3ff6876460776.tar.zst BIP39-d6cedc9405e5f5751c8635f59ed3ff6876460776.zip |
Derivation path tabs display by network selection
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r-- | bip39-standalone.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index ec15984..ce82c30 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -33842,12 +33842,19 @@ var Mnemonic = function(language) { | |||
33842 | var phraseChangeTimeoutEvent = null; | 33842 | var phraseChangeTimeoutEvent = null; |
33843 | 33843 | ||
33844 | var DOM = {}; | 33844 | var DOM = {}; |
33845 | DOM.network = $(".network"); | ||
33846 | DOM.phraseNetwork = $("#network-phrase"); | ||
33847 | DOM.bip44Network = $("#network-bip44"); | ||
33845 | DOM.phrase = $(".phrase"); | 33848 | DOM.phrase = $(".phrase"); |
33846 | DOM.passphrase = $(".passphrase"); | 33849 | DOM.passphrase = $(".passphrase"); |
33847 | DOM.generate = $(".generate"); | 33850 | DOM.generate = $(".generate"); |
33848 | DOM.rootKey = $(".root-key"); | 33851 | DOM.rootKey = $(".root-key"); |
33849 | DOM.extendedPrivKey = $(".extended-priv-key"); | 33852 | DOM.extendedPrivKey = $(".extended-priv-key"); |
33850 | DOM.extendedPubKey = $(".extended-pub-key"); | 33853 | DOM.extendedPubKey = $(".extended-pub-key"); |
33854 | DOM.bip32tab = $("#bip32-tab"); | ||
33855 | DOM.bip44tab = $("#bip44-tab"); | ||
33856 | DOM.bip32panel = $("#bip32"); | ||
33857 | DOM.bip44panel = $("#bip44"); | ||
33851 | DOM.bip32path = $("#bip32-path"); | 33858 | DOM.bip32path = $("#bip32-path"); |
33852 | DOM.bip44path = $("#bip44-path"); | 33859 | DOM.bip44path = $("#bip44-path"); |
33853 | DOM.bip44purpose = $("#bip44 .purpose"); | 33860 | DOM.bip44purpose = $("#bip44 .purpose"); |
@@ -33868,6 +33875,7 @@ var Mnemonic = function(language) { | |||
33868 | 33875 | ||
33869 | function init() { | 33876 | function init() { |
33870 | // Events | 33877 | // Events |
33878 | DOM.network.on("change", networkChanged); | ||
33871 | DOM.phrase.on("input", delayedPhraseChanged); | 33879 | DOM.phrase.on("input", delayedPhraseChanged); |
33872 | DOM.passphrase.on("input", delayedPhraseChanged); | 33880 | DOM.passphrase.on("input", delayedPhraseChanged); |
33873 | DOM.generate.on("click", generateClicked); | 33881 | DOM.generate.on("click", generateClicked); |
@@ -33888,6 +33896,35 @@ var Mnemonic = function(language) { | |||
33888 | 33896 | ||
33889 | // Event handlers | 33897 | // Event handlers |
33890 | 33898 | ||
33899 | function networkChanged(e) { | ||
33900 | var n = e.target.value; | ||
33901 | if (n == "bitcoin") { | ||
33902 | network = Bitcoin.networks.bitcoin; | ||
33903 | DOM.bip44coin.val(0); | ||
33904 | setBip44DerivationPath(); | ||
33905 | enableBip44Tab(); | ||
33906 | } | ||
33907 | else if (n == "bitcoin-testnet") { | ||
33908 | network = Bitcoin.networks.testnet; | ||
33909 | DOM.bip44coin.val(1); | ||
33910 | setBip44DerivationPath(); | ||
33911 | enableBip44Tab(); | ||
33912 | } | ||
33913 | else if (n == "litecoin") { | ||
33914 | network = Bitcoin.networks.litecoin; | ||
33915 | DOM.bip44coin.val(2); | ||
33916 | setBip44DerivationPath(); | ||
33917 | enableBip44Tab(); | ||
33918 | } | ||
33919 | else if (n == "dogecoin") { | ||
33920 | network = Bitcoin.networks.dogecoin; | ||
33921 | disableBip44Tab(); | ||
33922 | } | ||
33923 | DOM.phraseNetwork.val(n); | ||
33924 | DOM.bip44Network.val(n); | ||
33925 | delayedPhraseChanged(); | ||
33926 | } | ||
33927 | |||
33891 | function delayedPhraseChanged() { | 33928 | function delayedPhraseChanged() { |
33892 | hideValidationError(); | 33929 | hideValidationError(); |
33893 | showPending(); | 33930 | showPending(); |
@@ -34198,6 +34235,28 @@ var Mnemonic = function(language) { | |||
34198 | .hide(); | 34235 | .hide(); |
34199 | } | 34236 | } |
34200 | 34237 | ||
34238 | function enableBip44Tab() { | ||
34239 | // show bip44 tab (but don't select it) | ||
34240 | DOM.bip44tab.removeClass("hidden"); | ||
34241 | DOM.bip44panel.removeClass("hidden"); | ||
34242 | } | ||
34243 | |||
34244 | function disableBip44Tab() { | ||
34245 | // hide bip44 tab | ||
34246 | DOM.bip44tab.addClass("hidden"); | ||
34247 | DOM.bip44tab.removeClass("active"); | ||
34248 | // hide bip44 panel | ||
34249 | DOM.bip44panel.addClass("hidden"); | ||
34250 | DOM.bip44panel.removeClass("active"); | ||
34251 | // show bip32 tab | ||
34252 | DOM.bip32tab.addClass("active"); | ||
34253 | // show bip32 panel | ||
34254 | DOM.bip32panel.addClass("active"); | ||
34255 | // set the derivation path | ||
34256 | var activePath = $("#bip32 .path"); | ||
34257 | derivationPath = activePath.val(); | ||
34258 | } | ||
34259 | |||
34201 | init(); | 34260 | init(); |
34202 | 34261 | ||
34203 | })(); | 34262 | })(); |