mirror of https://github.com/TriliumNext/Notes
build website improvements
parent
c97ada3434
commit
32bd74fe27
@ -0,0 +1,45 @@
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
width: 1100px;
|
||||
margin: auto;
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
|
||||
}
|
||||
|
||||
.note-tree-nav {
|
||||
padding-top: 10px;
|
||||
width: 300px;
|
||||
margin-right: 20px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.note-tree-nav ul {
|
||||
padding-left: 20px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.note-tree-nav ul li {
|
||||
line-height: 150%;
|
||||
font-size: 105%;
|
||||
}
|
||||
|
||||
.note-tree-nav > ul > li > a {
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.note-tree-nav a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.note-tree-nav li span.expander, .note-tree-nav li span.spacer {
|
||||
width: 1em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.note-tree-nav li span.expander {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 780px;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
for (const li of document.querySelectorAll('.note-tree-nav li')) {
|
||||
const branchId = li.getAttribute("data-branch-id");
|
||||
if (branchId.startsWith("root_")) {
|
||||
// first level is expanded and cannot be collapsed
|
||||
continue;
|
||||
}
|
||||
|
||||
const newDiv = document.createElement("span");
|
||||
const subList = li.querySelector('ul');
|
||||
|
||||
if (subList) {
|
||||
const toggleVisibility = (show) => {
|
||||
newDiv.innerHTML = show ? "▾ " : "▸ ";
|
||||
subList.style.display = show ? 'block' : 'none';
|
||||
|
||||
localStorage.setItem(branchId, show ? "true" : "false");
|
||||
};
|
||||
|
||||
newDiv.classList.add("expander");
|
||||
newDiv.addEventListener('click', () => toggleVisibility(subList.style.display === 'none'));
|
||||
|
||||
toggleVisibility(localStorage.getItem(branchId) === "true");
|
||||
} else {
|
||||
newDiv.classList.add("spacer");
|
||||
}
|
||||
|
||||
li.prepend(newDiv);
|
||||
}
|
||||
}, false);
|
||||
Loading…
Reference in New Issue