diff --git a/browse/css/tree.css b/browse/css/tree.css
index d1c2401..0b681fc 100644
--- a/browse/css/tree.css
+++ b/browse/css/tree.css
@@ -90,58 +90,6 @@
white-space: nowrap;
}
-/* Auto-filter rows in . Two rows β one targets file rows
- (π icon, with file-name + ext inputs), one targets folder rows
- (π icon, with folder-name input). The icons make it visually
- obvious which row controls which kind of filter. The rows are
- non-sticky (only the sortable header row sticks) β keeps the
- stack-positioning math out of the picture and accepts that
- filters scroll out of view on long lists. */
-.browse-table thead .filter-row th {
- position: static;
- padding: 0.25rem 0.6rem;
- background: var(--bg-secondary);
- border-bottom: 1px solid var(--border);
- cursor: default;
- font-weight: normal;
- z-index: 0;
-}
-
-.browse-table thead .filter-row th:hover {
- background: var(--bg-secondary);
-}
-
-.filter-row__icon {
- display: inline-block;
- width: 1.2rem;
- text-align: center;
- margin-right: 0.3rem;
- vertical-align: middle;
- font-size: 0.95rem;
- color: var(--text-muted);
-}
-
-.column-filter {
- width: calc(100% - 1.5rem);
- padding: 0.2rem 0.4rem;
- border: 1px solid var(--border);
- border-radius: 3px;
- background: var(--bg);
- color: var(--text);
- font-size: 0.8rem;
- font-family: Consolas, Monaco, monospace;
- box-sizing: border-box;
-}
-
-.filter-row th.col-name .column-filter {
- width: calc(100% - 1.7rem); /* leave space for the icon */
-}
-
-.column-filter:focus {
- outline: 1px solid var(--primary);
- outline-offset: -1px;
-}
-
/* Table β folders + files in a tree */
.browse-table {
diff --git a/browse/js/events.js b/browse/js/events.js
index b42d50e..d0dd5fb 100644
--- a/browse/js/events.js
+++ b/browse/js/events.js
@@ -122,19 +122,6 @@
var refresh = document.getElementById('refreshHeaderBtn');
if (refresh) refresh.addEventListener('click', refreshListing);
- // Auto-filter row inputs. There are three of them (file, folder,
- // ext) β wire each by its `data-filter` attribute. Idempotent
- // re: re-init.
- var filterInputs = document.querySelectorAll('input.column-filter[data-filter]');
- for (var fi = 0; fi < filterInputs.length; fi++) {
- (function (input) {
- var which = input.dataset.filter;
- input.addEventListener('input', function () {
- tree.setFilter(which, input.value);
- });
- })(filterInputs[fi]);
- }
-
// Sort headers
var ths = document.querySelectorAll('#browseTable thead th.sortable');
for (var i = 0; i < ths.length; i++) {
diff --git a/browse/js/init.js b/browse/js/init.js
index 0fa6707..705b41a 100644
--- a/browse/js/init.js
+++ b/browse/js/init.js
@@ -25,15 +25,6 @@
// Sort state. key: 'name' | 'size' | 'ext' | 'date'. dir: 1 or -1.
sort: { key: 'name', dir: 1 },
- // Auto-filter row state. Each is a raw string from the input,
- // plus a parsed AST (zddc.filter.parse) cached on every keystroke.
- // Empty raw β AST empty β matches everything.
- filters: {
- file: { raw: '', ast: null }, // matches against file basename
- folder: { raw: '', ast: null }, // matches against folder basename
- ext: { raw: '', ast: null } // matches against file extension
- },
-
// The tree's in-memory representation. Each node:
// { id, name, isDir, size, modTime, ext, url, depth,
// parentId, expanded, loaded, childIds, isZip, zipFile,
diff --git a/browse/js/tree.js b/browse/js/tree.js
index d27a503..8a207b6 100644
--- a/browse/js/tree.js
+++ b/browse/js/tree.js
@@ -102,17 +102,14 @@
parent.loaded = true;
}
- // Walk visible nodes in render order. Excludes nodes whose
- // node.visible is false (filter-hidden) and skips the children of
- // a collapsed expandable. Filter visibility is computed by
- // recomputeVisibility() before this is called from render().
+ // Walk nodes in render order. Skips the children of a collapsed
+ // expandable.
function visibleIds() {
var out = [];
function walk(ids) {
for (var i = 0; i < ids.length; i++) {
var n = state.nodes.get(ids[i]);
if (!n) continue;
- if (n.visible === false) continue;
out.push(ids[i]);
if ((n.isDir || n.isZip) && n.expanded) walk(n.childIds);
}
@@ -192,7 +189,6 @@
function render() {
var tbody = document.getElementById('browseTbody');
if (!tbody) return;
- recomputeVisibility();
var ids = visibleIds();
var html = '';
for (var i = 0; i < ids.length; i++) {
@@ -204,111 +200,7 @@
renderBreadcrumbs();
}
- // Compute model-level visibility per node based on the three
- // filter ASTs:
- // - fileFilter β matches a file's basename
- // - folderFilterβ matches a folder's basename
- // - extFilter β matches a file's extension (no leading dot)
- //
- // Visibility rules:
- // 1. A FILE is "self-matched" when it passes both file+ext filter.
- // 2. A FOLDER is "self-matched" when it passes the folder filter.
- // 3. A file is "in-scope" when either no folder filter is active,
- // OR at least one ancestor folder is folder-self-matched.
- // 4. A file is VISIBLE when self-matched AND in-scope.
- // 5. A folder is VISIBLE when:
- // - any descendant is visible (so the path to a hit is
- // always shown), OR
- // - the folder itself is folder-self-matched AND no file
- // filter is active (when a file filter is set, we hide
- // folders that have no matching files inside β keeps
- // the result list focused).
- //
- // Pure model walk; the renderer just consumes node.visible. Hidden
- // expandable nodes get their `expanded` flag respected even though
- // they're not in the DOM, so toggling filters preserves the user's
- // expand state.
- function recomputeVisibility() {
- var fileAst = state.filters.file.ast;
- var folderAst = state.filters.folder.ast;
- var extAst = state.filters.ext.ast;
- var hasFile = !!(state.filters.file.raw);
- var hasFolder = !!(state.filters.folder.raw);
- var hasExt = !!(state.filters.ext.raw);
- var anyActive = hasFile || hasFolder || hasExt;
-
- // Fast path: nothing filtered β everything visible.
- if (!anyActive) {
- state.nodes.forEach(function (n) { n.visible = true; });
- return;
- }
-
- var f = window.zddc && window.zddc.filter;
-
- // Walk top-down to propagate folder scope, then bottom-up to
- // propagate descendant visibility. Done in one DFS recursion.
- // ZIPs are hybrids β they match FILE filter (their name is a
- // filename) AND can be matched by FOLDER filter (they're
- // container-like β clicking expands them like a folder).
- function visit(nodeId, ancestorMatchesFolder) {
- var n = state.nodes.get(nodeId);
- if (!n) return false;
-
- if (!(n.isDir || n.isZip)) {
- // Plain file. Visible iff its name+ext pass file/ext
- // filters AND it's inside the folder-filter scope.
- var nameOk = f.matches(n.name, fileAst);
- var extOk = f.matches(n.ext || '', extAst);
- n.visible = nameOk && extOk && ancestorMatchesFolder;
- return n.visible;
- }
-
- // Folder or zip β has childIds and contributes to scope.
- // Folder self-match: the folder/zip name passes folder
- // filter. A folder match also opens the file-filter scope
- // for descendants.
- var asFolderMatch = f.matches(n.name, folderAst);
- // A zip can also match the FILE filter (it's a file too).
- // Typing a zip name into file filter surfaces the zip.
- // Gate on hasFile||hasExt β when neither is active, the
- // empty filter matches every name and would falsely
- // surface every zip regardless of the active folder filter.
- var asFileMatch = n.isZip
- && (hasFile || hasExt)
- && f.matches(n.name, fileAst)
- && f.matches(n.ext || '', extAst);
-
- var nextAncestorScope = ancestorMatchesFolder
- || asFolderMatch || asFileMatch;
-
- var anyChildVisible = false;
- for (var i = 0; i < n.childIds.length; i++) {
- if (visit(n.childIds[i], nextAncestorScope)) anyChildVisible = true;
- }
-
- // Visible if:
- // - any descendant is visible (path-to-hit visibility), or
- // - self-folder-match with no file/ext filter active
- // (let the folder surface even if it's empty/unloaded), or
- // - self-file-match (for zips, where the user is searching
- // for the archive by name in the file filter).
- n.visible = anyChildVisible
- || (asFolderMatch && !hasFile && !hasExt)
- || asFileMatch;
- return n.visible;
- }
-
- // Initial ancestor scope = folder filter empty (so files don't
- // require ancestor matches when there's no folder filter).
- var initialScope = !hasFolder;
- for (var i = 0; i < state.rootIds.length; i++) {
- visit(state.rootIds[i], initialScope);
- }
- }
-
- // Count nodes that would render if no filter were active
- // (i.e. anything at the root, or under an expanded ancestor).
- // Used to express " Once loaded: click a folder to expand it, shift-click
to expand its entire subtree (or collapse it again),
- click column headers to sort. Use the π row to filter files
- (and the π row to scope to matching folders) β file matches
- stay visible together with their containing folders.
- Click any file to open it.Type
Modified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Two filter rows live in the table header:
-Filter syntax (shared across all ZDDC tools):
-term!term^termterm$a ba | bel.*spc