several changes that were in conjunction with design revamp

This commit is contained in:
Tobias 2023-09-12 15:55:05 +02:00
parent d90cff7832
commit 4906f82e4c

View File

@ -31,21 +31,21 @@ const DAMAGE_PENALTY = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4];
const DAMAGE_NIVEAU = ["", "L", "M", "S", "D"]; const DAMAGE_NIVEAU = ["", "L", "M", "S", "D"];
const COMBATANT_TABLE_ROW = [ const COMBATANT_TABLE_ROW = [
'<tr class="combatant-row" data-true-ini="" data-augmented-ui="tl-scoop bl-clip-y tr-clip-y br-scoop">\n', '<tr class="combatant-row" data-true-ini="">\n',
'<td class="combatant-name" title="Combatant\'s name" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="tl-scoop bl-clip-y both"></td>\n', '<td class="combatant-name" title="Combatant\'s name" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="both"></td>\n',
'<td class="combatant-ini" title="Effective initiative (w/ wound penalties)" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="both"></td>\n', '<td class="combatant-ini" title="Effective initiative (w/ wound penalties)" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="both"></td>\n',
'<td class="combatant-dice-and-rea" title="Iniative dice and reaction" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="both"><span class="combatant-dice"></span>D+<span class="combatant-rea"></span></td>\n', '<td class="combatant-dice-and-rea" title="Iniative dice and reaction" data-bs-toggle="modal" data-bs-target="#combatant-modal" data-augmented-ui="both"><span class="combatant-dice"></span>D+<span class="combatant-rea"></span></td>\n',
'<td class="combatant-actions" data-augmented-ui="tr-clip-y br-scoop both">\n', '<td class="combatant-actions" data-augmented-ui="both">\n',
'<button type="button" class="sr2-button act-button" title="Act and reduce ini by 10"><svg viewbox="0 0 512 512" class="icon"><use href="#act" /></svg></button>\n', '<button type="button" class="sr2-button act-button" title="Act and reduce ini by 10"><svg viewbox="0 0 512 512"><use href="#act" /></svg></button>\n',
'<div class="damage-dropdown">\n', '<div class="damage-dropdown">\n',
'<button type="button" class="sr2-button damage-button" title="Take damage"><svg viewbox="0 0 512 512" class="icon"><use href="#take-damage" /></svg></button>\n', '<button type="button" class="sr2-button damage-button" title="Take damage"><svg viewbox="0 0 512 512"><use href="#take-damage" /></svg></button>\n',
'</div>\n', '</div>\n',
'<div class="actions-dropdown">\n', '<div class="actions-dropdown">\n',
'<button type="button" class="sr2-button actions-button" title="More actions"><svg viewbox="0 0 512 512" class="icon"><use href="#more-actions" /</svg></button>\n', '<button type="button" class="sr2-button actions-button" title="More actions"><svg viewbox="0 0 512 512"><use href="#more-actions" /</svg></button>\n',
'<div class="actions-menu" data-augmented-ui="tl-scoop bl-clip-y tr-clip-y br-scoop both">\n', '<div class="actions-menu" data-augmented-ui="tl-scoop bl-clip-y tr-clip-y br-scoop both">\n',
'<button type="button" class="sr2-button edit-button" title="Edit combatant" data-bs-toggle="modal" data-bs-target="#combatant-modal" tabindex="-1"><svg viewbox="0 0 512 512" class="icon"><use href="#edit" /></svg></button>\n', '<button type="button" class="sr2-button edit-button" title="Edit combatant" data-bs-toggle="modal" data-bs-target="#combatant-modal" tabindex="-1"><svg viewbox="0 0 512 512"><use href="#edit" /></svg></button>\n',
'<button type="button" class="sr2-button clone-button" title="Clone combatant" data-bs-toggle="modal" data-bs-target="#combatant-modal" tabindex="-1"><svg viewbox="0 0 512 512" class="icon"><use href="#clone" /></svg></button>\n', '<button type="button" class="sr2-button clone-button" title="Clone combatant" data-bs-toggle="modal" data-bs-target="#combatant-modal" tabindex="-1"><svg viewbox="0 0 512 512"><use href="#clone" /></svg></button>\n',
'<button type="button" class="sr2-button remove-button" title="Remove combatant" data-bs-toggle="modal" data-bs-target="#confirm-modal" tabindex="-1"><svg viewbox="0 0 512 512" class="icon"><use href="#delete" /></svg></button>\n', '<button type="button" class="sr2-button remove-button" title="Remove combatant" data-bs-toggle="modal" data-bs-target="#confirm-modal" tabindex="-1"><svg viewbox="0 0 512 512"><use href="#delete" /></svg></button>\n',
'</div>\n', '</div>\n',
'</div>\n', '</div>\n',
'</td>\n', '</td>\n',
@ -67,8 +67,8 @@ const DAMAGE_MONITOR_HTML = [
'</table>\n', '</table>\n',
'</div>'].join(""); '</div>'].join("");
const STUN_BADGE_HTML = '<sup><span class="badge bg-warning position-absolute translate-middle stun-badge" title="Stun damage niveau"></span></sup>'; const STUN_BADGE_HTML = '<sup><span class="badge bg-warning translate-middle stun-badge" title="Stun damage niveau"></span></sup>';
const PHYSICAL_BADGE_HTML = '<sub><span class="badge bg-danger position-absolute translate-middle physical-badge" title="Physical damage niveau"></span></sub>'; const PHYSICAL_BADGE_HTML = '<sub><span class="badge bg-danger translate-middle physical-badge" title="Physical damage niveau"></span></sub>';
/* /*
@ -148,8 +148,8 @@ function handleActButtonClick(event) {
function handleAddButtonClick(event) { function handleAddButtonClick(event) {
// restyle modal // restyle modal
$("#combatant-modal .modal-title").text("Add Combatant"); $("#combatant-modal .modal-title").text("Add Combatant");
$("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").removeClass("d-none"); $("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").removeClass("display-none");
$("#combatant-modal-edit-ok-button").addClass("d-none"); $("#combatant-modal-edit-ok-button").addClass("display-none");
// set default values // set default values
$("#combatant-modal-name").val("Goon 1"); $("#combatant-modal-name").val("Goon 1");
$("#combatant-modal-dice").val("2"); $("#combatant-modal-dice").val("2");
@ -173,8 +173,8 @@ function handleCloneButtonClick(event) {
$tr.find(".actions-menu").removeClass("seen"); $tr.find(".actions-menu").removeClass("seen");
// restyle modal // restyle modal
$("#combatant-modal .modal-title").text("Clone Combatant"); $("#combatant-modal .modal-title").text("Clone Combatant");
$("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").removeClass("d-none"); $("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").removeClass("display-none");
$("#combatant-modal-edit-ok-button").addClass("d-none"); $("#combatant-modal-edit-ok-button").addClass("display-none");
// populate modal with values from row // populate modal with values from row
$("#combatant-modal-name").val($tr.find(".combatant-name").text()); $("#combatant-modal-name").val($tr.find(".combatant-name").text());
$("#combatant-modal-dice").val($tr.find(".combatant-dice").attr("data-combatant-dice")); $("#combatant-modal-dice").val($tr.find(".combatant-dice").attr("data-combatant-dice"));
@ -252,8 +252,8 @@ function handleEditButtonClick(event) {
let $tr = $(event.target).parents(".combatant-row"); let $tr = $(event.target).parents(".combatant-row");
// restyle modal // restyle modal
$("#combatant-modal .modal-title").text("Edit Combatant"); $("#combatant-modal .modal-title").text("Edit Combatant");
$("#combatant-modal-edit-ok-button").removeClass("d-none"); $("#combatant-modal-edit-ok-button").removeClass("display-none");
$("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").addClass("d-none"); $("#combatant-modal-add-ok-button, #combatant-modal-add-apply-button").addClass("display-none");
// populate modal with values from row // populate modal with values from row
$("#combatant-modal-name").val($tr.find(".combatant-name").text()); $("#combatant-modal-name").val($tr.find(".combatant-name").text());
$("#combatant-modal-dice").val($tr.find(".combatant-dice").attr("data-combatant-dice")); $("#combatant-modal-dice").val($tr.find(".combatant-dice").attr("data-combatant-dice"));
@ -291,8 +291,8 @@ function handleMoreActionsButtonClick(event) {
function handleNewRoundButtonClick(event) { function handleNewRoundButtonClick(event) {
// restyle modal // restyle modal
$("#confirm-modal .modal-title").text("Start new Round"); $("#confirm-modal .modal-title").text("Start new Round");
$("#confirm-modal-new-round-ok-button").removeClass("d-none"); $("#confirm-modal-new-round-ok-button").removeClass("display-none");
$("#confirm-modal-remove-combatant-ok-button").addClass("d-none"); $("#confirm-modal-remove-combatant-ok-button").addClass("display-none");
// add handler for enter key // add handler for enter key
$("#confirm-modal").off("keydown"); $("#confirm-modal").off("keydown");
$("#confirm-modal").on("keydown", (e) => { $("#confirm-modal").on("keydown", (e) => {
@ -307,8 +307,8 @@ function handleNewRoundButtonClick(event) {
function handleRemoveButtonClick(event) { function handleRemoveButtonClick(event) {
// restyle modal // restyle modal
$("#confirm-modal .modal-title").text("Remove Combatant"); $("#confirm-modal .modal-title").text("Remove Combatant");
$("#confirm-modal-remove-combatant-ok-button").removeClass("d-none"); $("#confirm-modal-remove-combatant-ok-button").removeClass("display-none");
$("#confirm-modal-new-round-ok-button").addClass("d-none"); $("#confirm-modal-new-round-ok-button").addClass("display-none");
// mark which row is being removed // mark which row is being removed
$("#confirm-modal").data("row", $(".combatant-row").index($(event.target).parents(".combatant-row"))); // here it's okay to use .data() b/c HTML/CSS does not care about this value $("#confirm-modal").data("row", $(".combatant-row").index($(event.target).parents(".combatant-row"))); // here it's okay to use .data() b/c HTML/CSS does not care about this value
// add handler for enter key // add handler for enter key
@ -555,5 +555,3 @@ $(document).ready(function () {
}); });
addTestCombatant(); addTestCombatant();
}); });
//module.exports = { rollForInitiative, validateCombatant, whoGoesFirst, getEffectiveIni };