- updated footer
- changed way to show/hide .damage-monitor elements; now works via bootstrap class "d-none" instead of changing "display" attribute - same for modal OK buttons
This commit is contained in:
parent
938f32cb8c
commit
10830728b2
@ -44,7 +44,6 @@ input:invalid {
|
||||
}
|
||||
|
||||
.damage-monitor {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 20;
|
||||
top: 40px;
|
||||
@ -75,3 +74,10 @@ input:invalid {
|
||||
.damage-monitor button.active {
|
||||
filter: brightness(91%);
|
||||
}
|
||||
|
||||
footer p {
|
||||
font-size: x-small;
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
footer hr {
|
||||
margin: .5rem 0;
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary" id="confirmModalNewRoundOkButton" data-bs-dismiss="modal">OK</button>
|
||||
<button type="submit" class="btn btn-primary" id="confirmModalRemoveCombatantOkButton" data-bs-dismiss="modal" style="display: none">OK</button>
|
||||
<button type="submit" class="btn btn-primary d-none" id="confirmModalRemoveCombatantOkButton" data-bs-dismiss="modal">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -94,16 +94,17 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" id="combatantModalCancelButton" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary" id="combatantModalAddOkButton">OK</button>
|
||||
<button type="submit" class="btn btn-primary" id="combatantModalEditOkButton" style="display: none">OK</button>
|
||||
<button type="submit" class="btn btn-primary d-none" id="combatantModalEditOkButton">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<footer class="footer fixed-bottom bg-light py-1 my-1">
|
||||
<footer class="footer fixed-bottom bg-light">
|
||||
<hr />
|
||||
<p class="text-center text-muted">Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></p>
|
||||
<p class="text-center text-muted">code & design by <a href="https://tobias-radloff.de/">Eclipse</a> | Shadowrun trademarked by <a href="https://www.topps.com/">Topps</a></br>
|
||||
icons by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> | banner image from <a href="https://www.pinterest.ph/artstation/">Artstation-HQ</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
31
js/sr2ini.js
31
js/sr2ini.js
@ -18,7 +18,7 @@ const COMBATANT_TABLE_ROW = [
|
||||
'</tr>'].join("");
|
||||
|
||||
const DAMAGE_MONITOR_HTML = [
|
||||
'<table class="bg-light damage-monitor text-center align-middle">\n',
|
||||
'<table class="bg-light damage-monitor text-center align-middle d-none">\n',
|
||||
'<tr>\n',
|
||||
'<td><button class="btn btn-sm btn-warning damage-stun active" title="+/-0">0</button></td>\n',
|
||||
'<td><button class="btn btn-sm btn-danger damage-physical active" title="+/-0">0</button></td>\n',
|
||||
@ -84,7 +84,6 @@ function sortTable() {
|
||||
//TODO: don't rely on class out-of-commission being set, check and set it here instead
|
||||
return $(tr).hasClass("out-of-commission") ? 0 : parseInt($(tr).find(".combatantIni").text());
|
||||
});
|
||||
//TODO: maxIni wid nicht vergeben wenn damage > 0
|
||||
|
||||
// compute highest ini
|
||||
let iniMax = Math.max.apply(null, iniValues);
|
||||
@ -139,7 +138,7 @@ function getEffectiveIni(value, damageLevel1, damageLevel2) {
|
||||
else {
|
||||
return NaN;
|
||||
}
|
||||
//TODO: maybe check here for out-of-commission and return 'dead' or something instead of int
|
||||
//TODO: maybe check here for out-of-commission and return 'dead' or something instead of integer
|
||||
return effectiveIni < 0 ? 0 : effectiveIni;
|
||||
}
|
||||
|
||||
@ -172,8 +171,8 @@ function handleAddButtonClick (e) {
|
||||
|
||||
// restyle modal
|
||||
$("#combatantModal .modal-title").text("Add Combatant");
|
||||
$("#combatantModalAddOkButton").show();
|
||||
$("#combatantModalEditOkButton").hide();
|
||||
$("#combatantModalAddOkButton").removeClass("d-none");
|
||||
$("#combatantModalEditOkButton").addClass("d-none");
|
||||
|
||||
// add handler for enter key
|
||||
$("#combatantModal input[id*='combatantModal']").off("keydown");
|
||||
@ -190,14 +189,14 @@ function handleAddButtonClick (e) {
|
||||
// click handler for damage buttons; basically toggles visibility of table.damage-monitor
|
||||
function handleDamageButtonClick (e) {
|
||||
// get visibility status at click time
|
||||
let visAtClick = $(e.target).parents(".damage-dropdown").find(".damage-monitor").css("display");
|
||||
let hiddenAtClick = $(e.target).parents(".damage-dropdown").find(".damage-monitor").hasClass("d-none");
|
||||
|
||||
// hide all damage monitors
|
||||
$(".damage-monitor:visible").css("display", "none");
|
||||
$(".damage-monitor:visible").addClass("d-none");
|
||||
|
||||
// if targeted dm was hidden before, show it now
|
||||
if ( visAtClick == "none" ) {
|
||||
$(e.target).parents(".damage-dropdown").find(".damage-monitor").css("display", "block");
|
||||
if ( hiddenAtClick ) {
|
||||
$(e.target).parents(".damage-dropdown").find(".damage-monitor").removeClass("d-none");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -261,8 +260,8 @@ function handleEditButtonClick (e) {
|
||||
|
||||
// restyle modal
|
||||
$("#combatantModal .modal-title").text("Edit Combatant");
|
||||
$("#combatantModalAddOkButton").hide();
|
||||
$("#combatantModalEditOkButton").show();
|
||||
$("#combatantModalAddOkButton").addClass("d-none");
|
||||
$("#combatantModalEditOkButton").removeClass("d-none");
|
||||
|
||||
// populate modal with values from row
|
||||
$("#combatantModalName").val($tr.find(".combatantName").text());
|
||||
@ -290,8 +289,8 @@ function handleEditButtonClick (e) {
|
||||
function handleNewRoundButton (e) {
|
||||
// restyle modal
|
||||
$("#confirmModal .modal-title").text("Start new Round");
|
||||
$("#confirmModalNewRoundOkButton").show();
|
||||
$("#confirmModalRemoveCombatantOkButton").hide();
|
||||
$("#confirmModalNewRoundOkButton").removeClass("d-none");
|
||||
$("#confirmModalRemoveCombatantOkButton").addClass("d-none");
|
||||
|
||||
// show modal
|
||||
$("#comfirmModal").modal("show");
|
||||
@ -302,8 +301,8 @@ function handleNewRoundButton (e) {
|
||||
function handleRemoveButtonClick (e) {
|
||||
// restyle modal
|
||||
$("#confirmModal .modal-title").text("Remove Combatant");
|
||||
$("#confirmModalRemoveCombatantOkButton").show();
|
||||
$("#confirmModalNewRoundOkButton").hide();
|
||||
$("#confirmModalRemoveCombatantOkButton").removeClass("d-none");
|
||||
$("#confirmModalNewRoundOkButton").addClass("d-none");
|
||||
|
||||
// mark which row is being removed
|
||||
$("#confirmModal").attr("data-row", $(".combatantRow").index($(e.target).parents(".combatantRow")));
|
||||
@ -544,7 +543,7 @@ $(document).ready(function(){
|
||||
// Hide damage monitors after click somewhere else
|
||||
$("html").on("click", function (e) {
|
||||
if ( $(e.target).parents(".damage-monitor").length == 0 ) {
|
||||
$(".damage-monitor:visible").css("display", "none");
|
||||
$(".damage-monitor:visible").addClass("d-none");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user