This commit is contained in:
2026-03-05 22:38:31 +02:00
parent e520ff8bc5
commit e879703041
9 changed files with 106 additions and 112 deletions

View File

@@ -13,8 +13,6 @@ const SPECIAL_CARD_ORDER = {
'☕': 3,
};
const CARD_ICONS = ['★', '◆', '✦', '☀', '☘', '⚙', '♣', '♠', '♥', '♦', '✚', '⚡', '☾', '✿'];
const roomConfigForm = document.getElementById('room-config-form');
const statusLine = document.getElementById('config-status');
const scaleSelect = document.getElementById('estimation-scale');
@@ -49,6 +47,10 @@ if (savedUsername && !usernameInput.value) {
usernameInput.value = savedUsername;
}
if (!window.CardUI || typeof window.CardUI.appendFace !== 'function') {
throw new Error('CardUI is not loaded. Ensure /static/js/cards.js is included before config.js.');
}
function parseNumericCard(value) {
if (!/^-?\d+(\.\d+)?$/.test(value)) {
@@ -84,36 +86,6 @@ function createCard(value) {
return { id: String(nextCardID++), value: value.toString() };
}
function iconForCard(value) {
if (value === '?') return '❓';
if (value === '☕') return '☕';
if (value === '∞') return '∞';
let hash = 0;
for (let i = 0; i < value.length; i += 1) {
hash = (hash * 31 + value.charCodeAt(i)) >>> 0;
}
return CARD_ICONS[hash % CARD_ICONS.length];
}
function appendCardFace(el, value) {
const topLeft = document.createElement('span');
topLeft.className = 'card-corner top-left';
topLeft.textContent = value;
const center = document.createElement('span');
center.className = 'card-center-icon';
center.textContent = iconForCard(value);
const bottomRight = document.createElement('span');
bottomRight.className = 'card-corner bottom-right';
bottomRight.textContent = value;
el.appendChild(topLeft);
el.appendChild(center);
el.appendChild(bottomRight);
}
function getCardsForScale(scale) {
return (SCALE_PRESETS[scale] || SCALE_PRESETS.fibonacci).map(createCard);
}
@@ -190,7 +162,7 @@ function buildCardElement(card) {
cardEl.className = 'preview-card';
cardEl.dataset.cardId = card.id;
cardEl.draggable = true;
appendCardFace(cardEl, card.value);
window.CardUI.appendFace(cardEl, card.value);
const removeBtn = document.createElement('button');
removeBtn.type = 'button';