From c380112d5f29b68bfa301527405fdf372835900e Mon Sep 17 00:00:00 2001 From: David Skoland Date: Wed, 11 Feb 2026 00:10:05 +0100 Subject: Filter playerlist by area and remove Area column Hide players not in the client's current area. Re-render playerlist on area switch. Remove the now-redundant Area column. Co-Authored-By: Claude Opus 4.6 --- webAO/dom/areaClick.ts | 2 ++ webAO/dom/renderPlayerList.ts | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'webAO/dom') diff --git a/webAO/dom/areaClick.ts b/webAO/dom/areaClick.ts index f7b177e..27682c7 100644 --- a/webAO/dom/areaClick.ts +++ b/webAO/dom/areaClick.ts @@ -1,4 +1,5 @@ import { client } from "../client"; +import { renderPlayerList } from "./renderPlayerList"; /** * Triggered when an item on the area list is clicked. * @param {HTMLElement} el @@ -12,5 +13,6 @@ export function area_click(el: HTMLElement) { areaHr.textContent = `switched to ${el.textContent}`; document.getElementById("client_log")!.appendChild(areaHr); client.area = Number(el.id.substring(4)); + renderPlayerList(); } window.area_click = area_click; diff --git a/webAO/dom/renderPlayerList.ts b/webAO/dom/renderPlayerList.ts index a78851b..a382194 100644 --- a/webAO/dom/renderPlayerList.ts +++ b/webAO/dom/renderPlayerList.ts @@ -6,7 +6,7 @@ export function renderPlayerList() { list.innerHTML = ""; const header = list.createTHead().insertRow(); - for (const label of ["Icon", "Character", "Showname", "OOC Name", "Area"]) { + for (const label of ["Icon", "Character", "Showname", "OOC Name"]) { const th = document.createElement("th"); th.textContent = label; header.appendChild(th); @@ -16,6 +16,7 @@ export function renderPlayerList() { for (const [playerID, player] of client.playerlist) { const playerRow = body.insertRow(); playerRow.id = `client_playerlist_entry${playerID}`; + playerRow.style.display = player.area === client.area ? "" : "none"; const imgCell = playerRow.insertCell(0); imgCell.style.width = "64px"; @@ -38,17 +39,14 @@ export function renderPlayerList() { const oocNameCell = playerRow.insertCell(3); oocNameCell.textContent = player.name; - const areaCell = playerRow.insertCell(4); - areaCell.textContent = String(player.area); - - const kickCell = playerRow.insertCell(5); + const kickCell = playerRow.insertCell(4); kickCell.style.width = "64px"; const kick = document.createElement("button"); kick.innerText = "Kick"; kick.onclick = () => window.kickPlayer(playerID); kickCell.appendChild(kick); - const banCell = playerRow.insertCell(6); + const banCell = playerRow.insertCell(5); banCell.style.width = "64px"; const ban = document.createElement("button"); ban.innerText = "Ban"; -- cgit