How sin-1337/crabs works
Project type and purpose
• This is an open-source browser “user script” (aka a front-end extension) named CRABS (Crazy Roster Add-on).
File structure
– Top‐level build & config files:
• package.json / rollup.config.mjs (build bundler)
• tsconfig.json / eslint.config.mjs (TypeScript + linting)
• crabsloader.user.js (the installer/loader user‐script)
– src/ directory:
• main.ts – entry point, initializes the script when loaded in the browser
• base.ts + globals.d.ts – shared utilities & ambient types for the BC environment
• modules/ – feature modules: banner.ts, roster.ts, help.ts, whisperplus.ts, dom.ts
• modules/templates/ – per-module HTML & CSS templates
• templates/ – global wrapper HTML & CSS
• types/ – custom type definitions for HTML and CSS imports
README insights
• Usage instructions describe three installation methods (FUSAM addon, Violent/Tampermonkey, bookmarklet).
a. Main components:
1. Loader (crabsloader.user.js / bookmarklet)
2. Build Pipeline (Rollup + TS → bundle.js)
3. Browser Environment (Bondage Club page & global JS API)
4. CRABS Runtime (the injected bundle.js running in page context)
– main.ts initializer
– Module Registry (manages feature modules)
– Feature Modules
• Banner Module
• Roster Module
• Whisper+ Module
• Help Module
• DOM Utilities Module
– Templates & Styles (HTML/CSS assets loaded by modules)
5. User Interactions (chat commands, DOM clicks)
b. Relationships & interactions:
• Loader fetches & executes bundle.js in BC page.
• main.ts boots, reads globals for BC APIs, registers modules.
• User types commands in chat or clicks UI → bundle intercepts events via dom.ts.
• Modules parse commands, fetch appropriate HTML templates & CSS, then manipulate DOM to render overlays or banners.
• Templates are embedded strings that modules inject into the page.
• Build Pipeline compiles TS + templates into a flat JS bundle.
c. Architectural patterns & principles:
• Modular design: each feature in its own file + templates.
• Separation of concerns: dom.ts for low-level DOM ops, modules for feature logic, templates purely for view.
• Single-bundle deployment: Rollup produces one user-scriptable bundle.
• Progressive enhancement: non-intrusive injection into existing game UI.
d. Key technologies/frameworks/libraries:
• TypeScript (static types)
• Rollup (module bundler)
• FUSAM / GreaseMonkey API (optional)
• Vanilla DOM APIs
Final recommendations
• Every distinct part: loader, build pipeline, runtime modules, templates, and the target environment.
• data/control flow: how a chat command or click travels from browser → your code → DOM update.