From 085329929f434d68e4b02d8c106ea12af064315c Mon Sep 17 00:00:00 2001 From: kritzl Date: Sun, 9 Jun 2024 18:42:15 +0200 Subject: [PATCH] v0.6.1: minor fixes - fixed modal style - modified some texts - worked on stationsNearMe functionality (WIP) - correct sorting of OSM level list --- about.html | 32 +++++++++------- elevators.js | 35 +++++++++++++---- icons/favicon_source.svg | 81 ++++++++++++++++++++++++++++++++++++++++ index.html | 16 ++++---- main.js | 2 +- md_icons/close.svg | 1 + style.css | 43 ++++++++++++++++----- style.css.map | 2 +- style.scss | 59 +++++++++++++++++++++-------- sw.js | 2 +- 10 files changed, 218 insertions(+), 55 deletions(-) create mode 100644 icons/favicon_source.svg create mode 100644 md_icons/close.svg diff --git a/about.html b/about.html index 15f69e2..e25e557 100644 --- a/about.html +++ b/about.html @@ -6,7 +6,12 @@ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> - Barrierefreie Aufzugs-Liste | Was ist das? + + + + + + hvvstuhl.de | Was ist das?

Barrierefreie Aufzugs-Liste

@@ -25,18 +30,19 @@
-
-

Worum geht's hier?

-

- Diese Seite ermöglicht einen barrierefreien Zugang zu den Aufzugs informationen im HVV. - Der HVV selbst zeigt diese Informationen nur auf einer (vor allem ohne Ortskenntnis) schwer zu navigierenden Karte an: - HVV Webseite zu Aufzügen -

-

- Dieses Projekt wurde unter AGPL-3 entwickelt und ist hier zu finden: - git.kritzl.dev -

-
+
+

Worum geht's hier?

+

+ Diese Seite ermöglicht einen barrierefreien Zugang zu den Aufzugs-Informationen im HVV. + Der HVV selbst zeigt diese Informationen nur auf einer (vor allem ohne Ortskenntnis) schwer zu navigierenden + Karte an: + HVV Webseite zu Aufzügen +

+

+ Dieses Projekt wurde unter der AGPL-3 Lizenz entwickelt und ist hier zu finden: + git.kritzl.dev +

+
\ No newline at end of file diff --git a/elevators.js b/elevators.js index 309ad56..af261c9 100644 --- a/elevators.js +++ b/elevators.js @@ -232,7 +232,7 @@ async function loadOsmData() { if (!internalData.stations[stationIndex].hasOwnProperty('coordinates')) { const substitute = substituteData.filter(subs => subs.name === internalData.stations[stationIndex].name) - if (substitute.length && substitute.hasOwnProperty('coordinates')) { + if (substitute.length && substitute[0].hasOwnProperty('coordinates')) { internalData.stations[stationIndex]['coordinates'] = substitute[0].coordinates; } } @@ -316,9 +316,23 @@ function sortStations(stationA, stationB) { return 0; } +function sortInt(valueA, valueB) { + const a = parseInt(valueA) + const b = parseInt(valueB) + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + + // names must be equal + return 0; +} + function sortStationsByDistance(stationA, stationB) { - const distanceA = stationA.distance; // ignore upper and lowercase - const distanceB = stationB.distance; // ignore upper and lowercase + const distanceA = stationA.distance ?? 0; // ignore upper and lowercase + const distanceB = stationB.distance ?? 0; // ignore upper and lowercase if (distanceA < distanceB) { return -1; } @@ -415,7 +429,9 @@ function renderData(location = null) { } } - stations = stations.sort(sortStationsByDistance); + if (sortByDistance) { + stations = stations.sort(sortStationsByDistance); + } for (const stationIndex in stations) { const station = stations[stationIndex]; @@ -478,7 +494,7 @@ function renderData(location = null) { osmTemplate += `
Beschreibung
${node.tags['description']}
`; } if (node.tags.hasOwnProperty('level')) { - osmTemplate += `
Ebenen
${node.tags['level'].split(';').sort().join(', ')}
`; + osmTemplate += `
Ebenen
${node.tags['level'].split(';').sort(sortInt).join(', ')}
`; } if (node.tags.hasOwnProperty('wheelchair')) { osmTemplate += `
Rollstühle
${node.tags['wheelchair'] === 'yes' ? 'Ja' : 'Nein'}
`; @@ -551,7 +567,11 @@ function renderData(location = null) {
${station.types.sort().map(t => `${t}`).join('')}
- ${typeof station.distance !== 'undefined' ? `
${Math.round(station.distance / 100) / 10}
km
` : ''} + ${sortByDistance + ? typeof station.distance !== 'undefined' + ? `
${Math.round(station.distance / 100) / 10}
km
` + : '
? km
' + : ''}

${station.name}

@@ -646,12 +666,13 @@ document.querySelector('#stationsNearMe') if (geolocationPermission !== 'granted') { allowGeolocation(); } else { + sortByDistance = e.target.ariaPressed = true; + // If geolocation is already set. // If not the location watcher will re-render our data. if (geolocation !== null) { renderData(geolocation) } - sortByDistance = e.target.ariaPressed = true; } } } else { diff --git a/icons/favicon_source.svg b/icons/favicon_source.svg new file mode 100644 index 0000000..144b176 --- /dev/null +++ b/icons/favicon_source.svg @@ -0,0 +1,81 @@ + + + + diff --git a/index.html b/index.html index 863abc6..bd5bb32 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ - Barrierefreie Aufzugs-Liste + hvvstuhl.de

Barrierefreie Aufzugs-Liste

@@ -37,9 +37,8 @@
+
-