mirror of
https://github.com/dmuth/diceware.git
synced 2024-11-21 16:36:28 -05:00
Added a display of how many passwords were possible with the rolls.
This commit is contained in:
parent
a109bfbb5b
commit
3bf6c46df7
3 changed files with 22 additions and 3 deletions
|
@ -89,6 +89,9 @@
|
||||||
<div class="results_phrase_key" >Your passphrase is: </div>
|
<div class="results_phrase_key" >Your passphrase is: </div>
|
||||||
<div class="results_phrase_value" ></div>
|
<div class="results_phrase_value" ></div>
|
||||||
|
|
||||||
|
<div class="results_num_possible_key" ># of possible passwords: </div>
|
||||||
|
<div class="results_num_possible_value" ></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert alert-danger bad_crypto" role="alert">
|
<div class="alert alert-danger bad_crypto" role="alert">
|
||||||
|
|
21
main.js
21
main.js
|
@ -99,6 +99,7 @@ function display_row(rows, cb) {
|
||||||
|
|
||||||
var fadein_duration = 250;
|
var fadein_duration = 250;
|
||||||
var fadeout_delay = 750;
|
var fadeout_delay = 750;
|
||||||
|
console.log(rows.length, fadein_duration, fadeout_delay);
|
||||||
|
|
||||||
if (rows.length) {
|
if (rows.length) {
|
||||||
//
|
//
|
||||||
|
@ -156,13 +157,20 @@ function display_results(cb) {
|
||||||
jQuery(".results_words_key").hide().clone().appendTo(".results");
|
jQuery(".results_words_key").hide().clone().appendTo(".results");
|
||||||
jQuery(".results_words_value").hide().clone().appendTo(".results");
|
jQuery(".results_words_value").hide().clone().appendTo(".results");
|
||||||
jQuery(".results").append("<br clear=\"all\" />");
|
jQuery(".results").append("<br clear=\"all\" />");
|
||||||
|
|
||||||
jQuery(".results_phrase_key").hide().clone().appendTo(".results");
|
jQuery(".results_phrase_key").hide().clone().appendTo(".results");
|
||||||
jQuery(".results_phrase_value").hide().clone().appendTo(".results");
|
jQuery(".results_phrase_value").hide().clone().appendTo(".results");
|
||||||
|
jQuery(".results").append("<br clear=\"all\" />");
|
||||||
|
|
||||||
|
jQuery(".results_num_possible_key").hide().clone().appendTo(".results");
|
||||||
|
jQuery(".results_num_possible_value").hide().clone().appendTo(".results");
|
||||||
|
|
||||||
jQuery(".results .results_words_key").fadeIn(500, function() {
|
jQuery(".results .results_words_key").fadeIn(500, function() {
|
||||||
jQuery(".results .results_words_value").fadeIn(500, function() {
|
jQuery(".results .results_words_value").fadeIn(500, function() {
|
||||||
jQuery(".results .results_phrase_key").fadeIn(500, function() {
|
jQuery(".results .results_phrase_key").fadeIn(400, function() {
|
||||||
jQuery(".results .results_phrase_value").fadeIn(500, function() {
|
jQuery(".results .results_phrase_value").fadeIn(400, function() {
|
||||||
|
jQuery(".results .results_num_possible_key").fadeIn(300, function() {
|
||||||
|
jQuery(".results .results_num_possible_value").fadeIn(300, function() {
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
@ -170,6 +178,8 @@ function display_results(cb) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
} // End of display_results()
|
} // End of display_results()
|
||||||
|
|
||||||
|
@ -202,7 +212,10 @@ function is_mobile() {
|
||||||
//
|
//
|
||||||
jQuery("#roll_dice").on("click", function(e) {
|
jQuery("#roll_dice").on("click", function(e) {
|
||||||
|
|
||||||
var target_height = 200;
|
//
|
||||||
|
// Clear out more space when mobile
|
||||||
|
//
|
||||||
|
var target_height = 300;
|
||||||
if (is_mobile()) {
|
if (is_mobile()) {
|
||||||
target_height = 400;
|
target_height = 400;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +240,7 @@ jQuery("#roll_dice").on("click", function(e) {
|
||||||
// Make our dice rolls
|
// Make our dice rolls
|
||||||
//
|
//
|
||||||
var num_dice = jQuery(".dice_button.active").html();
|
var num_dice = jQuery(".dice_button.active").html();
|
||||||
|
var num_passwords = Number(Math.pow(6, (5 * num_dice)));
|
||||||
var passphrase = new Array();
|
var passphrase = new Array();
|
||||||
|
|
||||||
var rolls = new Array();
|
var rolls = new Array();
|
||||||
|
@ -246,6 +260,7 @@ jQuery("#roll_dice").on("click", function(e) {
|
||||||
//
|
//
|
||||||
jQuery(".results_words_value").html(passphrase.join(" "));
|
jQuery(".results_words_value").html(passphrase.join(" "));
|
||||||
jQuery(".results_phrase_value").html(passphrase.join(""));
|
jQuery(".results_phrase_value").html(passphrase.join(""));
|
||||||
|
jQuery(".results_num_possible_value").html(num_passwords.toLocaleString("en"));
|
||||||
|
|
||||||
var rows = new Array();
|
var rows = new Array();
|
||||||
for (key in rolls) {
|
for (key in rolls) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ body {
|
||||||
|
|
||||||
.results_words_key, .results_words_value,
|
.results_words_key, .results_words_value,
|
||||||
.results_phrase_key, .results_phrase_value,
|
.results_phrase_key, .results_phrase_value,
|
||||||
|
.results_num_possible_key, .results_num_possible_value,
|
||||||
.dice_word
|
.dice_word
|
||||||
{
|
{
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
|
|
Loading…
Reference in a new issue