diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-11-14 13:03:43 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-11-14 13:03:43 +1100 |
commit | b54c12180e5f4eb633e587551715707ec0523943 (patch) | |
tree | 5cc359743c3a5be14bb5cded623ccb7491514a88 /src/js | |
parent | 0a84fe6ae178e6952c17e4208de8b405e5da55a8 (diff) | |
download | BIP39-b54c12180e5f4eb633e587551715707ec0523943.tar.gz BIP39-b54c12180e5f4eb633e587551715707ec0523943.tar.zst BIP39-b54c12180e5f4eb633e587551715707ec0523943.zip |
Card suits have color and use larger font size
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/entropy.js | 8 | ||||
-rw-r--r-- | src/js/index.js | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/js/entropy.js b/src/js/entropy.js index cd9b375..0b76dcf 100644 --- a/src/js/entropy.js +++ b/src/js/entropy.js | |||
@@ -93,6 +93,7 @@ window.Entropy = new (function() { | |||
93 | return { | 93 | return { |
94 | binaryStr: "", | 94 | binaryStr: "", |
95 | cleanStr: "", | 95 | cleanStr: "", |
96 | cleanHtml: "", | ||
96 | base: base, | 97 | base: base, |
97 | }; | 98 | }; |
98 | } | 99 | } |
@@ -118,16 +119,23 @@ window.Entropy = new (function() { | |||
118 | } | 119 | } |
119 | // Supply a 'filtered' entropy string for display purposes | 120 | // Supply a 'filtered' entropy string for display purposes |
120 | var entropyClean = base.parts.join(""); | 121 | var entropyClean = base.parts.join(""); |
122 | var entropyHtml = base.parts.join(""); | ||
121 | if (base.asInt == 52) { | 123 | if (base.asInt == 52) { |
122 | entropyClean = base.parts.join(" ").toUpperCase(); | 124 | entropyClean = base.parts.join(" ").toUpperCase(); |
123 | entropyClean = entropyClean.replace(/C/g, "\u2663"); | 125 | entropyClean = entropyClean.replace(/C/g, "\u2663"); |
124 | entropyClean = entropyClean.replace(/D/g, "\u2666"); | 126 | entropyClean = entropyClean.replace(/D/g, "\u2666"); |
125 | entropyClean = entropyClean.replace(/H/g, "\u2665"); | 127 | entropyClean = entropyClean.replace(/H/g, "\u2665"); |
126 | entropyClean = entropyClean.replace(/S/g, "\u2660"); | 128 | entropyClean = entropyClean.replace(/S/g, "\u2660"); |
129 | entropyHtml = base.parts.join(" ").toUpperCase(); | ||
130 | entropyHtml = entropyHtml.replace(/C/g, "<span class='card-suit club'>\u2663</span>"); | ||
131 | entropyHtml = entropyHtml.replace(/D/g, "<span class='card-suit diamond'>\u2666</span>"); | ||
132 | entropyHtml = entropyHtml.replace(/H/g, "<span class='card-suit heart'>\u2665</span>"); | ||
133 | entropyHtml = entropyHtml.replace(/S/g, "<span class='card-suit spade'>\u2660</span>"); | ||
127 | } | 134 | } |
128 | var e = { | 135 | var e = { |
129 | binaryStr: entropyBin, | 136 | binaryStr: entropyBin, |
130 | cleanStr: entropyClean, | 137 | cleanStr: entropyClean, |
138 | cleanHtml: entropyHtml, | ||
131 | base: base, | 139 | base: base, |
132 | } | 140 | } |
133 | return e; | 141 | return e; |
diff --git a/src/js/index.js b/src/js/index.js index 1076108..d356eb8 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -819,7 +819,7 @@ | |||
819 | } | 819 | } |
820 | var bitsStr = entropy.binaryStr.length; | 820 | var bitsStr = entropy.binaryStr.length; |
821 | var wordCount = Math.floor(entropy.binaryStr.length / 32) * 3; | 821 | var wordCount = Math.floor(entropy.binaryStr.length / 32) * 3; |
822 | DOM.entropyFiltered.text(entropy.cleanStr); | 822 | DOM.entropyFiltered.html(entropy.cleanHtml); |
823 | DOM.entropyType.text(entropy.base.str); | 823 | DOM.entropyType.text(entropy.base.str); |
824 | DOM.entropyStrength.text(strength); | 824 | DOM.entropyStrength.text(strength); |
825 | DOM.entropyEventCount.text(entropy.base.ints.length); | 825 | DOM.entropyEventCount.text(entropy.base.ints.length); |