diff --git a/static/script.js b/static/script.js index ecbf64ac..e98cc426 100644 --- a/static/script.js +++ b/static/script.js @@ -159,9 +159,21 @@ function createNewListItem() { } }); + const charBtn = document.createElement('button'); + charBtn.className = 'char-btn'; + charBtn.textContent = 'Char'; + charBtn.addEventListener('click', (e) => { + e.stopPropagation(); + const playerData = e.currentTarget.playerData || e.target.closest('li.player-item')?.playerData; + if (playerData) { + showCharacterWindow(playerData.character_name); + } + }); + buttonsContainer.appendChild(chatBtn); buttonsContainer.appendChild(statsBtn); buttonsContainer.appendChild(inventoryBtn); + buttonsContainer.appendChild(charBtn); li.appendChild(buttonsContainer); // Store references for easy access @@ -169,6 +181,7 @@ function createNewListItem() { li.chatBtn = chatBtn; li.statsBtn = statsBtn; li.inventoryBtn = inventoryBtn; + li.charBtn = charBtn; return li; } @@ -1075,6 +1088,22 @@ function showInventoryWindow(name) { debugLog('Inventory window created for:', name); } +function showCharacterWindow(name) { + debugLog('showCharacterWindow called for:', name); + const windowId = `characterWindow-${name}`; + + const { win, content, isNew } = createWindow( + windowId, `Character: ${name}`, 'character-window' + ); + + if (!isNew) { + debugLog('Existing character window found, showing it'); + return; + } + + content.innerHTML = '
Awaiting character data...
'; +} + // Inventory tooltip functions let inventoryTooltip = null;