How sysrqmagician/extraneous works
Main Components
• Browser Extension Core – The project leverages a WebExtension manifest (manifest.json) that defines the extension’s identity and behavior.
• Background Script – Located in src/background.ts, this component handles extension lifecycle events, communication, and central logic.
• Content Script – Found in src/content.ts, it interacts directly with the web page content rendered by Invidious.
• Popup UI – In the popup folder (popup/popup.html), this UI component provides a user interface for configuration or notifications.
• Feature Modules – In the src/modules directory, several scripts (like additionalLinks.ts, deArrow.ts, hideSlop.ts, watched.ts) add specific functionalities.
• Configuration & Initialization – Files like src/config_popup.ts might manage custom settings or interactions from the popup.
• Build & Development Tools – Files such as build.ts, cog.toml, and workflow configurations in .github/workflows indicate automated build, linting, testing, or deployment pipelines.
• Deno Environment – The project uses Deno (as seen by deno.jsonc and deno.lock) to run and manage TypeScript code outside of traditional Node environments.
Relationships and Interactions
• The manifest.json acts as the entry point, linking various script components (background, content, UI).
• The Background script governs overall extension behavior and communicates with both content scripts and the popup UI.
• Content scripts embedded into web pages perform modifications (applying features like DeArrow or video hiding) by interacting with DOM elements.
• The Popup UI provides a front-end which sends user commands or settings to the background component.
• Feature modules operate as independent components under the background or content scripts, encapsulating their respective functionalities. They may also interact with one another if their features interlink (e.g., caching data or sharing configuration settings).
Architectural Patterns and Technologies
• Modularity: Functionalities are broken into discrete modules under src/modules.
• Separation of Concerns: The design separates the UI layer (popup), central logic (background), and web content manipulation (content scripts).
• Messaging/Communication: Expect a clear message-based API for communication between the popup, background, and content scripts.
• Build & Automation: The CI/CD integration (via .github/workflows), Deno runtime, and build scripts (build.ts, Justfile) align with modern JavaScript/TypeScript project practices.