diff --git a/elevators.js b/elevators.js index 53d452c..ea999f4 100644 --- a/elevators.js +++ b/elevators.js @@ -566,6 +566,10 @@ ${station.state.unavailable ? `Bei ${station.state.unavailable} ${station.state. } + listContainer.insertAdjacentHTML('beforeend', `
  • +0 von 0 Stationen durch Filter ausgeblendet. +
  • `); + listContainer.querySelectorAll(`details`).forEach(e => { e.addEventListener("toggle", (event) => { const stationId = event.target.dataset['stationid']; @@ -646,6 +650,8 @@ function filterData() { if(typeS.dataset.pressed === 'true') activeTypes.push('S'); if(typeA.dataset.pressed === 'true') activeTypes.push('A'); if(typeR.dataset.pressed === 'true') activeTypes.push('R'); + const stationCount = internalData.stations.length; + let filteredStations = 0; if (internalData) { for (const stationIndex in internalData.stations) { const matchesSearch = internalData.stations[stationIndex].name.toLowerCase().search(searchString.toLowerCase()) >= 0; @@ -653,8 +659,13 @@ function filterData() { internalData.stations[stationIndex].types.forEach(type => { if(activeTypes.includes(type)) matchesType = true; }) - document.querySelector(`#station_${stationIndex}`).classList.toggle('hidden', !(matchesSearch && matchesType)); + const filtered = !(matchesSearch && matchesType); + document.querySelector(`#station_${stationIndex}`).classList.toggle('hidden', filtered); + if(filtered) filteredStations++; } + + document.querySelector('#stationCount').innerHTML = stationCount; + document.querySelector('#filteredCount').innerHTML = filteredStations; } } diff --git a/index.html b/index.html index b5bccbc..b676958 100644 --- a/index.html +++ b/index.html @@ -65,7 +65,7 @@