Skip to content
Open
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
26 changes: 13 additions & 13 deletions js/initialSortTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ function initialSortTable() {
}


function setupZoneFilter() {
function setupLocationFilter() {
const table = document.querySelector('table.sortable');
const zoneFilter = document.getElementById('zone-filter');
const locationFilter = document.getElementById('location-filter');

if (!table || !zoneFilter)
if (!table || !locationFilter)
return;

const rows = Array.from(table.tBodies[0].rows);
const zones = [...new Set(rows.map(row => row.cells[1].textContent.trim()))].sort((a, b) => a.localeCompare(b));
const locations = [...new Set(rows.map(row => row.cells[1].textContent.trim()))].sort((a, b) => a.localeCompare(b));

zones.forEach(zone => {
locations.forEach(location => {
const option = document.createElement('option');
option.value = zone;
option.textContent = zone;
zoneFilter.appendChild(option);
option.value = location;
option.textContent = location;
locationFilter.appendChild(option);
});

zoneFilter.addEventListener('change', function() {
const selectedZone = this.value;
locationFilter.addEventListener('change', function() {
const selectedLocation = this.value;

rows.forEach(row => {
const routeZone = row.cells[1].textContent.trim();
const shouldShowRow = selectedZone === '' || routeZone === selectedZone;
const routeLocation = row.cells[1].textContent.trim();
const shouldShowRow = selectedLocation === '' || routeLocation === selectedLocation;
row.style.display = shouldShowRow ? '' : 'none';
});
});
}

function initAllRoutesPage() {
initialSortTable();
setupZoneFilter();
setupLocationFilter();
}
3 changes: 0 additions & 3 deletions js/templateFill.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
async function templateFill() {
const urlParams = new URLSearchParams(window.location.search);
const routeID = urlParams.get("id");
console.log(routeID)


const content = JSON.parse(sessionStorage.getItem("allRoutes"));
const route = content[routeID];
console.log(route)

let buffs = "";
if (route.buffs['Burst'] === true) {
Expand Down
6 changes: 3 additions & 3 deletions pages/all-routes.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<div class="row justify-content-center">
<div class="container-fluid">
<div class="col-md-6 textbody mt-3 mb-3 mx-auto">
<label for="zone-filter" class="form-label"><strong>Filter by zone</strong></label>
<select id="zone-filter" class="form-select mb-3" aria-label="Filter routes by zone">
<option value="">All zones</option>
<label for="location-filter" class="form-label"><strong>Filter by Location</strong></label>
<select id="location-filter" class="form-select mb-3" aria-label="Filter routes by location">
<option value="">All Locations</option>
</select>
<table class="sortable table table-responsive">
<colgroup>
Expand Down