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
4 changes: 3 additions & 1 deletion docs/department/schedules/fall2026.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Computer Science Courses

<div id="table-filter"></div>
<div class="table-filter"></div>

| Course | Section | Time | Room | Instructors |
| ---------- | ------- | ------------- | ---- | -------------- |
Expand Down Expand Up @@ -73,6 +73,8 @@

## Information Technology Courses

<div class="table-filter"></div>

| Course | Section | Time | Room | Instructors |
| ---------- | ------- | ------------- | ---- | -------------- |
| 160 | 2 | TTh 1245-1400 | 336 | Belsare |
Expand Down
2 changes: 1 addition & 1 deletion docs/department/schedules/spring2026.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spring 2026 Schedule

<div id="table-filter"></div>
<div class="table-filter"></div>

| Course | Section | Time | Room | Instructors |
|--------|---------|--------------------------|------|-------------|
Expand Down
2 changes: 1 addition & 1 deletion docs/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

/* table filter */

.table-filter {
.table-filter-input {
border: 1px solid var(--md-default-fg-color--lighter);
border-radius: 4px;
box-sizing: border-box;
Expand Down
39 changes: 23 additions & 16 deletions docs/table-filter.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
document$.subscribe(function () {
// Only activate on pages that opt in with: <div id="table-filter"></div>
var container = document.getElementById("table-filter");
if (!container) return;
// Only activate on pages that opt in with: <div class="table-filter"></div>
// Each container filters the first data table that follows it, so a page
// may have several.
document.querySelectorAll("div.table-filter").forEach(function (container) {
// Find the next data table after the container (it may be wrapped in
// scroll-wrapper divs), stopping if we reach another filter container.
var table = null;
for (var el = container.nextElementSibling; el; el = el.nextElementSibling) {
if (el.matches("div.table-filter")) break;
table = el.matches("table:not([class])") ? el : el.querySelector("table:not([class])");
if (table) break;
}
if (!table) return;

// Find the first data table after the container
var table = container.parentNode.querySelector("table:not([class])");
if (!table) return;
// Place the filter input inside the opt-in div
var input = document.createElement("input");
input.type = "text";
input.placeholder = "Type to filter rows…";
input.className = "table-filter-input";
container.appendChild(input);

// Place the filter input inside the opt-in div
var input = document.createElement("input");
input.type = "text";
input.placeholder = "Type to filter rows\u2026";
input.className = "table-filter";
container.appendChild(input);

input.addEventListener("input", function () {
var term = this.value.toLowerCase();
var rows = table.querySelectorAll("tbody tr");
input.addEventListener("input", function () {
var term = this.value.toLowerCase();
var rows = table.querySelectorAll("tbody tr");

// Collect the full text for each row group (accounting for rowspans).
// A row with a rowspan cell "owns" the subsequent spanned rows, so
Expand Down Expand Up @@ -49,4 +55,5 @@ document$.subscribe(function () {
g.rows.forEach(function (row) { row.style.display = visible; });
});
});
});
});
4 changes: 2 additions & 2 deletions zensical.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ edit_uri = "edit/main/docs/"
#
# Read more: https://zensical.org/docs/customization/#additional-css
extra_css = [
"extra.css?v=2026-10-21"
"extra.css?v=2026-10-27"
]

# With the `extra_javascript` option you can add your own JavaScript to your
Expand All @@ -77,7 +77,7 @@ extra_javascript = [
"fixhash.js?v=2026-01-31",
"mathjax.js?v=2026-01-05",
"https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js",
"table-filter.js?v=2026-03-09",
"table-filter.js?v=2026-10-27",
"table-merge.js?v=2026-03-09",
"auto-index.js?v=2026-10-21",
]
Expand Down
Loading