Card suits have color and use larger font size

This commit is contained in:
Ian Coleman
2016-11-14 13:03:43 +11:00
parent 0a84fe6ae1
commit b54c12180e
3 changed files with 25 additions and 1 deletions

View File

@@ -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;
}
</style>
</head>
<body>

View File

@@ -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, "<span class='card-suit club'>\u2663</span>");
entropyHtml = entropyHtml.replace(/D/g, "<span class='card-suit diamond'>\u2666</span>");
entropyHtml = entropyHtml.replace(/H/g, "<span class='card-suit heart'>\u2665</span>");
entropyHtml = entropyHtml.replace(/S/g, "<span class='card-suit spade'>\u2660</span>");
}
var e = {
binaryStr: entropyBin,
cleanStr: entropyClean,
cleanHtml: entropyHtml,
base: base,
}
return e;

View File

@@ -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);