A Tampermonkey userscript that automatically removes advertisements from TradingView charts and pages.
- Instantly removes ads as they are injected into the page
- Multiple removal strategies:
- MutationObserver for immediate removal of newly injected ads
- Periodic checks every 5 seconds as a safety net
- CSS rules to hide ad containers
- Targets various ad types:
- Google Ads iframes
- Banner advertisements
- Native ad units
- Dynamic ad containers
- Install the Tampermonkey extension for your browser
- Click here to view the script
- Click the "Raw" button to view the source
- Tampermonkey should automatically detect the script and prompt you to install it
- Click "Install" to add the script to Tampermonkey
The script uses three strategies to remove advertisements:
- MutationObserver: Watches the DOM for newly added elements and immediately removes any that match known ad patterns
- Periodic Checking: Runs every 5 seconds to catch any ads that might have slipped through
- CSS Rules: Hides common ad containers to prevent visual flicker
- Matches iframe elements with:
- IDs containing:
google_ads_iframe,googleads - Source URLs containing:
googlesyndication,doubleclick.net,ads
- IDs containing:
- Matches elements with:
- ID:
adunit - Classes containing:
tv-advertising,tv-advertisement,advertisement,banner-ads
- ID:
The script uses modern JavaScript features and DOM APIs:
MutationObserverfor real-time DOM monitoringquerySelectorAllfor efficient element selection- CSS attribute selectors for flexible matching
- Promise-based timing for reliable execution
MIT License - Feel free to modify and share!