A modular, Webpack-powered TypeScript version of the WTR Lab Term Replacer userscript.
A userscript that replaces terms on WTR-Lab.com chapters so you can read with the names and terminology you prefer.
You can manage term lists per novel, import and export your lists, catch duplicates automatically, and — if you also use WTR Lab Term Inconsistency Finder — share saved terms between the two scripts at runtime without any manual file swapping.
You need a userscript manager in your browser. Any of these work:
Grab the latest .user.js file from the dist/ folder (or from the Releases page) and your manager will prompt you to install it. That's it — head to a WTR-Lab chapter page and you should see the controls.
|-based regex alternatives, normalize slash or spaced separators, warn when regex-like text is saved with Regex off, and sort longer alternatives first.If you want to build the userscript yourself or contribute:
Requirements: Node.js 20+, npm 10+
git clone https://github.com/MasuRii/wtr-lab-term-replacer-webpack.git
cd wtr-lab-term-replacer-webpack
npm install
npm run build
The build produces JavaScript userscript files in dist/:
| File | Purpose |
|---|---|
wtr-lab-term-replacer-webpack.user.js |
Main production bundle |
wtr-lab-term-replacer-webpack.meta.js |
Metadata-only (no script body) |
wtr-lab-term-replacer-webpack.greasyfork.user.js |
GreasyFork-compatible bundle |
wtr-lab-term-replacer-webpack.greasyfork.meta.js |
GreasyFork metadata |
wtr-lab-term-replacer-webpack.dev.user.js |
Development bundle |
wtr-lab-term-replacer-webpack.dev.meta.js |
Development metadata |
wtr-lab-term-replacer-webpack.dev.proxy.user.js |
Dev proxy bundle |
npm run build:performance # Performance-optimized bundle only
npm run build:greasyfork # GreasyFork bundle only
npm run build:devbundle # Development bundle only
npm run dev # Start dev server with hot reload
npm run typecheck # Type-check the TypeScript source
npm run version:check # Show current version info
The source is TypeScript, bundled by Webpack into standard JavaScript userscript files. The code is split into focused modules:
| Module | What it handles |
|---|---|
engine.ts |
Core term-matching and replacement logic |
ui.ts |
The in-page panel and injected styles |
storage.ts |
Saving and loading term lists via userscript manager APIs |
observer.ts |
Watching for new chapter content (SPA navigation) |
handlers.ts |
Import/export and event handling |
state.ts |
Shared runtime state |
config.ts |
Constants and configuration |
duplicates.ts |
Finding conflicting term entries |
utils.ts |
Small helper functions |
termDiscovery.ts |
Same-origin WTR term API fetching and sanitized suggestion caches |
termDiscoveryHelpers.ts |
Pure parsing, sanitization, and ranking helpers for WTR term suggestions |
If you run both this script and WTR Lab Term Inconsistency Finder, they can talk to each other live. The term replacer exposes a bridge on the page that Finder connects to — it can request the current novel's terms or add new ones, all without you exporting and importing JSON.
This is handled automatically. Just have both scripts installed and active on the same page.
All saved term data stays in your browser through the userscript manager's storage. Suggestions use same-origin WTR-Lab term APIs only when needed, such as automatic lookups or Refresh Suggestions. The script stores sanitized term metadata with short TTLs, never raw chapter bodies, and never users arrays or personal identifiers from suggestion responses.
The current version is v5.7.0. Version info is kept in config/versions.js, and npm run version:update syncs it across the package metadata and generated source files.
See CHANGELOG.md for the full release history.
MIT — see LICENSE.
Open an issue on GitHub Issues.