Skip to content

Commit c2739a1

Browse files
authored
Merge pull request #447 from y-guyon/expandall
Add ExpandAll and CollapseAll buttons
2 parents 23bec4b + da9ed79 commit c2739a1

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

test/filereader.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@
126126
margin: 0;
127127
}
128128

129+
#expandall, #collapseall {
130+
margin: 0 0 0 2px;
131+
padding: 0 2px;
132+
font-size: 8px;
133+
writing-mode: vertical-rl;
134+
vertical-align: middle;
135+
}
129136
</style>
130137
<link rel="stylesheet" href="style.css" />
131138
</head>
@@ -165,7 +172,10 @@ <h3>MP4Box.js / ISOBMFF Box Structure Viewer (see <a href="../#demos">other demo
165172
<table>
166173
<thead>
167174
<tr>
168-
<th>Box Tree View</th>
175+
<th>Box Tree View
176+
<button id="expandall" title="Expand all">&#9650;&#9660;</button>
177+
<button id="collapseall" title="Collapse all">&#9660;&#9650;</button>
178+
</th>
169179
<th>Box Property View</th>
170180
</tr>
171181
</thead>

test/filereader.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,28 @@ function buildEntityGroupTable(entity_groups) {
453453
$("#entitygroupview").html(html);
454454
}
455455

456-
457456
window.onload = function () {
458457

459458
createLoadBar($('#menubar'), "File", "file", file, finalizeAnalyzerUI);
460459

461460
createFancyTree($('#boxtree'), file);
462461

462+
$("#expandall").on("click", function() {
463+
// Same as fancytree.expandAll() which is unavailable in lib/fancytree.
464+
file.fancytree.visit(function (node) {
465+
if (node.hasChildren() !== false && !node.isExpanded()) {
466+
node.setExpanded(true, []);
467+
}
468+
});
469+
});
470+
$("#collapseall").on("click", function() {
471+
file.fancytree.visit(function (node) {
472+
if (node.hasChildren() !== false && node.isExpanded()) {
473+
node.setExpanded(false, []);
474+
}
475+
});
476+
});
477+
463478
$("#resulttabs").tabs();
464479
$("#boxview").tabs();
465480
$("#sampleviewselector").selectmenu({

0 commit comments

Comments
 (0)