update from sparkleup

This commit is contained in:
Madison Scott-Clary 2020-04-15 19:55:06 -07:00
parent 1ca2905ec9
commit 0c60c4f4ca
3 changed files with 29 additions and 0 deletions

BIN
.default.tpl.swp Normal file

Binary file not shown.

BIN
.style.css.swp Normal file

Binary file not shown.

View File

@ -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>