From 516cffb3a3a4555a46bf02329c745e75247d06ab Mon Sep 17 00:00:00 2001 From: Tobias Date: Sun, 5 Feb 2023 13:58:03 +0100 Subject: [PATCH] - changed some icons - cleaned up custom.css --- css/custom.css | 7 ------- js/sr2ini.js | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/css/custom.css b/css/custom.css index 2d33053..7e9203c 100644 --- a/css/custom.css +++ b/css/custom.css @@ -8,10 +8,3 @@ input:invalid { border: 2px solid red; } - -/*td.combatantDice, td.combatantRea { - width: 35%; -} - -button:disabled { -} */ diff --git a/js/sr2ini.js b/js/sr2ini.js index 3e34081..79da508 100644 --- a/js/sr2ini.js +++ b/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) { '\n', '
\n', '\n', - '\n', - '\n', + '\n', + '\n', '
\n', '\n', ''].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( [ + '\n', + 'Test-Goon\n', + '12\n', + '2D+6\n', + '\n', + '
\n', + '\n', + '\n', + '\n', + '
\n', + '\n', + ''].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(); + });