54 lines
2.9 KiB
HTML
54 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>MapTool symbols</title>
|
|
<link rel="icon" href="/icons/icon.svg" type="image/svg+xml">
|
|
<style>
|
|
:root { --bg: #fff; --fg: #1a1a1a; --muted: #666; --line: #ddd; --hover: #eef3ee; }
|
|
@media (prefers-color-scheme: dark) { :root { --bg: #1a1a1a; --fg: #eee; --muted: #999; --line: #333; --hover: #26302a; } }
|
|
body { margin: 0; padding: 16px; background: var(--bg); color: var(--fg); font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
|
|
header { position: sticky; top: 0; background: var(--bg); padding-bottom: 12px; }
|
|
h1 { font-size: 1.2rem; margin: 0 0 4px; }
|
|
p { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; }
|
|
input { width: 100%; max-width: 420px; box-sizing: border-box; padding: 8px; font-size: 1rem; }
|
|
main { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
|
|
button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.75rem; text-align: center; word-break: break-word; }
|
|
button:hover, button:focus-visible { background: var(--hover); }
|
|
button[hidden] { display: none; }
|
|
button svg { width: 32px; height: 32px; }
|
|
small { color: var(--muted); }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Point symbols</h1>
|
|
<p>National Park Service map symbols (CC0) and the OsmAnd names mapped onto them. Click one to copy its name, the value of a point's <code>icon</code> property.</p>
|
|
<input type="search" placeholder="Search" autofocus>
|
|
</header>
|
|
<main></main>
|
|
<script type="module">
|
|
import { POI_ICONS } from "/js/icons.js";
|
|
|
|
const main = document.querySelector("main");
|
|
const aliases = {}; // svg -> OsmAnd names pointing at it
|
|
for (const [key, svg] of Object.entries(POI_ICONS)) if (key.includes("_")) (aliases[svg] ||= []).push(key);
|
|
for (const [key, svg] of Object.entries(POI_ICONS)) {
|
|
if (key.includes("_")) continue;
|
|
const button = document.createElement("button");
|
|
button.innerHTML = svg;
|
|
button.append(key);
|
|
for (const alias of aliases[svg] || []) button.append(Object.assign(document.createElement("small"), { textContent: alias }));
|
|
button.dataset.search = [key, ...(aliases[svg] || [])].join(" ").replace(/[-_]/g, " ");
|
|
button.addEventListener("click", () => navigator.clipboard?.writeText(key));
|
|
main.append(button);
|
|
}
|
|
document.querySelector("input").addEventListener("input", (event) => {
|
|
const words = event.target.value.toLowerCase().split(/\s+/).filter(Boolean);
|
|
for (const button of main.children) button.hidden = !words.every((w) => button.dataset.search.includes(w));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|