]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
New cells show with correct visibility
authorIan Coleman <coleman.ian@gmail.com>
Mon, 29 Sep 2014 06:30:05 +0000 (16:30 +1000)
committerIan Coleman <coleman.ian@gmail.com>
Mon, 29 Sep 2014 06:30:05 +0000 (16:30 +1000)
src/js/index.js

index f8b67616c530af1ae84c873a7302f6d59781ac20..81958fc7acf75c80dc358e161bfe60c6f869df19 100644 (file)
@@ -6,6 +6,10 @@
     var network = Bitcoin.networks.bitcoin;
     var addressRowTemplate = $("#address-row-template");
 
+    var showIndex = true;
+    var showAddress = true;
+    var showPrivKey = true;
+
     var phraseChangeTimeoutEvent = null;
 
     var DOM = {};
     }
 
     function toggleIndexes() {
+        showIndex = !showIndex;
         $("td.index span").toggleClass("invisible");
     }
 
     function toggleAddresses() {
+        showAddress = !showAddress;
         $("td.address span").toggleClass("invisible");
     }
 
     function togglePrivateKeys() {
+        showPrivKey = !showPrivKey;
         $("td.privkey span").toggleClass("invisible");
     }
 
 
     function addAddressToList(index, address, privkey) {
         var row = $(addressRowTemplate.html());
-        row.find(".index span").text(index);
-        row.find(".address span").text(address);
-        row.find(".privkey span").text(privkey);
+        // Elements
+        var indexCell = row.find(".index span");
+        var addressCell = row.find(".address span");
+        var privkeyCell = row.find(".privkey span");
+        // Content
+        indexCell.text(index);
+        addressCell.text(address);
+        privkeyCell.text(privkey);
+        // Visibility
+        if (!showIndex) {
+            indexCell.addClass("invisible");
+        }
+        if (!showAddress) {
+            addressCell.addClass("invisible");
+        }
+        if (!showPrivKey) {
+            privkeCell.addClass("invisible");
+        }
         DOM.addresses.append(row);
     }