This commit is contained in:
torsten 2026-10-18 23:39:38 +02:00
parent 058ff6a21d
commit 565c5c43f9

View file

@ -138,8 +138,9 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
.breakdown-modal[hidden] { display: none; }
.breakdown-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.breakdown-modal-dialog {
position: relative;
margin: 12vh auto;
position: absolute;
left: 50%;
transform: translateX(-50%);
max-width: 440px;
width: calc(100% - 2em);
background: #fff;
@ -334,12 +335,28 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
var body = document.getElementById('breakdown-modal-body');
if (!modal || !body) return;
function open(html) { body.innerHTML = html; modal.hidden = false; }
function open(html, anchor) {
body.innerHTML = html;
modal.hidden = false;
var dialog = modal.querySelector('.breakdown-modal-dialog');
var height = dialog.offsetHeight;
var top;
if (anchor) {
var rect = anchor.getBoundingClientRect();
top = rect.top + rect.height / 2 - height / 2;
} else {
top = 0.12 * window.innerHeight;
}
var maxTop = window.innerHeight - height - 16;
top = Math.max(8, Math.min(top, maxTop));
dialog.style.top = top + 'px';
}
function close() { modal.hidden = true; }
document.querySelectorAll('.round-points-link').forEach(function (btn) {
btn.addEventListener('click', function () {
open(btn.getAttribute('data-breakdown'));
open(btn.getAttribute('data-breakdown'), btn);
});
});
modal.addEventListener('click', function (e) {