Twitter: Highlight Posts with Links
Description
This userscript enhances your Twitter browsing experience by automatically detecting posts that contain external links and providing visual feedback. It helps you quickly identify posts with valuable external content while optionally filtering out posts without links.
Features
Link Detection
The script intelligently identifies posts containing external links through multiple methods:
- Clickable links: Detects standard hyperlinks with
target="_blank"
attributes
- Text-based URLs: Recognizes URLs written as plain text in quoted tweets
- Embedded post links: Finds links within quoted/embedded posts
- Smart filtering: Excludes internal Twitter links (x.com) from detection
Visual Highlighting
Posts containing external links are highlighted with a distinctive blue outline, making them instantly recognizable as you scroll through your feed.
Post Filtering
Optionally hide posts that don't contain external links. Hidden posts are collapsed using CSS visibility techniques that preserve the page layout and scroll behavior.
How to Use
Installation
- Install the script by clicking the button with a userscript manager like Tampermonkey or Greasemonkey
- Navigate to Twitter - the script will automatically start working
Recommended Companion Script
For an even better Twitter experience, consider using this script together with Twitter: expand tweets automatically - it automatically expands truncated tweets so you can immediately see the full content of highlighted posts without having to click "Show more" buttons. This combination ensures that links hidden in truncated content are properly detected and highlighted, giving you complete link discovery across all tweet content.
Settings
Access settings through your userscript manager's menu (typically accessible via the browser extension icon):
- Highlighting: On/Off - Toggle the blue outline highlighting for posts with links
- Hide Posts without Links: On/Off - Toggle hiding of posts that don't contain external links
Settings are automatically saved and persist between browser sessions.
Where It Works
The script is active on these Twitter pages:
- Home feed (x.com/)
- Search results (x.com/search?q=...)
- Profile pages (x.com/username)
Why It's Useful
- Information Discovery: Quickly spot posts with external articles, resources, or references
- Content Filtering: Focus on posts that link to external content if that's your primary interest
- Improved Browsing: Reduce visual clutter by hiding posts without links when desired
- Time Saving: No need to read through every post to find ones with valuable external links
Technical Details
- Non-intrusive: Preserves original page functionality and layout
- Regex-based: Employs sophisticated URL detection patterns
- Layout-friendly: Hidden posts use CSS visibility instead of display:none to maintain scroll behavior
Compatibility
- Works with Tampermonkey, Greasemonkey, and other userscript managers
- Automatically adapts to Twitter's dynamic content loading