aboutsummaryrefslogtreecommitdiff
path: root/src/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/index.js')
-rw-r--r--src/js/index.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/js/index.js b/src/js/index.js
index e5e4593..9ea5bb5 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -63,18 +63,14 @@
63 disableForms(); 63 disableForms();
64 hidePending(); 64 hidePending();
65 hideValidationError(); 65 hideValidationError();
66 populateNetworkSelect();
66 } 67 }
67 68
68 // Event handlers 69 // Event handlers
69 70
70 function networkChanged(e) { 71 function networkChanged(e) {
71 var network = e.target.value; 72 var network = e.target.value;
72 if (network in networks) { 73 networks[network].onSelect();
73 networks[network].onSelect();
74 }
75 else {
76 // TODO
77 }
78 setBip44DerivationPath(); 74 setBip44DerivationPath();
79 delayedPhraseChanged(); 75 delayedPhraseChanged();
80 } 76 }
@@ -389,8 +385,18 @@
389 .hide(); 385 .hide();
390 } 386 }
391 387
392 var networks = { 388 function populateNetworkSelect() {
393 "bitcoin": { 389 for (var i=0; i<networks.length; i++) {
390 var network = networks[i];
391 var option = $("<option>");
392 option.attr("value", i);
393 option.text(network.name);
394 DOM.phraseNetwork.append(option);
395 }
396 }
397
398 var networks = [
399 {
394 name: "Bitcoin", 400 name: "Bitcoin",
395 onSelect: function() { 401 onSelect: function() {
396 network = Bitcoin.networks.bitcoin; 402 network = Bitcoin.networks.bitcoin;
@@ -398,7 +404,7 @@
398 DOM.myceliumPath.val("m/44'/0'/0'/0"); 404 DOM.myceliumPath.val("m/44'/0'/0'/0");
399 }, 405 },
400 }, 406 },
401 "bitcoin-testnet": { 407 {
402 name: "Bitcoin Testnet", 408 name: "Bitcoin Testnet",
403 onSelect: function() { 409 onSelect: function() {
404 network = Bitcoin.networks.testnet; 410 network = Bitcoin.networks.testnet;
@@ -406,21 +412,21 @@
406 DOM.myceliumPath.val("m/44'/1'/0'/0"); 412 DOM.myceliumPath.val("m/44'/1'/0'/0");
407 }, 413 },
408 }, 414 },
409 "litecoin": { 415 {
410 name: "Litecoin", 416 name: "Litecoin",
411 onSelect: function() { 417 onSelect: function() {
412 network = Bitcoin.networks.litecoin; 418 network = Bitcoin.networks.litecoin;
413 DOM.bip44coin.val(2); 419 DOM.bip44coin.val(2);
414 }, 420 },
415 }, 421 },
416 "dogecoin": { 422 {
417 name: "Dogecoin", 423 name: "Dogecoin",
418 onSelect: function() { 424 onSelect: function() {
419 network = Bitcoin.networks.dogecoin; 425 network = Bitcoin.networks.dogecoin;
420 DOM.bip44coin.val(3); 426 DOM.bip44coin.val(3);
421 }, 427 },
422 }, 428 },
423 } 429 ]
424 430
425 init(); 431 init();
426 432