A Chrome extension that creates an interactive overlay for web content analysis and display. The extension processes webpage content and categorizes text into different sections while providing video playback controls.
:) Try it out here - https://chromewebstore.google.com/detail/web-2-brainrot/plimemogopfdmlfejdfbmldjaipihafa
manifest.json- The extension configuration file that defines permissions, resources, and metadataoverlay.html- The main HTML template for the extension's overlay interfaceoverlay.css- Styles for the overlay interfaceoverlay.js- UI controller for the overlay interfacecontentAnalyzer.js- Content analysis and categorization logicbackground.js- Background script handling extension initializationcontent.js- Content script for webpage interactiontextProcessor.js- Text processing utilities
/assets128.png,48.png- Extension iconsminecraft-gameplay.mp4- Sample video fileweb2brainrot-logo.png- Extension logo
/data-samples- Contains sample data files for testingsubstack-homepage-innertext.txtsample_html_page.html
The main interface controller that handles UI and display logic:
playPauseBtn.addEventListener('click')- Toggles video playback and text displaylikeBtn.addEventListener('click')- Handles like button interactioncommentBtn.addEventListener('click')- Handles comment button interactioncloseBtn.addEventListener('click')- Closes the overlaygptDetectionBtn.addEventListener('click')- Toggles GPT analysis mode
initializeVideoContainer()- Creates and sets up the video containercreateCategoryContainers()- Creates containers for different content categoriesclearContainers()- Cleans up category containersstartTextDisplay()- Initiates text display sequencepauseTextDisplay()- Pauses text display sequencedisplayNextSentence()- Controls the display of processed text
Core content analysis to processes webpage content:
analyzeTextWithGPT(text, element)- Performs GPT-based text analysiscategorizeText(text, element, useGPT)- Categorizes text based on context and contentprocessContent(content)- Main content processing pipeline
Handles extension initialization and overlay injection:
chrome.action.onClicked.addListener()- Main extension click handlerinjectOverlay()- Creates and injects the overlay interface- Removes existing overlay if present
- Creates overlay container
- Sets up iframe
- Handles click-outside behavior
Manages communication between webpage and extension:
chrome.runtime.onMessage.addListener()- Main message handler- Handles 'getPageContent' action
- Clones and processes page content
- Sends response with page content and base URL
The content script primarily uses inline functions within the message listener to:
- Clone DOM content
- Process page structure
- Handle message responses
overlay.js maintains several important state variables:
isPaused- Controls text display flowisInitialized- Tracks overlay initializationuseGPTAnalysis- Toggles GPT analysis modelastReceivedContent- Stores last processed contentsentences- Holds processed text segmentsindex- Tracks current display position
Text is categorized into five main types:
- Info - Informational content
- Interactive - Clickable elements
- Input - Form elements
- Navigation - Menu items
- Images - Image-related content
Content containers are positioned using the positions object:
- Clone the repository
- Load the extension in Chrome:
- Open Chrome Extensions (chrome://extensions/)
- Enable Developer Mode
- Click "Load unpacked"
- Select the extension directory
- Click the extension icon on any webpage
- Use the overlay controls to:
- Play/pause content analysis
- Toggle GPT detection
- View categorized content
- Interact with media controls
- Fork the repository
- Create a feature branch
- Submit a pull request
[Add your license information here]