Twitter Video Popup Blocker (Enhanced)

Eliminates popup ads from Twitter video players - Generic version

作者
CurlyWurly
日安装量
0
总安装量
1
评分
0 0 0
版本
2.0
创建于
2025-09-28
更新于
2025-09-28
大小
10.1 KB
许可证
暂无
适用于

👋 Hey there, fellow Twitter (X) users!

🚫 Twitter Video Popup Blocker (Enhanced)

Tired of annoying popups and unexpected redirects when you just want to watch a video on Twitter/X? You click on a video, expecting it to play, and suddenly you're whisked away to some external website you never intended to visit. It's a frustrating experience that ruins your browsing flow.

This userscript is your ultimate solution! It's designed to bring peace back to your video viewing by aggressively blocking those unwanted popups and promotional links that often accompany videos on Twitter/X.

✨ Key Features

  • Zero Popups: Say goodbye to external websites launching in new tabs or windows when you click on a video.
  • Eliminates Promotional Links: The script intelligently removes those "From [website].com" links often found beneath promoted videos, regardless of the advertiser's domain. No more generic ad links!
  • Smart Click Prevention: Clicking anywhere on the video player will now *only* interact with the video player itself (play, pause, seek, fullscreen). It prevents any hidden event listeners from triggering external navigation.
  • Handles Dynamic Content: Twitter/X constantly updates its page structure and loads content dynamically. This script uses advanced techniques (Mutation Observers) to catch and block ads as they appear, ensuring consistent protection.
  • Preserves Video Functionality: Enjoy your videos without any impact on playback, controls, or quality. Only the unwanted ads are targeted.
  • Generic & Robust: Built to handle *any* advertiser URL, not just specific domains. This makes it future-proof against new ad sources.

🛠️ How It Works Its Magic

The script employs a multi-layered defense strategy:

  1. window.open Interception: It overrides the browser's window.open function to prevent any suspicious external URLs from opening.
  2. location.assign Override: Blocks sneaky redirects that try to change the current page without using `window.open`.
  3. DOM Element Removal: It actively scans for and removes promotional <a> (link) tags, particularly those with "From " text (e.g., "From OnlyFans.com") or patterns commonly used by ad networks, even if they're hidden.
  4. Click Event Shield: It intercepts click events within video player containers. If a click is not on a legitimate video control (like play/pause buttons or the seek bar), and there's a suspected ad link, the click is cancelled to prevent navigation.
  5. Mutation Observers: Continuously monitors the page for new content (like dynamically loaded videos or ads) and applies the blocking rules as soon as they appear.

🚀 Installation (for Tampermonkey/Greasemonkey users)

  1. Make sure you have a userscript manager like Tampermonkey (recommended) or Greasemonkey installed in your browser.
  2. Click the "Install" button on this Greasy Fork page.
  3. Your userscript manager will prompt you to confirm the installation.
  4. Refresh Twitter/X (x.com or twitter.com) to activate the script.

You can verify it's working by opening your browser's developer console (usually F12) and looking for messages like "🚫 Blocked generic popup:", "🗑️ Neutered/Removed generic promo link:", or "🛡️ Blocked click on promo video area".

Enjoy an ad-free video experience on Twitter (X)! If you encounter any issues or new ad types that slip through, please report them, and I'll work to update the script.