aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2023-07-21 18:14:59 +0000
committerjohannst <johannst@users.noreply.github.com>2023-07-21 18:14:59 +0000
commitc4435063f699569dd1688966c20748f61d56683c (patch)
tree89c2710f5548b626817f00f6d8799b4ca76944d2 /tools
parent1b251a08f8c10ff292d1ca9b1c580e88df483b94 (diff)
downloadnotes-c4435063f699569dd1688966c20748f61d56683c.tar.gz
notes-c4435063f699569dd1688966c20748f61d56683c.zip
deploy: a311d67451eb4734684f314f1b56021da86459a0
Diffstat (limited to 'tools')
-rw-r--r--tools/awk.html24
-rw-r--r--tools/bash.html24
-rw-r--r--tools/dot.html24
-rw-r--r--tools/emacs.html24
-rw-r--r--tools/fish.html26
-rw-r--r--tools/gdb.html24
-rw-r--r--tools/gdbserver.html24
-rw-r--r--tools/git.html24
-rw-r--r--tools/gpg.html24
-rw-r--r--tools/index.html24
-rw-r--r--tools/pacman.html24
-rw-r--r--tools/qemu.html24
-rw-r--r--tools/radare2.html24
-rw-r--r--tools/tmux.html24
-rw-r--r--tools/zsh.html24
15 files changed, 346 insertions, 16 deletions
diff --git a/tools/awk.html b/tools/awk.html
index eeae648..8a41217 100644
--- a/tools/awk.html
+++ b/tools/awk.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/bash.html b/tools/bash.html
index 4ed9c0f..ca644ea 100644
--- a/tools/bash.html
+++ b/tools/bash.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/dot.html b/tools/dot.html
index 47c4295..059ebec 100644
--- a/tools/dot.html
+++ b/tools/dot.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/emacs.html b/tools/emacs.html
index 0142d24..cdc351d 100644
--- a/tools/emacs.html
+++ b/tools/emacs.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/fish.html b/tools/fish.html
index d8295a8..2892cee 100644
--- a/tools/fish.html
+++ b/tools/fish.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
@@ -192,7 +214,7 @@ echo $$foo # outputs 1337
# file.h file.cc
echo {a,b}{1,2}
-# a1 b1 b2
+# a1 b1 a2 b2
</code></pre>
<h3 id="special-variables-lists"><a class="header" href="#special-variables-lists">Special Variables (Lists)</a></h3>
<pre><code class="language-text">$status # exit code of last command
diff --git a/tools/gdb.html b/tools/gdb.html
index d40e26d..a5c3459 100644
--- a/tools/gdb.html
+++ b/tools/gdb.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/gdbserver.html b/tools/gdbserver.html
index 05d4fd7..fd2df51 100644
--- a/tools/gdbserver.html
+++ b/tools/gdbserver.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/git.html b/tools/git.html
index 21363ed..3db58b3 100644
--- a/tools/git.html
+++ b/tools/git.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/gpg.html b/tools/gpg.html
index 2d76039..0be6279 100644
--- a/tools/gpg.html
+++ b/tools/gpg.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/index.html b/tools/index.html
index fca96ff..b422c5d 100644
--- a/tools/index.html
+++ b/tools/index.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/pacman.html b/tools/pacman.html
index 54a60a9..3f4cd8a 100644
--- a/tools/pacman.html
+++ b/tools/pacman.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/qemu.html b/tools/qemu.html
index 49a5e63..599d4de 100644
--- a/tools/qemu.html
+++ b/tools/qemu.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/radare2.html b/tools/radare2.html
index a75ab0d..d817528 100644
--- a/tools/radare2.html
+++ b/tools/radare2.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/tmux.html b/tools/tmux.html
index f9f1aa8..f80e034 100644
--- a/tools/tmux.html
+++ b/tools/tmux.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
diff --git a/tools/zsh.html b/tools/zsh.html
index 04cdbde..e55f7db 100644
--- a/tools/zsh.html
+++ b/tools/zsh.html
@@ -88,11 +88,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.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
+ sidebarScrollbox.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' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>