summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-03-14 08:01:24 +0100
committerMartin Fischer <martin@push-f.com>2025-03-14 08:35:51 +0100
commitcba78193c72ea02cc0fe83df9b8d46ec325affc9 (patch)
treecca7973f87094ef38ded76235022b0cb8135020d
parentcc75b974e0ff925a594eabc92a70b3b627315698 (diff)
refactor: remove unused name and zoom features
-rw-r--r--script.js26
1 files changed, 5 insertions, 21 deletions
diff --git a/script.js b/script.js
index 5f07efb..9382d29 100644
--- a/script.js
+++ b/script.js
@@ -1,19 +1,7 @@
-const fragment = location.hash.substring(1);
-
-const i = fragment.indexOf('&');
-let latlon;
-let params;
-if (i != -1) {
- latlon = fragment.slice(0, i);
- params = Object.fromEntries(new URLSearchParams(fragment.slice(i+1)).entries());
-} else {
- latlon = fragment;
- params = {};
-}
-
+const latlon = location.hash.substring(1);
const [lat, lon] = latlon.split(',');
-function getLinks(lat, lon, zoom) {
+function getLinks(lat, lon) {
return [
{
label: 'Google Maps',
@@ -29,7 +17,7 @@ function getLinks(lat, lon, zoom) {
},
{
label: 'OpenStreetMap',
- url: `https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}&zoom=${zoom}&layers=M`
+ url: `https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}&zoom=15&layers=M`
},
]
}
@@ -41,16 +29,12 @@ const heading = document.getElementById('heading');
if (isNaN(lat) || isNaN(lon)) {
heading.textContent = 'not yet implemented';
} else {
- const zoom = params.z || 15;
const linkList = document.getElementById('links');
document.getElementById('instructions').hidden = false;
- if (params.name) {
- document.title = params.name;
- heading.textContent = params.name;
- }
+ document.title = 'Open location';
- for (const link of getLinks(lat, lon, zoom)) {
+ for (const link of getLinks(lat, lon)) {
const li = document.createElement('li');
const a = document.createElement('a');
a.href = link.url;