Zero-Cost Client-Side Web Novel Editing & Glossary Engine
| Engineering Dimension | Architecture & Delivery Specification |
|---|---|
| Domain & Context | High-Volume Web Novel Editing, Translation Preprocessing & Text Normalization |
| Hosting & Infrastructure | 100% Client-Side Static Single Page Application (GitHub Pages / Cloudflare Pages / Local HTML) |
| External Dependencies | Zero paid APIs, zero external databases, zero third-party subscriptions |
| Large File Processing | Dedicated background Web Worker handling 5MB to 10MB+ TXT files (1.5M+ words) without UI lag |
| Data Isolation Model | Per-novel glossary sandboxing via local storage; glossaries never cross-pollinate |
| Precedence Logic | Novel-specific terms take strict priority over global predefined dictionaries |
| Replacement Determinism | Strict regex word-boundary sorting by length descending to prevent prefix collisions |
1. Live Interactive Demonstration
Experience the interactive standalone novel editor below. Upload English TXT files, manage isolated novel glossaries, apply priority word replacements, and download clean edited files with zero server overhead:
2. High-Level Design (HLD) Architecture
Processing massive English text files directly on the browser UI thread freezes the user interface and causes browser crashes. By offloading dictionary compilation and string manipulation to an asynchronous Web Worker, the tool processes multi-megabyte novels smoothly with real-time percentage feedback:
[Raw English TXT (5MB - 10MB)] │ ▼ [Browser FileReader] │ ┌─────────┴─────────┐ │ Load Active Novel │ <─── [LocalStorage / IndexedDB] └─────────┬─────────┘ ▼ [Merge Dictionaries: Novel Takes Priority] │ ▼ [Spawn Dedicated Web Worker] │ ▼ [Sort Terms by Length Descending] │ ▼ [Chunked Regex Word-Boundary Replacement] ──> [Emit Progress %] │ ▼ [Generate Downloadable Text Blob] │ ▼ [Export Clean Edited TXT File]10-Step Architectural Breakdown
- Requirements Clarity: Provide a zero-cost, private text normalization tool for English web novels before external translation, adhering to strict user glossaries.
- File Size Assumptions: Handle typical web novel volumes from 200,000 words (1.2 MB) up to 2,000,000 words (10 MB+) without memory leaks.
- High-Level Web Architecture: Serverless client-side architecture requiring no backend database, API keys, or operational maintenance.
- Data Isolation Design: Store novel profiles in structured local storage objects (
novels[novelName].glossary), completely isolating character names and terminology per novel. - Dictionary Precedence Engine: Deep merge global predefined terms (cultivation, fantasy terms) with novel-specific entries, where novel entries unconditionally overwrite global keys.
- Collision Avoidance: Sort replacement keys by string length in descending order before compiling the master regular expression, ensuring composite terms (
Azure Cloud Sect Master) match before partial substrings (Azure Cloud SectorMaster). - Thread Management: Execute text scanning in a dedicated Web Worker in 250KB memory chunks to keep the browser event loop responsive at 60 FPS.
- Fault Tolerance & Retry: Store uploaded file buffers in memory so users can modify glossaries and retry processing instantly without re-uploading the original file.
- Zero Creative Rewrite Invariant: Guarantee that text replacement is strictly literal and lexical, preserving sentence structure, numbers, and storyline meaning 100%.
- Delivery Packaging: Package as a single portable HTML file that functions both offline on a local laptop and hosted online on free edge static storage.
3. Core Engine Implementation
// Web Worker replacement kernel with length-descending sortingself.onmessage = function(e) { const { text, glossary, predefined } = e.data; const startTime = Date.now();
// Combine dictionaries with novel glossary priority const combined = { ...predefined, ...glossary };
// Sort terms by length descending to prevent partial match collisions const terms = Object.keys(combined).sort((a, b) => b.length - a.length);
function escapeRegExp(s) { return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
// Compile unified word-boundary regular expression const pattern = new RegExp('\\b(' + terms.map(escapeRegExp).join('|') + ')\\b', 'g');
let totalReplacements = 0; const termHits = {};
const replacedText = text.replace(pattern, (match) => { totalReplacements++; termHits[match] = (termHits[match] || 0) + 1; return combined[match] || match; });
self.postMessage({ type: 'complete', resultText: replacedText, totalReplacements: totalReplacements, uniqueMatched: Object.keys(termHits).length, durationMs: Date.now() - startTime });};4. Maintenance and Zero-Cost Warranty
Because this tool executes entirely within the client’s browser without external API tokens, backend microservices, or database servers:
- Zero Ongoing Operational Costs: Never incurs server bills or subscription charges.
- Permanent Code Stability: Zero risk of third-party API deprecation breaking core functionality.
- Air-Gapped Privacy: Confidential novel manuscripts never leave the user’s local device.