aboutsummaryrefslogtreecommitdiff
path: root/bip39-standalone.html
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2015-10-23 09:41:49 +1100
committerIan Coleman <coleman.ian@gmail.com>2015-10-23 09:46:17 +1100
commit18531979e830c8c094e8de0b3ee593eebd250807 (patch)
tree5dba2ea745fd05652d61ca6062b832a35a7e2c66 /bip39-standalone.html
parentbffa8eda540af07f253259b155c5b23aa54d8d57 (diff)
downloadBIP39-18531979e830c8c094e8de0b3ee593eebd250807.tar.gz
BIP39-18531979e830c8c094e8de0b3ee593eebd250807.tar.zst
BIP39-18531979e830c8c094e8de0b3ee593eebd250807.zip
Strength field uses select tag
Closes #17
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r--bip39-standalone.html26
1 files changed, 10 insertions, 16 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html
index 5ef69ea..28f0a55 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -70,7 +70,16 @@
70 <label for="strength" class="col-sm-2 control-label">Number of words</label> 70 <label for="strength" class="col-sm-2 control-label">Number of words</label>
71 <div class="col-sm-10"> 71 <div class="col-sm-10">
72 <div class="input-group"> 72 <div class="input-group">
73 <input type="number" class="strength form-control" id="strength" value="15"> 73 <select id="strength" class="strength form-control">
74 <option val="3">3</option>
75 <option val="6">6</option>
76 <option val="9">9</option>
77 <option val="12">12</option>
78 <option val="15" selected>15</option>
79 <option val="18">18</option>
80 <option val="21">21</option>
81 <option val="24">24</option>
82 </select>
74 <span class="input-group-btn"> 83 <span class="input-group-btn">
75 <button class="btn generate">Generate Random Mnemonic</button> 84 <button class="btn generate">Generate Random Mnemonic</button>
76 </span> 85 </span>
@@ -14753,21 +14762,6 @@ var Mnemonic = function(language) {
14753 return; 14762 return;
14754 } 14763 }
14755 var numWords = parseInt(DOM.strength.val()); 14764 var numWords = parseInt(DOM.strength.val());
14756 // Check strength is an integer
14757 if (isNaN(numWords)) {
14758 DOM.strength.val("12");
14759 numWords = 12;
14760 }
14761 // Check strength is a multiple of 32, if not round it down
14762 if (numWords % 3 != 0) {
14763 numWords = Math.floor(numWords / 3) * 3;
14764 DOM.strength.val(numWords);
14765 }
14766 // Check strength is at least 32
14767 if (numWords == 0) {
14768 numWords = 3;
14769 DOM.strength.val(numWords);
14770 }
14771 var strength = numWords / 3 * 32; 14765 var strength = numWords / 3 * 32;
14772 var words = mnemonic.generate(strength); 14766 var words = mnemonic.generate(strength);
14773 DOM.phrase.val(words); 14767 DOM.phrase.val(words);