Skip to content

Commit 07f2713

Browse files
pchampingkellogg
authored andcommitted
added intro section with buttons to fold/unfold all
1 parent b21884c commit 07f2713

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

index.html

+34
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@
275275
}
276276
</style>
277277
<script>
278+
// functions related to foldable algorithm parts
279+
278280
(function() {
279281
function beforePrint() {
280282
console.debug("opening details before printing");
@@ -316,6 +318,24 @@
316318
// using events
317319
window.addEventListener('beforeprint', beforePrint);
318320
window.addEventListener('afterprint', afterPrint);
321+
window.addEventListener('load', function() {
322+
console.debug("coucou");
323+
document.getElementById('fold-all-algorithms').addEventListener('click', function() {
324+
var algoDetails = document.querySelectorAll('.algorithm details');
325+
for (var dt of algoDetails) {
326+
dt.open = false;
327+
}
328+
console.debug("fold");
329+
});
330+
document.getElementById('unfold-all-algorithms').addEventListener('click', function() {
331+
var algoDetails = document.querySelectorAll('.algorithm details');
332+
for (var dt of algoDetails) {
333+
dt.open = true;
334+
}
335+
console.debug("unfold");
336+
});
337+
console.debug("coucou");
338+
});
319339
})();
320340
</script>
321341
</head>
@@ -396,6 +416,20 @@ <h2>Contributing</h2>
396416
<section class="informative">
397417
<h2>Typographical conventions</h2>
398418
<div data-include="common/typographical-conventions.html"></div>
419+
420+
<section>
421+
<h3>Summarized algorithm sections</h3>
422+
<p>In order to make the algorithms easier to read,
423+
some parts of them are initially hidden and replaced by a short summary.
424+
Clicking on that summary will toggle between detailed and summarised view.
425+
Using the buttons below, you can display or hide the details in all algorithms at once.
426+
Note that, when printing, all details are always shown.
427+
</p>
428+
<p>
429+
<button id="unfold-all-algorithms">Show all details in all algorithms</button>
430+
<button id="fold-all-algorithms">Hide all details in all algorithms</button>
431+
</p>
432+
</section>
399433
</section>
400434

401435
<section class="normative">

0 commit comments

Comments
 (0)