diff options
author | Ian Coleman <ian@iancoleman.io> | 2019-11-11 11:04:23 +1100 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2019-11-11 11:04:23 +1100 |
commit | ea2cb91a49d57ee72674223eb3672fcb9a41130c (patch) | |
tree | ba8e88aa332e32877de52b2d1b264eeb2fdeb2fb /src/js | |
parent | bfe1963eaaaba4441c6ba6e829e0d89262b819ac (diff) | |
download | BIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.tar.gz BIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.tar.zst BIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.zip |
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.
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ | |||
1470 | DOM.splitPhrase.val(cards.join("\r\n")); | 1470 | DOM.splitPhrase.val(cards.join("\r\n")); |
1471 | var triesPerSecond=10000000000; | 1471 | var triesPerSecond=10000000000; |
1472 | var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; | 1472 | var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; |
1473 | var displayRedText = false; | ||
1473 | if (hackTime<1) { | 1474 | if (hackTime<1) { |
1474 | hackTime="<1 second"; | 1475 | hackTime="<1 second"; |
1476 | displayRedText = true; | ||
1475 | } else if (hackTime<86400) { | 1477 | } else if (hackTime<86400) { |
1476 | hackTime=Math.floor(hackTime)+" seconds"; | 1478 | hackTime=Math.floor(hackTime)+" seconds"; |
1479 | displayRedText = true; | ||
1477 | } else if(hackTime<31557600) { | 1480 | } else if(hackTime<31557600) { |
1478 | hackTime=Math.floor(hackTime/86400)+" days"; | 1481 | hackTime=Math.floor(hackTime/86400)+" days"; |
1482 | displayRedText = true; | ||
1479 | } else { | 1483 | } else { |
1480 | hackTime=Math.floor(hackTime/31557600)+" years"; | 1484 | hackTime=Math.floor(hackTime/31557600)+" years"; |
1481 | } | 1485 | } |
1482 | DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime); | 1486 | DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime); |
1487 | if (displayRedText) { | ||
1488 | DOM.phraseSplitWarn.addClass("text-danger"); | ||
1489 | } else { | ||
1490 | DOM.phraseSplitWarn.removeClass("text-danger"); | ||
1491 | } | ||
1483 | } | 1492 | } |
1484 | 1493 | ||
1485 | function isUsingOwnEntropy() { | 1494 | function isUsingOwnEntropy() { |