Trefferwurf-Knopf dezent als .btn, Cache-Buster aus Dateizeit statt fester Version

This commit is contained in:
torsten 2026-11-22 19:16:38 +01:00
parent f9126675b2
commit 38ad53254c
3 changed files with 19 additions and 27 deletions

View file

@ -88,12 +88,19 @@ function url(string $path = '/'): string
return $base . $path;
}
/** Cache-Buster: bei Änderungen an app.css/app.js erhöhen. */
/** Notnagel-Cache-Buster, falls eine Datei fehlt (normal: Änderungszeit). */
const WS_ASSET_VERSION = '5';
/**
* Asset-URL mit Cache-Buster. Die Version ist die Änderungszeit der Datei –
* dadurch kommen neue app.css/app.js ohne manuelles Hochzählen an.
*/
function asset(string $path): string
{
return url('/assets/' . ltrim($path, '/')) . '?v=' . WS_ASSET_VERSION;
$relative = ltrim($path, '/');
$file = WS_ROOT . '/assets/' . $relative;
$version = is_file($file) ? (string) filemtime($file) : WS_ASSET_VERSION;
return url('/assets/' . $relative) . '?v=' . $version;
}
function redirect(string $path, int $status = 303): never

View file

@ -821,30 +821,14 @@ input[type="file"] {
.stat .b.bonus-zero { color: var(--parchment-dim); }
.stat .b.bonus-neg { color: #e0756a; }
/* --- Trefferwürfe: Rechenkette als Feld, Overlay zum Bearbeiten --------- */
/* --- Trefferwürfe: Rechenkette als Knopf, Overlay zum Bearbeiten --------- */
.hp-sum {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 0.6rem;
width: 100%;
padding: 0.55rem 0.7rem;
border: 1px solid rgba(201, 162, 39, 0.35);
border-radius: var(--radius);
background: rgba(6, 9, 16, 0.55);
color: var(--parchment);
font: inherit;
justify-content: flex-start;
letter-spacing: 0.06em;
font-variant-numeric: tabular-nums;
letter-spacing: 0.02em;
text-align: left;
cursor: pointer;
}
.hp-sum:hover,
.hp-sum:focus-visible {
border-color: var(--gold);
background: rgba(201, 162, 39, 0.12);
}
.hp-sum small { color: var(--parchment-dim); font-size: 0.72rem; white-space: nowrap; }
.hp-sum span { text-transform: none; }
.hp-sum small { color: var(--parchment-dim); font-size: 0.68rem; letter-spacing: 0.1em; }
.hp-roll-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));

View file

@ -76,13 +76,14 @@ $hpSlotValue = static fn (int $slot): string => ((int) ($hpRolls[$slot] ?? 0)) >
<div class="field" style="grid-column: span 2;">
<span>Trefferwürfe <small class="muted">Stufe 0 (1W<?= (int) WS_HP_LEVEL0_DIE ?>), dann Stufe 1 … <?= (int) $hp['level'] ?></small></span>
<input type="hidden" name="hp_rolls" data-hp-input value="<?= e(hp_rolls_format($hpRolls)) ?>">
<button class="hp-sum" type="button" data-dialog-open="#hp-rolls-dialog" title="Einzelne Würfe bearbeiten">
<button class="btn hp-sum" type="button" data-dialog-open="#hp-rolls-dialog" title="Einzelne Würfe bearbeiten">
<span data-hp-sum><?= e(hp_rolls_sum($values)) ?></span>
<small>bearbeiten</small>
<small class="muted">bearbeiten</small>
</button>
<small class="muted">
<?= (int) $hp['con'] === 0 ? 'ohne Konstitutionsbonus' : 'Konstitutionsbonus ' . e(signed((int) $hp['con'])) . ' eingerechnet' ?>
· fehlende Würfe zählen nicht mit
<?= $hp['complete']
? ((int) $hp['con'] === 0 ? '' : 'Konstitutionsbonus ' . e(signed((int) $hp['con'])) . ' eingerechnet')
: 'fehlende Würfe zählen nicht mit' ?>
</small>
</div>
<label class="field">