From 96ee8ab0a0e589c1fab745953909a031f79a3873 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Mon, 11 Nov 2019 10:15:17 +1100 Subject: Replace tabs with spaces as per rest of the file --- src/js/index.js | 104 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/js/index.js b/src/js/index.js index 9807449..edd70c5 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -45,8 +45,8 @@ DOM.entropyWeakEntropyOverrideWarning = DOM.entropyContainer.find(".weak-entropy-override-warning"); DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning"); DOM.phrase = $(".phrase"); - DOM.splitPhrase = $(".phraseSplit"); - DOM.phraseSplitWarn = $(".phraseSplitWarn"); + DOM.splitPhrase = $(".phraseSplit"); + DOM.phraseSplitWarn = $(".phraseSplitWarn"); DOM.passphrase = $(".passphrase"); DOM.generateContainer = $(".generate-container"); DOM.generate = $(".generate"); @@ -310,7 +310,7 @@ clearDisplay(); clearEntropyFeedback(); DOM.phrase.val(""); - DOM.phraseSplit.val(""); + DOM.phraseSplit.val(""); showValidationError("Blank entropy"); return; } @@ -345,7 +345,7 @@ showPending(); // Clear existing mnemonic and passphrase DOM.phrase.val(""); - DOM.phraseSplit.val(""); + DOM.phraseSplit.val(""); DOM.passphrase.val(""); seed = null; if (rootKeyChangedTimeoutEvent != null) { @@ -432,7 +432,7 @@ if (DOM.phrase.val().length > 0) { var newPhrase = convertPhraseToNewLanguage(); DOM.phrase.val(newPhrase); - writeSplitPhrase(newPhrase); + writeSplitPhrase(newPhrase); phraseChanged(); } else { @@ -493,7 +493,7 @@ // show the words var words = mnemonic.toMnemonic(data); DOM.phrase.val(words); - writeSplitPhrase(words); + writeSplitPhrase(words); // show the entropy var entropyHex = uint8ArrayToHex(data); DOM.entropy.val(entropyHex); @@ -1448,40 +1448,40 @@ } return phrase; } - - function writeSplitPhrase(phrase) { - var wordCount = phrase.split(/\s/g).length; //get number of words in phrase - var left=[]; //initialize array of indexs - for (var i=0;i0) { //while indexs left - groupI=(groupI+1)%3; //get next group to insert index into - seed = seed * 16807 % 2147483647; //change random value.(simple predicatable random number generator works well for this use) - var selected=Math.floor(left.length*(seed - 1) / 2147483646); //get index in left we will use for this group - group[groupI].push(left[selected]); //add index to group - left.splice(selected,1); //remove selected index - } - var cards=[phrase.split(/\s/g),phrase.split(/\s/g),phrase.split(/\s/g)];//make array of cards - for (var i=0;i<3;i++) { //go through each card - for (var ii=0;ii0) { //while indexs left + groupI=(groupI+1)%3; //get next group to insert index into + seed = seed * 16807 % 2147483647; //change random value.(simple predicatable random number generator works well for this use) + var selected=Math.floor(left.length*(seed - 1) / 2147483646); //get index in left we will use for this group + group[groupI].push(left[selected]); //add index to group + left.splice(selected,1); //remove selected index + } + var cards=[phrase.split(/\s/g),phrase.split(/\s/g),phrase.split(/\s/g)];//make array of cards + for (var i=0;i<3;i++) { //go through each card + for (var ii=0;ii