regenbogenkarte/ts/legend.ts
nachtjasmin e98c3de747
chore: initial fork of the closed-source project
This commit includes all data from the current map, excluding:

- the actual data
- the deployment script to the server

We've added a comprehensive README for newcomers, so that they can
understand what's going on.

Co-authored-by: xenia <xhartmann@posteo.de>
2022-09-04 10:28:56 +02:00

19 lines
569 B
TypeScript

import { LEGEND_MAPPING } from "./config";
export const setupLegend = () => {
const template = <HTMLTemplateElement>document.getElementById("legend-list-entry");
const lists = document.querySelectorAll<HTMLElement>("[data-id=legend-list]");
lists.forEach((l) => {
for (const [_, [icon, text]] of LEGEND_MAPPING) {
const copy = <HTMLElement>template.content.cloneNode(true);
const img = copy.querySelector("img")!;
img.src = icon;
const description = copy.querySelector("span")!;
description.innerText = text;
l.appendChild(copy);
}
});
};