How kishoraditya/chat-navigator-extension works
Project type and purpose
• This is a Chrome extension (Manifest V3) that injects UI into supported chat websites (ChatGPT, Claude.ai, Grok, etc.)
• Purpose: Add floating “Q” and “C” buttons to parse the page’s DOM, list questions/chats, and enable smooth navigation.
File structure
• At the root:
– manifest.json (defines permissions, content scripts, matches)
– ARCHITECTURE.md / README.md (docs)
– LICENSE
• content-scripts/
– ui-handler.js (core UI logic & controller)
– platform parsers (chatgpt.js, claude.js, copilot.js, deepseek.js, gemini.js, grok.js, meta.js, perplexity.js)
• styles/
– floating-ui.css (translucent UI styling)
• No backend or server components—pure client-side.
README for additional insights
• Uses Manifest V3, Content Scripts, MutationObserver, debounced updates, and CSS Backdrop Filter.
• Parsers implement a uniform interface (getQuestions(), getChats()) for each platform.
Main components & their relationships
a. Browser & Manifest
– Chrome loads manifest.json, grants activeTab permission, and injects content scripts on matching URLs.
b. Content Scripts
– Platform Parsers: scan the host page’s DOM to extract questions and chat links.
– UI Handler: receives parsed data, renders floating Q/C buttons, handles click events, overlays panels.
c. Styles
– floating-ui.css: injected by the UI Handler to style panels and buttons with backdrop blur and positioning.
d. DOM & Page
– The live page on supported domains (chat.openai.com, claude.ai, etc.)—source of AST-like data parsed by scripts.
e. Core interactions:
1. User navigates to a supported site → Browser (via manifest) injects parsers + ui-handler.js + CSS.
2. Parsers use MutationObserver to watch for new messages or navigation events.
3. On detection (debounced), parsers extract question/chat arrays and emit them to UI Handler.
4. UI Handler builds or updates floating UI overlay, injecting HTML into the page.
5. User clicks Q/C buttons → UI Handler scrolls/smooth-scrolls the host page to the selected element.
Architectural patterns & design principles
• Separation of Concerns: Each parser file handles a single platform’s DOM quirks; ui-handler.js handles all UI rendering & event wiring.
• Event-driven: MutationObserver events drive updates; click events drive navigation.
• Debouncing: Limits update frequency for performance.
• Modular: New platforms can be added with minimal changes—just drop in a new parser and update manifest.json.
Technologies, frameworks, and libraries
• Manifest V3 (Chrome extension spec)
• Content Scripts (injected JavaScript)
• CSS Backdrop Filter for translucent UI
• MutationObserver (DOM API)
• Vanilla JS (no framework)
• Debounce utility (in ui-handler.js)