// Populate the sidebar
//
// This is a script, and not included directly in the page, to control the total size of the book.
// The TOC contains an entry for each page, so if each page includes a copy of the TOC,
// the total size of the page becomes O(n**2).
class MDBookSidebarScrollbox extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.innerHTML = '
- Introduction
- 1. Shells
- 1.1. zsh
- 1.2. bash
- 1.3. fish
- 2. CLI foo
- 2.1. awk
- 2.2. cut
- 2.3. sed
- 2.4. column
- 2.5. sort
- 2.6. tr
- 2.7. tac
- 2.8. rev
- 2.9. paste
- 3. Tools
- 3.1. tmux
- 3.2. screen
- 3.3. emacs
- 3.4. gpg
- 3.5. radare2
- 3.6. qemu
- 3.7. pacman
- 3.8. dot
- 3.9. ffmpeg
- 3.10. gnuplot
- 3.11. restic
- 3.12. qrencode
- 4. Process management & inspection
- 4.1. lsof
- 4.2. pidstat
- 4.3. pgrep
- 4.4. ps
- 4.5. pmap
- 4.6. pstack
- 4.7. taskset
- 4.8. nice
- 5. Trace and Profile
- 5.1. time
- 5.2. strace
- 5.3. ltrace
- 5.4. perf
- 5.5. OProfile
- 5.6. callgrind
- 5.7. valgrind
- 6. Debug
- 6.1. gdb
- 6.2. gdbserver
- 7. Binary
- 7.1. od
- 7.2. xxd
- 7.3. readelf
- 7.4. objdump
- 7.5. nm
- 8. Development
- 8.1. c++filt
- 8.2. c++
- 8.3. glibc
- 8.4. gcc
- 8.5. git
- 8.6. cmake
- 8.7. make
- 8.8. ld.so
- 8.9. symbol versioning
- 8.10. python
- 8.11. gcov
- 8.12. pgo
- 9. Linux
- 9.1. systemd
- 9.2. coredump
- 9.3. ptrace_scope
- 9.4. cryptsetup
- 9.5. swap
- 9.6. input
- 9.7. acl
- 9.8. zfs
- 9.9. cpufreq
- 9.10. cups
- 10. Network
- 10.1. ssh
- 10.2. ss
- 10.3. tcpdump
- 10.4. tshark
- 10.5. firewall-cmd
- 10.6. nftables
- 11. Web
- 11.1. html
- 11.2. css
- 11.3. chartjs
- 11.4. plotly
- 12. Arch
- 12.1. x86_64
- 12.2. armv8
- 12.3. arm64
- 12.4. armv7
- 12.5. riscv
';
// Set the current, active page, and reveal it if it's hidden
let current_page = document.location.href.toString();
if (current_page.endsWith("/")) {
current_page += "index.html";
}
var links = Array.prototype.slice.call(this.querySelectorAll("a"));
var l = links.length;
for (var i = 0; i < l; ++i) {
var link = links[i];
var href = link.getAttribute("href");
if (href && !href.startsWith("#") && !/^(?:[a-z+]+:)?\/\//.test(href)) {
link.href = path_to_root + href;
}
// The "index" page is supposed to alias the first chapter in the book.
if (link.href === current_page || (i === 0 && path_to_root === "" && current_page.endsWith("/index.html"))) {
link.classList.add("active");
var parent = link.parentElement;
if (parent && parent.classList.contains("chapter-item")) {
parent.classList.add("expanded");
}
while (parent) {
if (parent.tagName === "LI" && parent.previousElementSibling) {
if (parent.previousElementSibling.classList.contains("chapter-item")) {
parent.previousElementSibling.classList.add("expanded");
}
}
parent = parent.parentElement;
}
}
}
// Track and set sidebar scroll position
this.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', this.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
this.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
// Toggle buttons
var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle');
function toggleSection(ev) {
ev.currentTarget.parentElement.classList.toggle('expanded');
}
Array.from(sidebarAnchorToggles).forEach(function (el) {
el.addEventListener('click', toggleSection);
});
}
}
window.customElements.define("mdbook-sidebar-scrollbox", MDBookSidebarScrollbox);