A robust Chrome extension that randomly selects a restaurant from Grubhub listings when you can't decide what to eat!
- Random Restaurant Selection: Picks one restaurant from all available options on Grubhub pages
- Smart Content Filtering: Removes featured/promotional content for better randomization
- Auto Load More: Automatically loads additional restaurants for more options
- Fallback Selectors: Multiple selector strategies to handle DOM changes
- Comprehensive Error Handling: Graceful degradation with user-friendly error messages
- Race Condition Prevention: Proper async/await patterns with timeout mechanisms
- Page Validation: Ensures extension only runs on supported Grubhub pages
- Loading Indicators: Visual feedback during processing
- Status Messages: Success/error notifications with auto-hide
- Configuration Options: Toggle featured content removal and auto-load
- Improved UI: Modern, responsive design with better accessibility
- Class-based Architecture: Organized, maintainable code structure
- Proper Logging: Structured logging for debugging
- Storage Integration: Saves user preferences
- Timeout Handling: Prevents hanging operations
The extension works on these Grubhub page types:
/lets-eat*
- Main restaurant browsing/restaurant*
- Individual restaurant pages/delivery*
- Delivery listings/takeout*
- Takeout listings/search*
- Search results pages
grubhub-roulette/
βββ manifest.json # Extension manifest
βββ popup.html # Extension popup UI
βββ js/ # JavaScript files
β βββ popup.js # Popup functionality
β βββ content.js # Content script
β βββ background.js # Background service worker
βββ css/ # Stylesheets
β βββ popup.css # Popup styling
βββ icons/ # Extension icons
β βββ icon16.png
β βββ icon48.png
β βββ icon128.png
βββ tests/ # Test scripts
β βββ test.sh # Comprehensive tests
β βββ quick-test.sh # Quick validation
β βββ test-functionality.html
βββ docs/ # Documentation
β βββ TESTING.md # Testing guide
βββ README.md
- Clone or download this repository
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the extension directory
- Navigate to a supported Grubhub page and click the extension icon
This project uses Just as the command runner instead of npm scripts. Install Just and run just --list
to see all available commands.
# Install Just (if not already installed)
# On macOS: brew install just
# On Linux: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash
# See all available commands
just --list
# Run tests
just test
# Build the extension
just build
- Navigate to any supported Grubhub page with restaurant listings
- Click the Grubhub Roulette extension icon in your browser toolbar
- Configure options (optional):
- Remove featured restaurants: Filters out promoted content
- Load more restaurants: Automatically loads additional options
- Click "Spin the Wheel!" to randomly select a restaurant
- Enjoy your randomly selected meal!
When enabled (default), removes promotional and featured restaurant sections to ensure truly random selection from regular listings.
When enabled (default), automatically clicks "Load More" buttons to expand the available restaurant pool before making a selection.
The extension includes comprehensive error handling for common scenarios:
- Page Not Supported: Clear message if not on a Grubhub page
- No Restaurants Found: Handles empty or loading pages gracefully
- Network Issues: Timeout handling for slow-loading content
- DOM Changes: Fallback selectors for site updates
GrubhubRoulette
: Main class handling restaurant selection logicSelectorManager
: Robust element selection with fallback strategiesLogger
: Structured logging for debugging and monitoring
PopupController
: Manages UI interactions and user preferences- Modern, responsive design with status feedback
- Configuration options with persistent storage
BackgroundService
: Handles extension lifecycle events- Installation and update management
- Chrome 88+ (Manifest V3 support)
- Edge 88+ (Chromium-based)
- Complete rewrite with robust architecture
- Added fallback selectors and error handling
- Enhanced UI with configuration options
- Improved page validation and timeout handling
- Added user preference storage
- Basic random restaurant selection
- Simple DOM manipulation
- Limited error handling
# Build the extension for Chrome Web Store
just build
# Build with specific version
just build-version 2.0.0
This creates:
dist/grubhub-roulette-v2.0.0.zip
- For Chrome Web Store submissiondist/grubhub-roulette-v2.0.0-unpacked/
- For development/testing
The extension uses GitHub Actions for automated releases to the Chrome Web Store:
- Create a GitHub Release with a version tag (e.g.,
v2.0.0
) - The workflow automatically:
- Validates the extension
- Builds the package
- Uploads to Chrome Web Store
- Creates release artifacts
- Chrome Web Store Developer Account ($5 one-time fee)
- Google Cloud Console project with Chrome Web Store API enabled
- GitHub Secrets configured with OAuth2 credentials
See docs/RELEASE.md for detailed setup instructions and complete release process documentation.
The extension includes comprehensive automated tests that run on every commit:
# Run quick tests
just test-quick
# Run full test suite
just test
# Check JavaScript syntax only
just test-syntax
# Validate JSON files
just test-json
All tests run automatically via GitHub Actions on:
- Every push to main/master/develop branches
- Every pull request
- Manual workflow dispatch
The CI pipeline validates:
- β File structure and existence
- β JavaScript syntax
- β JSON validity
- β Extension manifest requirements
- β Family-friendly content
- β CSS/HTML structure
- β URL pattern support
- Fork the repository
- Create a feature branch
- Make your changes with proper error handling
- Run tests locally:
just test
- Test on multiple Grubhub page types
- Submit a pull request (tests will run automatically)
MIT License - feel free to modify and distribute!