mirror of
https://github.com/dmuth/diceware.git
synced 2024-10-22 23:12:09 -04:00
Added option to not show the dice animation. #15
This commit is contained in:
parent
030c87fe41
commit
3797819494
3 changed files with 29 additions and 29484 deletions
29478
dist/bundle.js
vendored
29478
dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
11
index.html
11
index.html
|
@ -266,6 +266,17 @@ Examples: <a href="?debug=4">Roll the Dice 4 times.</a>
|
||||||
<p/>
|
<p/>
|
||||||
|
|
||||||
|
|
||||||
|
<a name="skip_animation"></a>
|
||||||
|
<h3>FAQ: Is there a way to skip the dice animation?</h3>
|
||||||
|
|
||||||
|
Yeah. Append "?skip_animation" to the URL to not display the dice animation
|
||||||
|
<p/>
|
||||||
|
<p/>
|
||||||
|
|
||||||
|
Examples: <a href="?debug=4&skip_animation">4 dice rolls with no animation</a>
|
||||||
|
<p/>
|
||||||
|
|
||||||
|
|
||||||
<a name="wordlist"></a>
|
<a name="wordlist"></a>
|
||||||
<h3>FAQ: Can you tell me more about the list of words?</h3>
|
<h3>FAQ: Can you tell me more about the list of words?</h3>
|
||||||
|
|
||||||
|
|
22
src/index.js
22
src/index.js
|
@ -214,7 +214,6 @@ Diceware.rollDiceHandler = function(e) {
|
||||||
|
|
||||||
Diceware.rollDiceHanlderPre();
|
Diceware.rollDiceHanlderPre();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make our dice rolls
|
// Make our dice rolls
|
||||||
//
|
//
|
||||||
|
@ -308,7 +307,11 @@ Diceware.rollDiceHanlderPost = function(rolls, passphrase, num_passwords) {
|
||||||
//
|
//
|
||||||
row.append("<br clear=\"all\" />");
|
row.append("<br clear=\"all\" />");
|
||||||
|
|
||||||
|
if ("skip_animation" in Diceware.get_data) {
|
||||||
|
console.log("Debug value 'skip_animation' set, not showing the dice!");
|
||||||
|
} else {
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,6 +385,11 @@ Diceware.go = function() {
|
||||||
|
|
||||||
console.log("Thanks for checking out my code! You can find the Git repo at https://github.com/dmuth/diceware");
|
console.log("Thanks for checking out my code! You can find the Git repo at https://github.com/dmuth/diceware");
|
||||||
|
|
||||||
|
Diceware.get_data = Diceware.extractGetData(location.search);
|
||||||
|
// TEST
|
||||||
|
//if ("skip_animation" in get_data) {
|
||||||
|
console.log("GET Data: " + JSON.stringify(Diceware.get_data)); // Debugging
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handler to mark the clicked number of dice button as active.
|
// Handler to mark the clicked number of dice button as active.
|
||||||
//
|
//
|
||||||
|
@ -406,12 +414,10 @@ Diceware.go = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var get_data = Diceware.extractGetData(location.search);
|
|
||||||
|
|
||||||
var dice = 5;
|
var dice = 5;
|
||||||
if (get_data["dice"]) {
|
if (Diceware.get_data["dice"]) {
|
||||||
if (get_data["dice"] >= 5 && get_data["dice"] <= 7) {
|
if (Diceware.get_data["dice"] >= 5 && Diceware.get_data["dice"] <= 7) {
|
||||||
dice = get_data["dice"];
|
dice = Diceware.get_data["dice"];
|
||||||
Diceware.num_dice_per_roll = dice;
|
Diceware.num_dice_per_roll = dice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,9 +447,9 @@ Diceware.go = function() {
|
||||||
//
|
//
|
||||||
var debug = location.search.indexOf("debug");
|
var debug = location.search.indexOf("debug");
|
||||||
|
|
||||||
if (get_data["debug"] && get_data["debug"] > 0) {
|
if (Diceware.get_data["debug"] && Diceware.get_data["debug"] > 0) {
|
||||||
|
|
||||||
var num = get_data["debug"];
|
var num = Diceware.get_data["debug"];
|
||||||
if (num < 2) {
|
if (num < 2) {
|
||||||
num = 2;
|
num = 2;
|
||||||
} else if (num > 8) {
|
} else if (num > 8) {
|
||||||
|
|
Loading…
Reference in a new issue