How esteve11/wab-tools works
Main Components
• Manifest & Configuration: Represented by “manifest.json”, which is the core configuration file for the Chrome extension. This defines things like the extension’s permissions, injected scripts, and entry points.
• Content Scripts / Feature Scripts:
– “add-rotate-image-button.js”: Implements the feature to rotate images.
– “avoid-enter-send.js”: Implements the modified behavior for the Enter key.
– “observer-setup.js”: Likely used to monitor DOM changes on WhatsApp Web so that when the page updates, the extension can hook in and modify the necessary elements.
• Developer Tools & Ignored Files: “.gitignore” for source control and “README.md” which provides instructions and an overview for installation.
Establish Relationships and Interactions
• The content scripts then interact directly with the WhatsApp Web DOM. For example, the “add-rotate-image-button.js” script inserts an additional UI element, while “avoid-enter-send.js” alters key event behaviors.
• “observer-setup.js” acts as a monitoring component that detects dynamic changes on the webpage and triggers the appropriate functionality. This component can be noted as essential for ensuring that the changes persist as new content loads in the dynamic web environment.
Architectural Patterns & Principles
• Modular Design: The extension is designed in a modular way by separating feature-specific logic into individual scripts.
• Event-Driven Behavior: “observer-setup.js” typically uses event listeners (like Mutation Observers) to react to changes in the web page.
• Separation of Concerns: Each file is focused on a specific feature, making it easier to maintain and update functionalities independently.
• Minimal Invasiveness: The extension only injects small pieces of code into the existing WhatsApp Web interface rather than rebuilding the entire UI.