This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a browser extension called "FACE" that adds a movable face image to web pages. The face follows the mouse cursor and can be toggled between moving and static modes.
- Content Script (
src/content-scripts/face.js): Injected into all web pages to display and control the face image - Popup Interface (
src/popup/settings.html|js|css): Settings panel for users to configure the extension - Message Passing: Communication between popup and content scripts using browser.runtime.onMessage
- Build System: Vite with vite-plugin-web-extension for modern development workflow
-
Face image follows mouse cursor when in "moving" mode
-
Click face to toggle between moving/static modes
-
Settings allow users to:
- Toggle face visibility
- Adjust face size (pixels)
- Set custom image URL
-
Settings persist across browser sessions using storage API
# Install dependencies
npm install
# Start development server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview- Development: Load from
dist/folder after runningnpm run build- Firefox: about:debugging → This Firefox → Load Temporary Add-on → select
dist/manifest.json - Chrome: chrome://extensions → Enable Developer Mode → Load unpacked → select
distfolder
- Firefox: about:debugging → This Firefox → Load Temporary Add-on → select
The codebase handles both Firefox and Chrome APIs:
if(window['browser'] === undefined) {
window['browser'] = chrome;
window['is_chrome'] = true;
}face/
├── src/ # Source files
│ ├── manifest.json # Extension manifest (v3)
│ ├── content-scripts/
│ │ └── face.js # Main content script
│ ├── popup/
│ │ ├── settings.html # Popup UI
│ │ ├── settings.js # Popup logic
│ │ └── settings.css # Popup styles
│ └── icons/ # Extension icons (48, 96, 128px)
├── public/ # Static assets copied to dist
├── dist/ # Build output (git-ignored)
├── vite.config.js # Vite configuration
└── package.json # Dependencies and scripts
- Uses Manifest V3 for modern browser support
- Permissions:
storage,activeTab,scripting - Host permissions:
*://*/* - Content script injection:
"run_at": "document_idle"
The vite.config.js is configured to:
- Use
srcas root directory - Output to
distdirectory - Copy static assets from
publicdirectory - Handle Chrome extension specifics via vite-plugin-web-extension
- Uses browser.storage.local for persistent settings
- Default values:
- Active: true
- Size: 150px
- Image:
http://pngimg.com/uploads/face/face_PNG5660.png
- Content script initializes with saved settings on page load
- Popup sends messages to active tab's content script
- Messages contain setting updates:
{is_active, size, image} - Content script updates face appearance in real-time
- Update popup UI in
src/popup/settings.html - Add event handlers in
src/popup/settings.js - Handle new message properties in
src/content-scripts/face.js - Update storage handling in both files
- Run
npm run devfor development mode - Load extension in browser
- Open any webpage to see the face
- Use popup to test settings changes
- Check browser console for any errors
- Run
npm run build - Test the production build from
dist/ - Create a zip of the
distfolder for distribution