From b54c12180e5f4eb633e587551715707ec0523943 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Mon, 14 Nov 2016 13:03:43 +1100 Subject: [PATCH] Card suits have color and use larger font size --- src/index.html | 16 ++++++++++++++++ src/js/entropy.js | 8 ++++++++ src/js/index.js | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index cb4c23d..c16dce8 100644 --- a/src/index.html +++ b/src/index.html @@ -61,6 +61,22 @@ .entropy-container li { padding-bottom: 5px; } + .card-suit { + font-size: 26px; + line-height: 0; + } + .card-suit.club { + color: #009F00; + } + .card-suit.diamond { + color: #3D5DC4; + } + .card-suit.heart { + color: #F00; + } + .card-suit.spade { + color: #000; + } 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() { return { binaryStr: "", cleanStr: "", + cleanHtml: "", base: base, }; } @@ -118,16 +119,23 @@ window.Entropy = new (function() { } // Supply a 'filtered' entropy string for display purposes var entropyClean = base.parts.join(""); + var entropyHtml = base.parts.join(""); if (base.asInt == 52) { entropyClean = base.parts.join(" ").toUpperCase(); entropyClean = entropyClean.replace(/C/g, "\u2663"); entropyClean = entropyClean.replace(/D/g, "\u2666"); entropyClean = entropyClean.replace(/H/g, "\u2665"); entropyClean = entropyClean.replace(/S/g, "\u2660"); + entropyHtml = base.parts.join(" ").toUpperCase(); + entropyHtml = entropyHtml.replace(/C/g, "\u2663"); + entropyHtml = entropyHtml.replace(/D/g, "\u2666"); + entropyHtml = entropyHtml.replace(/H/g, "\u2665"); + entropyHtml = entropyHtml.replace(/S/g, "\u2660"); } var e = { binaryStr: entropyBin, cleanStr: entropyClean, + cleanHtml: entropyHtml, base: base, } 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 @@ } var bitsStr = entropy.binaryStr.length; var wordCount = Math.floor(entropy.binaryStr.length / 32) * 3; - DOM.entropyFiltered.text(entropy.cleanStr); + DOM.entropyFiltered.html(entropy.cleanHtml); DOM.entropyType.text(entropy.base.str); DOM.entropyStrength.text(strength); DOM.entropyEventCount.text(entropy.base.ints.length); -- 2.41.0