mirror of
https://github.com/dmuth/diceware.git
synced 2024-11-21 16:36:28 -05:00
Added ids to buttons and updated debug code to click the appropriate
button.
This commit is contained in:
parent
7598f49c4a
commit
f2682d341f
2 changed files with 27 additions and 9 deletions
14
index.html
14
index.html
|
@ -127,13 +127,13 @@
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="btn-group-lg" role="group" aria-label="...">
|
<div class="btn-group-lg" role="group" aria-label="...">
|
||||||
<button type="button" class="btn btn-default dice_button">2</button>
|
<button id="button-dice-2" type="button" class="btn btn-default dice_button">2</button>
|
||||||
<button type="button" class="btn btn-default dice_button">3</button>
|
<button id="button-dice-3" type="button" class="btn btn-default dice_button">3</button>
|
||||||
<button type="button" class="btn btn-default dice_button active">4</button>
|
<button id="button-dice-4" type="button" class="btn btn-default dice_button active">4</button>
|
||||||
<button type="button" class="btn btn-default dice_button">5</button>
|
<button id="button-dice-5" type="button" class="btn btn-default dice_button">5</button>
|
||||||
<button type="button" class="btn btn-default dice_button">6</button>
|
<button id="button-dice-6" type="button" class="btn btn-default dice_button">6</button>
|
||||||
<button type="button" class="btn btn-default dice_button">7</button>
|
<button id="button-dice-7" type="button" class="btn btn-default dice_button">7</button>
|
||||||
<button type="button" class="btn btn-default dice_button">8</button>
|
<button id="button-dice-8" type="button" class="btn btn-default dice_button">8</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
22
main.js
22
main.js
|
@ -377,8 +377,26 @@ Diceware.go = function() {
|
||||||
// If "debug" is set in the GET data, roll the dice on page load.
|
// If "debug" is set in the GET data, roll the dice on page load.
|
||||||
// Speed up my development a bit. :-)
|
// Speed up my development a bit. :-)
|
||||||
//
|
//
|
||||||
if (location.search.indexOf("debug") != -1) {
|
var debug = location.search.indexOf("debug");
|
||||||
jQuery("#roll_dice").click(); // Debugging
|
|
||||||
|
if (debug != -1) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Grab our number in the GET data, sanitize it, and click the appropriate button.
|
||||||
|
//
|
||||||
|
var offset = location.search.search("=");
|
||||||
|
var num = location.search[offset + 1];
|
||||||
|
if (num < 2) {
|
||||||
|
num = 2;
|
||||||
|
} else if (num > 8) {
|
||||||
|
num = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id="#button-dice-" + num;
|
||||||
|
jQuery(id).click();
|
||||||
|
|
||||||
|
jQuery("#roll_dice").click();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(
|
}).fail(
|
||||||
|
|
Loading…
Reference in a new issue