How sheep-realms/echo-moji works
Project type and purpose
• Echo-MoJi is a client-side OBS plugin delivered as HTML/JS/CSS, which displays random “marquee” messages (跑马灯) in a live stream.
• It also includes a standalone settings UI for configuring message content, effects, and appearance.
File structure
Top level:
• app.js, config.js – Bootstrap and configuration loader
• message.js – Core message-engine script
• echomoji.html – Main plugin UI (browser source)
• settings.html – Configuration interface
• lang/ – Localization modules
• lib/ – Third-party drivers and markdown support
• res/ – Plugin resources: classes, data tables, images, scripts, styles
Patterns:
• Modular JS classes under res/class
• Data-driven configuration under res/data
• Separation of “runtime” (echomoji.html + message.js + CSS) vs. “configuration” (settings.html + config.js)
Extract key insights from the README
• The plugin is deployed by pointing OBS’s Browser Source to echomoji.html.
• Settings saved to disk in the root directory; echomoji.html reads that file at runtime.
• message.js is the core locus for editing the displayed messages.
Main components and their interactions
a. OBS Host (External Service)
• Launches a browser instance pointing to echomoji.html.
b. Browser-Source Runtime
• echomoji.html
• app.js: Initializes the plugin, loads config
• driver.js (in lib/driver): Low-level rendering driver
• message.js: Controls the marquee logic
• CSS (in res/style): Defines visuals and animation
• res/class/*.js: Modular tool and UI classes (e.g., EditorConstructor, EchoMoJi, Updater)
c. Settings Interface
• settings.html + i18n.js: UI for adjusting parameters
• config.js: Reads/writes JSON config file to disk
• res/script/settings.js: Hooks UI events, persists changes
d. File System Storage
• config file (JSON) saved in project root
• echomoji.html runtime reload picks up updates
e. Localization Layer
• lang/index.js + lang/*: Language bundles for both interfaces
Architectural patterns and principles
• Modular JS classes (OOP-style under res/class)
• Data-driven UI/config (res/data + JSON config)
• Clear separation between “runtime” and “configuration” modes
• Single-page HTML applications leveraging resource directories
Technologies & frameworks
• Vanilla JavaScript with IIFE bundles for drivers (lib/driver/driver.js.iife.js)
• CSS for layout and animations (res/style)
• Simple file-based JSON config (no server)
• OBS browser source as the host environment
• Clear labels on each component block
• Blue for runtime components
• Green for settings/config components
• Orange for file storage
• Gray for external OBS host
• Related directories (res/class, res/data, res/style) inside the runtime container
• Interactions: e.g., “message.js triggers CSS animations via driver.js”