diff --git a/index.html b/index.html index a2d3201..36ee312 100644 --- a/index.html +++ b/index.html @@ -57,21 +57,41 @@
- - - - - + + + + + + +

- +

+ +

+
+
+ + + +

+ + + +

+ +

+
+
+
diff --git a/main.js b/main.js index b4407c8..872e849 100644 --- a/main.js +++ b/main.js @@ -43,8 +43,54 @@ function get_word(wordlist, index) { } +// +// Handler to mark the clicked number of dice button as active. +// +jQuery(".dice_button").on("click", function(e) { + jQuery(".dice_button").removeClass("active"); + jQuery(e.target).addClass("active"); +}); + + +// +// Handler when the "Roll Dice" button is clicked. It gets the +// passphrase and updates the HTML with it. +// +jQuery("#roll_dice").on("click", function(e) { + + jQuery(".results_words_key").hide(); + jQuery(".results_words_value").hide(); + jQuery(".results_phrase_key").hide(); + jQuery(".results_phrase_value").hide(); + + var num_dice = jQuery(".dice_button.active").html(); + var passphrase = new Array(); + + for (var i=0; i