update from sparkleup
This commit is contained in:
parent
1ca2905ec9
commit
0c60c4f4ca
Binary file not shown.
Binary file not shown.
29
default.tpl
29
default.tpl
|
@ -18,5 +18,34 @@
|
|||
<p>Page generated on %date%</p>
|
||||
</footer>
|
||||
</main>
|
||||
<script type="text/javascript">
|
||||
document.querySelectorAll('li').forEach(el => {
|
||||
if (el.querySelectorAll('li').length !== 0) {
|
||||
el.classList.add('has-nested', 'closed');
|
||||
el.innerHTML = `<span class="toggle"></span> ${el.innerHTML}`;
|
||||
}
|
||||
});
|
||||
document.querySelectorAll('li.has-nested').forEach(el => {
|
||||
el.querySelector('.toggle').addEventListener('click', () => {
|
||||
el.classList.toggle('closed');
|
||||
});
|
||||
});
|
||||
let expanded = false;
|
||||
document.querySelector('.control').addEventListener('click', (e) => {
|
||||
expanded = !expanded;
|
||||
if (expanded) {
|
||||
e.target.innerText = 'Collapse all';
|
||||
} else {
|
||||
e.target.innerText = 'Expand all';
|
||||
}
|
||||
document.querySelectorAll('.has-nested').forEach((el) => {
|
||||
if (expanded) {
|
||||
el.classList.remove('closed');
|
||||
} else {
|
||||
el.classList.add('closed')
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue