diff options
| -rw-r--r-- | script.js | 26 | 
1 files changed, 5 insertions, 21 deletions
| @@ -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; | 
