From 0b020decc1fb493be644931c3e8a4c42b6ec746a Mon Sep 17 00:00:00 2001 From: Tobias P Date: Wed, 20 Sep 2023 12:50:51 +0200 Subject: [PATCH] fixed a bug where disabling and enabling buttons for dead/KOed/ini-zero combatants wasn't working correctly; also added a surrounding
in table row stub --- src/js/sr2ini.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/js/sr2ini.js b/src/js/sr2ini.js index 6314bb1..b0afa7e 100644 --- a/src/js/sr2ini.js +++ b/src/js/sr2ini.js @@ -36,7 +36,9 @@ const COMBATANT_TABLE_ROW = [ '\n', 'D+\n', '\n', - '\n', + '
\n', + '\n', + '
\n', '
\n', '\n', '
\n', @@ -413,10 +415,11 @@ function startNewRound() { // sort combatants by ini value and add contextual classes function sortTable() { - // do some clean up: remove previous classes from rows, disable act buttons, remove effective ini and damage badges + // do some clean up: remove previous classes from rows, remove effective ini and damage badges $(".combatant-row").removeClass("ko-or-dead max-ini zero-ini"); //REGULAR_INI - $(".combatant-row").find(".act-button").prop("disabled", true).attr("aria-disabled", "true"); $(".combatant-ini").empty(); + // disable all act buttons + $(".combatant-row").find(".act-button").prop("disabled", true).attr("aria-disabled", "true"); // mark KO or death with class $(".combatant-row").each(function() { if (parseInt($(this).attr("data-damage-stun")) == 10 || parseInt($(this).attr("data-damage-physical")) == 10) { @@ -440,16 +443,16 @@ function sortTable() { $(this).find(".combatant-ini").append($.parseHTML(PHYSICAL_BADGE_HTML)); $(this).find(".physical-badge").append(DAMAGE_NIVEAU[DAMAGE_PENALTY[$(this).attr("data-damage-physical")]]); } - // K.O./dead -> don't add anything + // K.O./dead -> do nothing if ($(this).hasClass("ko-or-dead")) { return true; } - // ini = zero + // ini = zero -> set contextual class if (parseInt($(this).find(".combatant-ini").text()) == 0) { $(this).addClass("zero-ini"); return true; } - // ini = max and non-zero + // ini = max and non-zero -> enable act-button if (parseInt($(this).find(".combatant-ini").text()) == iniMax && iniMax > 0) { $(this).addClass("max-ini").find(".act-button").prop("disabled", false).removeAttr("aria-disabled"); return true;