A high-performance universal reader for image galleries, now with mobile and touch device support, plus infinite scroll, immersive reader mode, and smart image loading, with ongoing multi-site support (E-Hentai, 18comic, 4KHD).
A high-performance universal reader for image galleries, built for mobile and touch with an extensible multi-site architecture.
Currently supported (more on the way):
content-visibility, lease-protected shared image tasks, and bounded LRU caches avoid duplicate work while allowing the browser to reclaim off-screen rendering resources.Requires Node.js 22.18 or newer.
npm install
npm run dev # Development (hot reload)
npm run build # Production
npm test # Regression tests
npm run check # Typecheck, tests, and production build
Output: dist/hentai-reader.user.js
src/
├── main.ts # Entry point
├── app/ # Application composition and dependency wiring
├── core/ # Gallery, image, and site contracts
├── reader/ # Reader controller, drivers, shell, and UI
│ ├── controllers/ # Image, prefetch, pagination, wheel, autoplay
│ ├── drivers/ # PhotoSwipe integration boundary
│ └── shell/ # Status and virtualized thumbnail UI
├── scroll/ # Scroll lifecycle, navigation, and image events
├── services/ # Shared loading, retry, scheduling, thumbnails
├── sites/ # Per-site adapters (add a site here)
│ ├── site-manager.ts # Adapter selection
│ ├── e-hentai/ · 18comic/ · 4khd/
│ └── _template/ # New-site starter adapter
├── ui/
│ ├── float-control.ts # Floating controls
│ └── settings-panel.ts # Settings panel
├── state/ # config.ts · store.ts
│ └── types.ts # Application settings/config types
└── utils/ # i18n · icons · viewport
tests/ # Regression and architecture contract tests
docs/ # Architecture, new-site guide, and backlog
MIT
The architecture is organized around src/core/, src/services/, src/reader/,
src/scroll/, and site adapters under src/sites/.
The completed refactor centralizes resolve, materialize, retry, cache, lease, and resource ownership. Reader UI, PhotoSwipe integration, scroll lifecycle, and site adapters are separated by explicit contracts so fixes remain local to their owner.