Merge pull request #508 from Macha-orange/master

Add "auto compute" check box
This commit is contained in:
iancoleman
2021-10-08 13:53:32 +11:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -181,6 +181,15 @@
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-2"></div>
<div class="col-sm-10 checkbox">
<label>
<input type="checkbox" class="autoCompute" checked>
<span>Auto compute</span>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Mnemonic Language</label>
<div class="col-sm-10 languages">

View File

@@ -47,6 +47,7 @@
DOM.entropyWeakEntropyOverrideWarning = DOM.entropyContainer.find(".weak-entropy-override-warning");
DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning");
DOM.phrase = $(".phrase");
DOM.autoCompute = $(".autoCompute");
DOM.splitMnemonic = $(".splitMnemonic");
DOM.showSplitMnemonic = $(".showSplitMnemonic");
DOM.phraseSplit = $(".phraseSplit");
@@ -143,6 +144,7 @@
DOM.network.on("change", networkChanged);
DOM.bip32Client.on("change", bip32ClientChanged);
DOM.useEntropy.on("change", setEntropyVisibility);
DOM.autoCompute.on("change", delayedPhraseChanged);
DOM.entropy.on("input", delayedEntropyChanged);
DOM.entropyMnemonicLength.on("change", entropyChanged);
DOM.entropyTypeInputs.on("change", entropyTypeChanged);
@@ -234,6 +236,10 @@
}
}
function isUsingAutoCompute() {
return DOM.autoCompute.prop("checked");
}
function setEntropyVisibility() {
if (isUsingOwnEntropy()) {
DOM.entropyContainer.removeClass("hidden");
@@ -251,6 +257,8 @@
}
function delayedPhraseChanged() {
if(isUsingAutoCompute()) {
hideValidationError();
seed = null;
bip32RootKey = null;
@@ -270,6 +278,11 @@
entropyTypeAutoDetect = false;
}
}, 400);
} else {
clearDisplay();
clearEntropyFeedback();
showValidationError("Auto compute is disabled");
}
}
function phraseChanged() {