diff --git a/assets/app.js b/assets/app.js index 6641d89..19adcf4 100644 --- a/assets/app.js +++ b/assets/app.js @@ -145,3 +145,16 @@ document.addEventListener('shown.bs.collapse', (e) => rememberStatblock(e.target document.addEventListener('hidden.bs.collapse', (e) => rememberStatblock(e.target, false)); document.addEventListener('DOMContentLoaded', restoreStatblocks); document.addEventListener('turbo:load', restoreStatblocks); + +// --- Publish the navbar height as --app-nav-h ------------------------- +// The storyline chapter page sizes its split view to the viewport minus the +// navbar; the navbar grows when it wraps, so measure it rather than guess. +function publishNavHeight() { + const nav = document.querySelector('.navbar'); + const h = nav ? Math.round(nav.getBoundingClientRect().height) : 56; + document.documentElement.style.setProperty('--app-nav-h', `${h}px`); +} + +document.addEventListener('DOMContentLoaded', publishNavHeight); +document.addEventListener('turbo:load', publishNavHeight); +window.addEventListener('resize', publishNavHeight); diff --git a/assets/controllers/chapter_notes_controller.js b/assets/controllers/chapter_notes_controller.js new file mode 100644 index 0000000..e17dea7 --- /dev/null +++ b/assets/controllers/chapter_notes_controller.js @@ -0,0 +1,113 @@ +import { Controller } from '@hotwired/stimulus'; + +/* + * The docked "Chapter notes" panel on a storyline chapter page. + * + *