Chapter progress bar#664
Conversation
Add chapter progress bar endpoint
Add chapter progress bar styles
Add chapter progress bar HTML and JavaScript
|
Hi @p-value-sharma -- I think I'm going to have to decline this one within the Lute release, as people use the bookmarks in various ways, not necessarily conforming to chapter headings. e.g. I use it sometimes to mark characters, grammar notes, nice passages, etc. It's still a great idea though. Lute does need some way of identifying chapters. Currently bookmarks are just plain data, it's rather clunky. Having them be "classified" into certain types (chapter heading, eg) would be very natural, but that's a much bigger change than what you've given here. Some people have also suggested using something like Markdown (see #168) which might then correspond to chapters nicely. That's a more interesting, and more painful, change. Back to you so that we can chat about this a bit more if you'd like. Thanks again, appreciate the effort! |
What this does
Adds a chapter progress bar to the reading view. It uses Lute's existing
bookmarks feature as chapter markers — bookmark the first page of each
chapter and the bar automatically tracks your progress within that chapter.
The bar is hidden when no bookmarks exist before the current page, so it
doesn't clutter the UI for books without chapter markers.
Example display:
How to use
Bookmark the first page of each chapter via the hamburger menu →
Bookmarks → Add Bookmark, naming it e.g. "Chapter 1", "Part II", etc.
The progress bar appears automatically below the audio player while reading.
Changes
lute/bookmarks/routes.py— new endpoint/bookmarks/<bookid>/chapter_progress/<pagenum>that calculates chapter position from bookmarkslute/templates/read/index.html— progress bar HTML and JavaScriptlute/static/css/styles.css— progress bar styles using existing CSS variablesNotes
Developed with assistance from Claude (Anthropic). Tested locally.