From 705bb39fbe20c2b17788b4f2ab859674edc02de6 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 31 Aug 2024 15:14:48 +0200 Subject: hide out of area players --- webAO/dom/updatePlayerAreas.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 webAO/dom/updatePlayerAreas.ts (limited to 'webAO/dom/updatePlayerAreas.ts') diff --git a/webAO/dom/updatePlayerAreas.ts b/webAO/dom/updatePlayerAreas.ts new file mode 100644 index 0000000..d2ec076 --- /dev/null +++ b/webAO/dom/updatePlayerAreas.ts @@ -0,0 +1,16 @@ +import { client } from '../client' +import { area_click } from './areaClick'; +/** + * Triggered when someone switches areas + * @param {Number} ownarea + */ +export function updatePlayerAreas(ownarea: number) { + for (let i=0; i < client.areas.length; i++) { + if (i===ownarea) + for (let classelement of Array.from(document.getElementsByClassName(`area${i}`) as HTMLCollectionOf)) + classelement.style.display = ""; + else + for (let classelement of Array.from(document.getElementsByClassName(`area${i}`) as HTMLCollectionOf)) + classelement.style.display = "none"; + } +} \ No newline at end of file -- cgit