diff options
author | Ian Coleman <ian@iancoleman.io> | 2018-01-03 10:33:22 +1100 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2018-01-03 10:33:22 +1100 |
commit | a78f4e280cb62edf892ad32b3797c657fe527bbc (patch) | |
tree | 6c7e1309668ba9ce712c9e7154f3d74f6f03572b /src | |
parent | 4e9b492ca4e1f90b985cfc2da94bddc60a36e386 (diff) | |
download | BIP39-a78f4e280cb62edf892ad32b3797c657fe527bbc.tar.gz BIP39-a78f4e280cb62edf892ad32b3797c657fe527bbc.tar.zst BIP39-a78f4e280cb62edf892ad32b3797c657fe527bbc.zip |
Add csv display of addresses
Diffstat (limited to 'src')
-rw-r--r-- | src/css/app.css | 8 | ||||
-rw-r--r-- | src/index.html | 89 | ||||
-rw-r--r-- | src/js/index.js | 25 |
3 files changed, 86 insertions, 36 deletions
diff --git a/src/css/app.css b/src/css/app.css index 897746b..71109ef 100644 --- a/src/css/app.css +++ b/src/css/app.css | |||
@@ -95,3 +95,11 @@ body { | |||
95 | top: 5px; | 95 | top: 5px; |
96 | right: 5px; | 96 | right: 5px; |
97 | } | 97 | } |
98 | .csv { | ||
99 | margin-top: 20px; | ||
100 | margin-bottom: 20px; | ||
101 | white-space: pre; | ||
102 | overflow-wrap: normal; | ||
103 | overflow-x: scroll; | ||
104 | font-family: monospace; | ||
105 | } | ||
diff --git a/src/index.html b/src/index.html index 0d1a2c6..0f47c38 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -603,42 +603,59 @@ | |||
603 | </label> | 603 | </label> |
604 | </div> | 604 | </div> |
605 | </div> | 605 | </div> |
606 | <div class="col-md-12"> | 606 | <ul class="addresses-type nav nav-tabs" role="tablist"> |
607 | <table class="table table-striped"> | 607 | <li id="table-tab" class="active"> |
608 | <thead> | 608 | <a href="#table" role="tab" data-toggle="tab">Table</a> |
609 | <th> | 609 | </li> |
610 | <div class="input-group"> | 610 | <li id="csv-tab"> |
611 | <span>Path</span> | 611 | <a href="#csv" role="tab" data-toggle="tab">CSV</a> |
612 | <button class="index-toggle">Toggle</button> | 612 | </li> |
613 | </div> | 613 | </ul> |
614 | </th> | 614 | <div class="addresses-type tab-content"> |
615 | <th> | 615 | <div id="table" class="tab-pane active"> |
616 | <div class="input-group"> | 616 | <div class="col-md-12"> |
617 | <span>Address</span> | 617 | <table class="table table-striped"> |
618 | <button class="address-toggle">Toggle</button> | 618 | <thead> |
619 | </div> | 619 | <th> |
620 | </th> | 620 | <div class="input-group"> |
621 | <th> | 621 | <span>Path</span> |
622 | <div class="input-group"> | 622 | <button class="index-toggle">Toggle</button> |
623 | <span>Public Key</span> | 623 | </div> |
624 | <button class="public-key-toggle">Toggle</button> | 624 | </th> |
625 | </div> | 625 | <th> |
626 | </th> | 626 | <div class="input-group"> |
627 | <th> | 627 | <span>Address</span> |
628 | <div class="input-group"> | 628 | <button class="address-toggle">Toggle</button> |
629 | <span>Private Key</span> | 629 | </div> |
630 | <button class="private-key-toggle">Toggle</button> | 630 | </th> |
631 | </div> | 631 | <th> |
632 | </th> | 632 | <div class="input-group"> |
633 | </thead> | 633 | <span>Public Key</span> |
634 | <tbody class="addresses monospace"> | 634 | <button class="public-key-toggle">Toggle</button> |
635 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | 635 | </div> |
636 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | 636 | </th> |
637 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | 637 | <th> |
638 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | 638 | <div class="input-group"> |
639 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | 639 | <span>Private Key</span> |
640 | </tbody> | 640 | <button class="private-key-toggle">Toggle</button> |
641 | </table> | 641 | </div> |
642 | </th> | ||
643 | </thead> | ||
644 | <tbody class="addresses monospace"> | ||
645 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | ||
646 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | ||
647 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | ||
648 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | ||
649 | <tr><td> </td><td> </td><td> </td><td> </td></tr> | ||
650 | </tbody> | ||
651 | </table> | ||
652 | </div> | ||
653 | </div> | ||
654 | <div id="csv" class="tab-pane"> | ||
655 | <div class="col-md-12"> | ||
656 | <textarea class="csv form-control" rows="25" readonly></textarea> | ||
657 | </div> | ||
658 | </div> | ||
642 | </div> | 659 | </div> |
643 | </div> | 660 | </div> |
644 | <span>Show</span> | 661 | <span>Show</span> |
diff --git a/src/js/index.js b/src/js/index.js index e63c65f..01543f9 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -91,6 +91,8 @@ | |||
91 | DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container"); | 91 | DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container"); |
92 | DOM.useBitpayAddresses = $(".use-bitpay-addresses"); | 92 | DOM.useBitpayAddresses = $(".use-bitpay-addresses"); |
93 | DOM.addresses = $(".addresses"); | 93 | DOM.addresses = $(".addresses"); |
94 | DOM.csvTab = $("#csv-tab a"); | ||
95 | DOM.csv = $(".csv"); | ||
94 | DOM.rowsToAdd = $(".rows-to-add"); | 96 | DOM.rowsToAdd = $(".rows-to-add"); |
95 | DOM.more = $(".more"); | 97 | DOM.more = $(".more"); |
96 | DOM.moreRowsStartIndex = $(".more-rows-start-index"); | 98 | DOM.moreRowsStartIndex = $(".more-rows-start-index"); |
@@ -135,6 +137,7 @@ | |||
135 | DOM.addressToggle.on("click", toggleAddresses); | 137 | DOM.addressToggle.on("click", toggleAddresses); |
136 | DOM.publicKeyToggle.on("click", togglePublicKeys); | 138 | DOM.publicKeyToggle.on("click", togglePublicKeys); |
137 | DOM.privateKeyToggle.on("click", togglePrivateKeys); | 139 | DOM.privateKeyToggle.on("click", togglePrivateKeys); |
140 | DOM.csvTab.on("click", updateCsv); | ||
138 | DOM.languages.on("click", languageChanged); | 141 | DOM.languages.on("click", languageChanged); |
139 | DOM.useBitpayAddresses.on("change", useBitpayAddressesChange); | 142 | DOM.useBitpayAddresses.on("change", useBitpayAddressesChange); |
140 | setQrEvents(DOM.showQrEls); | 143 | setQrEvents(DOM.showQrEls); |
@@ -831,6 +834,7 @@ | |||
831 | addAddressToList(indexText, address, pubkey, privkey); | 834 | addAddressToList(indexText, address, pubkey, privkey); |
832 | if (isLast) { | 835 | if (isLast) { |
833 | hidePending(); | 836 | hidePending(); |
837 | updateCsv(); | ||
834 | } | 838 | } |
835 | }, 50) | 839 | }, 50) |
836 | } | 840 | } |
@@ -871,6 +875,7 @@ | |||
871 | 875 | ||
872 | function clearAddressesList() { | 876 | function clearAddressesList() { |
873 | DOM.addresses.empty(); | 877 | DOM.addresses.empty(); |
878 | DOM.csv.val(""); | ||
874 | stopGenerating(); | 879 | stopGenerating(); |
875 | } | 880 | } |
876 | 881 | ||
@@ -1426,6 +1431,26 @@ | |||
1426 | DOM.entropyWordIndexes.text(wordIndexesStr); | 1431 | DOM.entropyWordIndexes.text(wordIndexesStr); |
1427 | } | 1432 | } |
1428 | 1433 | ||
1434 | function updateCsv() { | ||
1435 | var tableCsv = "path,address,public key,private key\n"; | ||
1436 | var rows = DOM.addresses.find("tr"); | ||
1437 | for (var i=0; i<rows.length; i++) { | ||
1438 | var row = $(rows[i]); | ||
1439 | var cells = row.find("td"); | ||
1440 | for (var j=0; j<cells.length; j++) { | ||
1441 | var cell = $(cells[j]); | ||
1442 | if (!cell.children().hasClass("invisible")) { | ||
1443 | tableCsv = tableCsv + cell.text(); | ||
1444 | } | ||
1445 | if (j != cells.length - 1) { | ||
1446 | tableCsv = tableCsv + ","; | ||
1447 | } | ||
1448 | } | ||
1449 | tableCsv = tableCsv + "\n"; | ||
1450 | } | ||
1451 | DOM.csv.val(tableCsv); | ||
1452 | } | ||
1453 | |||
1429 | var networks = [ | 1454 | var networks = [ |
1430 | { | 1455 | { |
1431 | name: "BCH - Bitcoin Cash", | 1456 | name: "BCH - Bitcoin Cash", |