Epstein Unredactor
Home
Architecture
API
GitHub
Home
Architecture
API
GitHub
  • Getting Started

    • Setup & Deployment
    • Local Development
    • Production Deployment
    • /setup-and-deployment/TROUBLESHOOTING.html
  • Architecture

    • Epstein Unredactor — Architecture Overview
  • Redaction Processing

    • Redaction Processing — Backend Logic
    • ProcessRedactions.py
    • BoxDetector.py Documentation
    • SurroundingWordWidth.py Documentation
    • Scale & Size Detection
    • Artifact Visualizer — Documentation
    • width_calculator.py
    • extract_fonts — Font Detection Module
  • Frontend Implementation

    • Frontend — JavaScript Module Reference
    • State Management — state.js
    • PDF Viewer — pdf-viewer.js
    • API & Candidate Logic — api.js
    • UI Events — ui-events.js
    • WebGL Mask — webgl-mask.js
    • Formatting Bridge — text-tool.js
  • API Reference

    • API Reference

Frontend — JavaScript Module Reference

The frontend is a single-page application built with vanilla JavaScript (no build step). Scripts are loaded in order via <script> tags in index.html.

Loading Order

The scripts must load in this exact order because later modules depend on globals defined by earlier ones:

OrderFileDefinesDepends On
1state.jsstate, elsDOM elements
2api.jsaddName, calculateAllWidths, renderCandidates, selectRedaction, updateAllMatchesViewstate, els
3webgl-mask.jssetupWebGLOverlay, clearWebGLContexts, updateWebGLUniforms, fetchMasksAsyncstate, els
4pdf-viewer.jshandleFileUpload, goToPage, injectRedactionOverlaysstate, els, api.js, webgl-mask.js
5embedded-text-viewer.jscreateETVOverlay, findNearestETVLine, connectRedactionsToETVLines, initDragETVstate, els, pdf-viewer.js
6redaction-matching.jsinjectMatchingLabelapi.js
7ui-events.jsupdateCSSZoom, processZoomFromText, initResize, initDragRedaction, renderThumbnailsstate, els
8app.jsIIFE — wires all event listenersAll above
9text-tool.jsFormatting Toolbar Bridge (CustomEvents)state, els, app.js

External Libraries

LibraryCDNPurpose
Fabric.js 5.3.1cloudflareCanvas-based text overlays with drag/resize
Material SymbolsGoogle FontsToolbar icons
Inter fontGoogle FontsUI typography

Module Documentation

  • State Management — state object schema and els DOM cache
  • PDF Viewer — File upload, page navigation, redaction overlay rendering
  • API & Candidate Logic — Width calculation, candidate matching, sort/pagination
  • UI Events — Zoom, resize, drag, thumbnails
  • Embedded Text Viewer — Automatic text spans, bidirectional sync, snapping
  • Formatting Bridge — Shared options bar and formatting bridge
  • WebGL Mask — GPU-accelerated redaction mask rendering
Edit this page
Last Updated: 4/6/26, 10:34 AM
Contributors: JaguarM
Next
State Management — state.js