diff --git a/package.json b/package.json index 54126f0..07d377c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "green-hell-maps", - "version": "1.5.0", + "version": "1.6.0", "description": "Green Hell interactive maps", "repository": "https://github.com/Daschi1/green-hell-maps", "author": "Daschi", diff --git a/src/app.html b/src/app.html index 4e802e2..3c0215d 100644 --- a/src/app.html +++ b/src/app.html @@ -5,7 +5,7 @@ - + { // assign array if empty if (!coordinates) coordinates = []; - if (!coordinates.includes(coordinate)) { + const exists = coordinates.includes(coordinate); + if (!exists) { // add coordinate if they don't exist coordinates = [...coordinates, coordinate]; } else { // remove coordinate if they exist coordinates = coordinates.filter((c) => c !== coordinate); } + nextClicked = !exists; + nextCount = coordinates.length; // null array if empty if (coordinates.length === 0) coordinates = null; return coordinates; }); + + // Send analytics event (safe for SSR and missing script) + if (typeof window !== "undefined" && (window as any).stonks?.event) { + try { + (window as any).stonks.event("Coordinate Toggle", { + coordinate_id: String(coordinate), + west_deg: String(west), + south_deg: String(south), + selected: String(Boolean(nextClicked)), + action: nextClicked ? "enable" : "disable", + selected_count: String(nextCount ?? 0) + }); + } catch { + // no-op + } + } } diff --git a/static/licenses.json b/static/licenses.json index 024e62b..42fac01 100644 --- a/static/licenses.json +++ b/static/licenses.json @@ -120,12 +120,12 @@ "description": "Global identifiers from different JavaScript environments", "copyright": "Copyright (c) Sindre Sorhus (https://sindresorhus.com)" }, - "green-hell-maps@1.2.0": { + "green-hell-maps@1.6.0": { "licenses": "Custom: https://green-hell-maps.daschi.dev/", "repository": "https://github.com/Daschi1/green-hell-maps", "publisher": "Daschi", "name": "green-hell-maps", - "version": "1.2.0", + "version": "1.6.0", "description": "Green Hell interactive maps" }, "license-checker@25.0.1": { diff --git a/static/robots.txt b/static/robots.txt index 36122f3..7cf1390 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,3 +1,4 @@ User-agent: * Disallow: + Sitemap: https://green-hell-maps.daschi.dev/sitemap.xml