Skip to content
Draft
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
21 changes: 20 additions & 1 deletion docs/javascripts/table_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,25 @@
history.replaceState(null, null, value ? ('#' + value) : '#');
}

// Helper function to check if a path represents an index page
function isIndexPage(path, configPath) {
// Exact match
if (path === configPath) return true;

// Index page variations
if (path === configPath + 'index' || path === configPath + 'index.html') return true;

// Check if path is exactly the config path with no additional segments
// For /MASTG/demos/, we want to match /MASTG/demos/ but not /MASTG/demos/android/
if (path.startsWith(configPath)) {
const remainder = path.substring(configPath.length);
// Allow only empty string, 'index', or 'index.html' after the config path
return remainder === '' || remainder === 'index' || remainder === 'index.html';
}

return false;
}

// Main initializer: find all candidate tables and enhance
function configureDynamicTables() {
// Clean previously registered custom filters (from prior SPA navigations)
Expand All @@ -288,7 +307,7 @@
// Activate only on specific index pages defined in PAGE_CONFIG
let pageGroups = null;
for (const [key, groups] of Object.entries(PAGE_CONFIG)) {
if (path.indexOf(key) !== -1) { pageGroups = groups; break; }
if (isIndexPage(path, key)) { pageGroups = groups; break; }
}
if (!pageGroups) return;

Expand Down