A reader mode for forum stories that keeps the comments
A Tampermonkey userscript that turns a threadmarked XenForo thread into an AO3-style reader — chapter TOC, discussion as comments, EPUB export, one file.

Some of the best long-form fiction on the internet lives on XenForo forums — SpaceBattles, Sufficient Velocity, Questionable Questing. The format is the worst part: a story is a thread, chapters are posts scattered across hundreds of pages, and the discussion between them is both the thing you want to skim and the thing burying the story. I wrote a Tampermonkey userscript that reformats all of it in place: chapter table of contents on the left, one chapter as the reading focus, and the forum posts between two chapters collected under each one as comments — the AO3 shape, on top of the live thread.
How it works
Threadmarks are the whole trick. XenForo already lets authors mark posts as chapters, and the threadmark index is a paginated list per category (Threadmarks, Informational, Apocrypha, Omake…). The script walks every category and page of that index once, resolves each threadmark to its post, and builds a chapter list. From there:
- A chapter is a threadmarked post, rendered alone.
- Its discussion is every post after it and before the next threadmark in chronological order, walked across page boundaries. That definition is simple and turns out to be exactly right: reactions land between chapters, so they attach to the chapter they react to.
- Two reading orders: story-first (categories in section order) or fully chronological, which interleaves omake and sidestories where they were actually posted.
Everything is cached in IndexedDB, so a story you have opened before renders instantly and rebuilding the index is a background refresh, not a loading screen. Fetching is deliberately polite: four concurrent requests, a minimum gap, exponential backoff on 429/503. The reader itself is a web component in a shadow DOM, so forum CSS cannot leak in and the script cannot leak out.
There is also an EPUB export. The green button fetches the whole story and builds an EPUB2 in the browser — including the ZIP container, hand-rolled in STORE mode with its CRC32s, because pulling in a compression library for a format that works uncompressed is not worth the dependency. The XHTML pass strips scripts, event handlers, and tracking attributes, and promotes lazy-loaded images to real ones.
Why the obvious approaches fail
XenForo ships a native “reader mode” that shows threadmarked posts only. It solves half the problem and deletes the other half: the discussion is gone, and for these stories the discussion is a real part of the experience — theories, author replies, the reaction to a cliffhanger. Keeping it, but demoted to comments, is the point of this tool.
Downloader pipelines (FicHub and friends) get you a clean ebook but take you out of the browser, lose the comments the same way, and go stale the moment the author posts. The userscript reads the same session you are logged in with, so it sees exactly what you see, updates when the thread does, and never touches your account — it fetches, parses, and renders, nothing else.
The forum’s own markup fought back in two places worth writing down. Threadmark
categories are addressed by query parameter (threadmarks?threadmark_category=3), not
by the path segment the tab URLs suggest — the path form silently returns the default
category, which reads as “this story has no extras” until you diff the counts. And the
threadmark list’s pagination must be read from the list block’s own pageNav; the
thread footer has an identically-classed one that reports the thread’s page count and
poisons the walk.
What is still wrong
The reader forgets where you were inside a chapter — scroll position and read/unread state are the next milestone, followed by keyboard navigation and typography controls. All selectors live in one adapter object, so pointing it at another XenForo forum is a handful of lines; if your favorite one is missing, the issue tracker is open.