A Chrome/Opera extension that color-codes tweets by view-count and flags fresh ones with 🔥.
- Visual heat map: Tweets get colored right borders based on view count
- Blue: 1K - 10K views
- Green: 10K - 50K views
- Red: 50K+ views
- Fresh tweet indicator: 🔥 emoji for tweets ≤ 30 minutes old
- Toggle control: Easy on/off switch via extension popup
- Keyword highlighting: Add custom keywords to highlight in tweets
- Instant refresh: Manual refresh button and automatic refresh on any setting change
- Wide compatibility: Works across all Twitter/X page types
-
Clone the repository:
git clone <repo-url> cd tweet-heat-map
-
Install dependencies:
npm install
-
Build the extension:
npm run build
-
Load in browser:
- Chrome/Brave/Edge: Go to
chrome://extensions/, enable Developer mode, click "Load unpacked", select thedistfolder - Opera: Go to
opera://extensions/, enable Developer mode, click "Load unpacked", select thedistfolder
- Chrome/Brave/Edge: Go to
Download from Chrome Web Store (coming soon)
npm run build- Build for productionnpm run dev- Build with file watching for developmentnpm run test- Run unit testsnpm run lint- Run ESLintnpm run format- Format code with Prettier
- Make changes to source files in
src/ - Run
npm run devfor automatic rebuilds - Reload the extension in your browser (click refresh icon in extensions page)
- Test changes on Twitter/X
npm testUnit tests cover the view count parsing logic and ensure compatibility with various Twitter view count formats.
src/
├── manifest.json # Extension manifest
├── content.ts # Main content script
├── utils.ts # Utility functions
├── popup/ # Extension popup UI
│ ├── popup.html
│ ├── popup.css
│ └── popup.ts
└── icons/ # Extension icons
└── icon128.png
tests/ # Unit tests
dist/ # Built extension (generated)
- Manifest Version: 3
- Build Tool: Vite + TypeScript
- Testing: Jest + jsdom
- Linting: ESLint with TypeScript rules
- Target Browsers: Chrome 120+, Opera 95+, Brave, Edge
When developing for the current Twitter/X interface, be aware that the DOM is extremely dynamic. The front-end frequently re-renders entire components, which can wipe out any direct manipulations (like adding a CSS class).
Key solutions implemented in this extension:
- Target Stable Containers: Instead of applying the
views-*class directly to the<article data-testid="tweet">element, it is applied to its parent<div>. This parent container is less likely to be re-rendered on user interaction (e.g., hover), preventing the custom class from being removed. - Use a Robust
MutationObserver: The content script observes the central<main>timeline for bothchildListandattributeschanges. This ensures that styling is re-applied correctly whenever a tweet is added or its attributes (likeclass) are modified by Twitter's own scripts. - Instant Refresh System: Any change in the popup (toggle, keywords, manual refresh) immediately triggers re-application of effects via both direct messaging and storage events, ensuring effects are always current.
activeTab- Access current tab contentstorage- Save user preferencesscripting- Inject content scripts
This extension:
- ✅ Works entirely locally (no external servers)
- ✅ Only accesses Twitter/X pages
- ✅ Stores preferences locally in your browser
- ❌ Does not collect or transmit any data
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes and add tests
- Run
npm run lint && npm test && npm run build - Submit a pull request
ISC License - see LICENSE file for details