]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Hide/show split mnemonic cards
authorIan Coleman <ian@iancoleman.io>
Sun, 18 Oct 2020 23:17:24 +0000 (23:17 +0000)
committerIan Coleman <ian@iancoleman.io>
Sun, 18 Oct 2020 23:17:24 +0000 (23:17 +0000)
src/index.html
src/js/index.js

index bc5975af49964d5dfdeee6c8e06df946d3c1e3b6..0aeb3167328bbf8a4b70302c0df527b39afff2cf 100644 (file)
                             </div>
                         </div>
                         <div class="form-group">
-                            <label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label>
+                            <div  class="splitMnemonic hidden">
+                                <label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label>
+                                <div class="col-sm-10">
+                                    <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover." rows="3"></textarea>
+                                    <p class="help-block">
+                                        <span id="phraseSplitWarn" class="phraseSplitWarn"></span>
+                                    </p>
+                                </div>
+                            </div>
+                            <div class="col-sm-2">
+                            </div>
                             <div class="col-sm-10">
-                                <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover." rows="3"></textarea>
-                                <p class="help-block">
-                                    <span id="phraseSplitWarn" class="phraseSplitWarn"></span>
-                                </p>
+                                <label class="control-label text-weight-normal">
+                                    <input type="checkbox" class="showSplitMnemonic">
+                                    Show split mnemonic cards
+                                </label>
                             </div>
                         </div>
                         <div class="form-group">
index cb60941b1bca39f98a7f87e91fce2cecfe125a95..7e6732783006208ed0c2cd93487ee52b2273d4ff 100644 (file)
@@ -47,6 +47,8 @@
     DOM.entropyWeakEntropyOverrideWarning = DOM.entropyContainer.find(".weak-entropy-override-warning");
     DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning");
     DOM.phrase = $(".phrase");
+    DOM.splitMnemonic = $(".splitMnemonic");
+    DOM.showSplitMnemonic = $(".showSplitMnemonic");
     DOM.phraseSplit = $(".phraseSplit");
     DOM.phraseSplitWarn = $(".phraseSplitWarn");
     DOM.passphrase = $(".passphrase");
         DOM.entropyMnemonicLength.on("change", entropyChanged);
         DOM.entropyTypeInputs.on("change", entropyTypeChanged);
         DOM.phrase.on("input", delayedPhraseChanged);
+        DOM.showSplitMnemonic.on("change", toggleSplitMnemonic);
         DOM.passphrase.on("input", delayedPhraseChanged);
         DOM.generate.on("click", generateClicked);
         DOM.more.on("click", showMore);
         phraseChanged();
     }
 
+    function toggleSplitMnemonic() {
+        if (DOM.showSplitMnemonic.prop("checked")) {
+            DOM.splitMnemonic.removeClass("hidden");
+        }
+        else {
+            DOM.splitMnemonic.addClass("hidden");
+        }
+    }
+
     function calcForDerivationPath() {
         clearDerivedKeys();
         clearAddressesList();