Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="google-site-verification" content="-JXDzBf7cjq9n7scSuOIpyD4VPE-1PYaV611k0NwbwA" />
<script defer src="https://assets.onedollarstats.com/stonks.js" id="stonks"></script>
<script defer src="https://assets.onedollarstats.com/stonks.js"></script>

<!-- Light mode favicon (Safari and IE don't support svg favicons) -->
<link
Expand Down
24 changes: 23 additions & 1 deletion src/lib/Coordinate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,42 @@
let opacity = $derived(visible ? $coordinateOverlayOpacity : 0);

function toggleClicked() {
let nextClicked: boolean | undefined;
let nextCount: number | undefined;

clickedCoordinates.update((coordinates) => {
// 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
}
}
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions static/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
"description": "Global identifiers from different JavaScript environments",
"copyright": "Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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": {
Expand Down
1 change: 1 addition & 0 deletions static/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
User-agent: *
Disallow:

Sitemap: https://green-hell-maps.daschi.dev/sitemap.xml