From ea2cb91a49d57ee72674223eb3672fcb9a41130c Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Mon, 11 Nov 2019 11:04:23 +1100 Subject: [PATCH] Tidy up split phrase warning Make red only when danger is present Align neatly with the rest of the UI Increase size of text area to show all three rows, although it still overflows on 24 words. --- src/css/app.css | 4 ---- src/index.html | 6 ++++-- src/js/index.js | 9 +++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/css/app.css b/src/css/app.css index c2a0294..576b7d7 100644 --- a/src/css/app.css +++ b/src/css/app.css @@ -31,10 +31,6 @@ body { .phrase { word-break: keep-all; } -.phraseSplitWarn { - text-align: right; - color: red; -} .generate-container .strength { /* override mobile width from bootstrap */ width: auto!important; diff --git a/src/index.html b/src/index.html index 096274d..ab1239a 100644 --- a/src/index.html +++ b/src/index.html @@ -175,9 +175,11 @@
- + +

+ +

-
diff --git a/src/js/index.js b/src/js/index.js index 03a8296..807230b 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1470,16 +1470,25 @@ DOM.splitPhrase.val(cards.join("\r\n")); var triesPerSecond=10000000000; var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; + var displayRedText = false; if (hackTime<1) { hackTime="<1 second"; + displayRedText = true; } else if (hackTime<86400) { hackTime=Math.floor(hackTime)+" seconds"; + displayRedText = true; } else if(hackTime<31557600) { hackTime=Math.floor(hackTime/86400)+" days"; + displayRedText = true; } else { hackTime=Math.floor(hackTime/31557600)+" years"; } DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime); + if (displayRedText) { + DOM.phraseSplitWarn.addClass("text-danger"); + } else { + DOM.phraseSplitWarn.removeClass("text-danger"); + } } function isUsingOwnEntropy() { -- 2.41.0