A Chrome extension for getting your ideal clothing size on fashion websites, using Popsize's sizing technology.
-
Fork and clone the repository:
git clone https://github.com/your-username/chrome-extension.git cd chrome-extension -
Download
button.jsfrom the latest widget version:rm -rf dist mkdir -p dist curl -o dist/button.js https://engine.popsize.ai/latest/button.js
-
Load the extension in Chrome:
- Open Chrome and go to chrome://extensions/
- Enable "Developer mode"
- Click "Load unpacked" and select the extension folder
The widget can be injected in three ways:
- Automatic Injection: Automatically injects on supported websites (see
manifest.jsonfor the full list) - Extension Icon: Click the Popsize extension icon to manually inject the widget on any page
- Context Menu: Right-click anywhere on a page and select "Find my size with Popsize"
To ensure fair usage and system stability, the extension implements rate limiting:
- 5 injections per minute
- 60 injections per hour
- 100 injections per day
- 200 injections per week
The extension consists of several key components:
manifest.json: Extension configuration, permissions, and URL patternsbackground.js: Service worker that handles context menu, extension icon clicks, and rate limitingproduct.js: Content script that injects the Popsize widget with rate limit checksdist/button.js: The actual Popsize widget (downloaded separately)
The extension includes automated Puppeteer tests.
cd tests
npm installnpm testThe test will:
- Launch Chrome with the extension loaded
- Navigate to a test product page
- Verify extension functionality
- Check rate limiting setup
- Keep browser open for manual inspection
See tests/README.md for more details.
To add support for a new website:
- Add the URL pattern to
content_scripts.matchesinmanifest.json - Add the corresponding domain to
web_accessible_resources.matches - Test the injection on the new website
The extension requires these permissions:
contextMenus: For right-click context menu injectionscripting: For programmatic injection via icon/context menustorage: For rate limiting data persistencenotifications: For user notifications about rate limitshost_permissions: For injecting scripts on websites
We welcome contributions! Please follow these steps:
- Fork the repository on GitHub
- Clone your fork to your local machine
- Create a new branch for your feature or fix:
git checkout -b my-feature-branch - Make your changes and ensure they follow coding standards
- Test your changes thoroughly
- Create a pull request on GitHub against the dev branch of this repository
- Follow the PR template to describe your changes and any relevant context
- Wait for review: We will review your PR and provide feedback or merge it
- Add support for more e-commerce websites
- Improve the UI/UX of the extension, add settings
- Add analytics dashboard for rate limit usage
- Implement user preferences for widget appearance
AGPL 3.0 License. See LICENSE for details.