- changed some icons
- cleaned up custom.css
This commit is contained in:
parent
bb319d6bdc
commit
516cffb3a3
@ -8,10 +8,3 @@
|
||||
input:invalid {
|
||||
border: 2px solid red;
|
||||
}
|
||||
|
||||
/*td.combatantDice, td.combatantRea {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
} */
|
||||
|
||||
45
js/sr2ini.js
45
js/sr2ini.js
@ -104,6 +104,11 @@ function handleAddButtonClick (e) {
|
||||
}
|
||||
|
||||
|
||||
function handleDamageButtonHover (e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// click handler for edit buttons
|
||||
function handleEditButtonClick (e) {
|
||||
// find current table row
|
||||
@ -231,8 +236,8 @@ function addCombatant (e) {
|
||||
'<td class="text-end">\n',
|
||||
'<div class="btn-group">\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 edit-button" title="Edit combatant\'s values"><img src="img/004-edit-button.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 act-button" title="Act and reduce ini by 10"><img src="img/003-shooting.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 remove-button" title="Remove combatant"><img src="img/002-dead-body.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 act-button" title="Act and reduce ini by 10"><img src="img/003-explosion.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 remove-button" title="Remove combatant"><img src="img/002-band-aid.png" /></button>\n',
|
||||
'</div>\n',
|
||||
'</td>\n',
|
||||
'</tr>'].join("")
|
||||
@ -315,6 +320,40 @@ function newRound() {
|
||||
}
|
||||
|
||||
|
||||
// add test combatant for testing purposes (duh)
|
||||
function addTestCombatant() {
|
||||
// construct jQuery object for table row
|
||||
let $tr = $($.parseHTML( [
|
||||
'<tr class="combatantRow align-middle">\n',
|
||||
'<td class="combatantName" title="Combatant\'s name">Test-Goon</td>\n',
|
||||
'<td class="combatantIni text-center" title="Initiative">12</td>\n',
|
||||
'<td class="text-center combatantDiceAndRea" title="Iniative dice and reaction"><span class="combatantDice">2</span>D+<span class="combatantRea">6</span></td>\n',
|
||||
'<td class="text-end">\n',
|
||||
'<div class="btn-group">\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 edit-button" title="Edit combatant\'s values"><img src="img/004-edit-button.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 act-button" title="Act and reduce ini by 10"><img src="img/003-explosion.png" /></button>\n',
|
||||
'<button type="button" class="btn btn-light btn-rounded mx-1 p-1 remove-button" title="Take damage">\n',
|
||||
'<img src="img/002-band-aid.png" />\n',
|
||||
'</button>\n',
|
||||
'</div>\n',
|
||||
'</td>\n',
|
||||
'</tr>'].join("")
|
||||
));
|
||||
|
||||
// add handlers to table row buttons
|
||||
$tr.find("button.edit-button").on("click", handleEditButtonClick);
|
||||
$tr.find("button.act-button").on("click", handleActButtonClick);
|
||||
$tr.find("button.remove-button").on("click", handleRemoveButtonClick);
|
||||
|
||||
// add handlers to table cells (click to edit)
|
||||
$tr.find(".combatantName, .combatantIni, .combatantDiceAndRea").on("click", handleEditButtonClick);
|
||||
|
||||
// add row to table and sort
|
||||
$("#combatantsTable").append($tr);
|
||||
sortTable();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize document
|
||||
*/
|
||||
@ -338,4 +377,6 @@ $(document).ready(function(){
|
||||
$("#combatantModal input[id*='combatantModal']").val("");
|
||||
})
|
||||
|
||||
// addTestCombatant();
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user