See the world like Trump does.
Features • Installation • Examples • Development • Contributing • License
Trump Goggles is a browser extension that automatically replaces references to Donald Trump and related terms with their Trumpian equivalents across the web. Experience the internet through Trump's unique perspective!
- Automatic Replacements: Replaces mentions of Donald Trump, politicians, media outlets, and more with Trump's nicknames
- Original Text Tooltips: Hover over or focus on converted text to see the original text in a tooltip
- Dynamic Content Support: Works with dynamically loaded content using MutationObserver
- Cross-browser Compatibility: Supports Chrome, Firefox, and Edge
- Performance Optimized: Efficient processing with minimal impact on page loading and browsing
- Accessibility Support: Keyboard navigation, ARIA attributes, and screen reader compatibility
- No Configuration Needed: Works out of the box without any setup
Download the extension for Google Chrome here.
Firefox Add-ons store link will be added soon.
See the Development section below for instructions on installing the development version.
This project requires pnpm for package management. To install pnpm:
curl -fsSL https://get.pnpm.io/install.sh | sh -Trump Goggles transforms your browsing experience with replacements like:
| Original | Replacement |
|---|---|
| ISIS | Evil Losers |
| Hillary Clinton | Crooked Hillary |
| New York Times | FAKE NEWS |
| CNN | Very Fake News |
| Covid-19 | China Virus |
| Coronavirus | The Invisible Enemy |
| and many more! |
When you visit a webpage, Trump Goggles scans the text content for certain keywords and phrases, replacing them with alternative versions that reflect Trump's colorful vocabulary. The extension:
- Processes the initial page content
- Watches for dynamically added content
- Performs replacements while preserving the page's functionality
- Skips inputs, textareas, and other editable elements
- Wraps converted text in interactive elements that show tooltips with the original text
- Provides keyboard navigation for accessing original text (using Tab and Escape keys)
For more details on the extension's behavior, see docs/behavior.md.
- Node.js (v18.18.0 or higher)
- pnpm (v7.0.0 or higher)
# Clone the repository
git clone https://github.com/yourusername/trump-goggles.git
cd trump-goggles
# Install dependencies
pnpm install- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" in the top-right corner
- Click "Load unpacked" and select the project directory
- The extension should now be installed and active
- Open Firefox and navigate to
about:debugging#/runtime/this-firefox - Click "Load Temporary Add-on..."
- Select the
manifest.jsonfile in the project directory
# Build the extension
pnpm build
# Build for production (minified, no source maps)
pnpm build:prod
# Watch mode for development
pnpm build:watch
# Clean build directory
pnpm build:clean
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage
# Run linting
pnpm lint
# Fix linting issues
pnpm lint:fix
# Format code with Prettier
pnpm format
# Check TypeScript types
pnpm typecheck
# Check TypeScript types specifically in test files
pnpm typecheck:testThe extension uses Rollup to bundle ES Modules for browser extension compatibility:
- Development Build (
pnpm build:watch): Includes inline source maps for debugging, watches for file changes - Production Build (
pnpm build:prod): Minified output, no source maps, optimized for extension size - Output Directory: All built files are output to
dist/directorydist/content.js- Content script bundledist/background.js- Background script bundledist/manifest.json- Extension manifestdist/images/- Extension icons and images
The extension is built using a modular architecture:
- Content Script: Runs on web pages and modifies content
- Background Script: Handles extension lifecycle and browser events
- Core Modules:
- Text Processor: Handles text replacement logic
- DOM Processor: Traverses the DOM and finds text nodes
- Mutation Observer: Watches for DOM changes
- Trump Mappings: Defines replacement patterns
- Browser Adapter: Provides cross-browser compatibility
- Error Handler: Ensures reliability
- Logger: Provides diagnostic information
For more details, see docs/architecture.md.
The project uses Vitest for unit and integration testing, and Playwright for end-to-end (E2E) testing:
# Run all unit and integration tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run E2E tests (requires browser extension to be built)
pnpm test:e2e
# Run E2E tests with UI mode (for interactive debugging)
pnpm test:e2e:ui
# Run E2E tests with debug mode
pnpm test:e2e:debug
# View the E2E test report
pnpm test:e2e:reportE2E tests verify the tooltip feature of the extension in a real browser environment:
- Tests verify tooltip appearance on hover
- Tests verify keyboard navigation and accessibility
- Tests verify tooltip content matches original text
- Tests verify tooltip behavior with dynamic content
The E2E tests require the extension to be loaded in a headful browser and cannot run in headless mode due to browser extension limitations.
Contributions are welcome! Please see CONTRIBUTING.md for detailed guidelines on how to contribute to this project.
Upcoming features and improvements:
- Option page for customizing replacements
- User-defined replacements
- Support for additional languages
- Performance optimizations for very large pages
This extension is intended for entertainment purposes only. It doesn't reflect the political views of the developers.
