BlockPup

Blocks unwanted popups with whitelist/blocklist control and interactive dialogs.

作者
0xArCHDeViL
日安装量
1
总安装量
3
评分
0 0 0
版本
0.8
创建于
2025-08-23
更新于
2025-08-24
大小
51.8 KB
许可证
MIT
适用于
所有网站

BlockPup – Advanced Popup Interceptor and Manager

BlockPup is a powerful userscript designed to put an end to intrusive popup windows while giving you fine-grained control over which sites are allowed or blocked. Instead of silently letting websites hijack your browsing with unwanted tabs, BlockPup intercepts popup requests and prompts you with clear choices—block, allow once, whitelist permanently, or blacklist permanently.

This script is built with flexibility, usability, and persistence in mind. Whether you’re tired of ad-driven popups or simply want to maintain stricter browsing hygiene, BlockPup provides an elegant and customizable solution.


Key Features

  1. Popup Interception

    • Replaces the native window.open() with a controlled interceptor.
    • Detects and intercepts popup attempts from links, scripts, and form submissions targeting new tabs/windows.
  2. Interactive Decision Dialog

    • When a popup is detected, a clean and modern overlay is displayed.
    • Options include:
      • Allow Once: Permit the popup temporarily.
      • Always Allow…: Whitelist a domain or specific pattern for future popups.
      • Always Block…: Blacklist a domain or pattern to block future attempts.
  3. Whitelist and Blocklist Management

    • Maintain persistent domain and pattern-based rules.
    • Default whitelist includes safe local addresses (localhost, 127.0.0.1).
    • Add or remove patterns dynamically through an in-browser management dialog.
    • Fully integrated with Userscript Manager storage APIs (GM_setValue, GM_getValue).
  4. Pattern Matching Engine

    • Supports wildcard-based patterns (*.domain.com/*).
    • Converts patterns into efficient regex for accurate matching.
    • Caching mechanism reduces redundant lookups and improves performance.
  5. User Interface

    • Styled with attention to detail and responsive design.
    • Automatically adapts to light and dark mode based on system preferences.
    • Clean typography and visual hierarchy for effortless interaction.
  6. Menu Integration

    • Adds convenient Userscript Manager menu commands:
      • Manage Whitelist
      • Manage Blocklist

Technical Highlights

  • Popup Hijacking: Overrides window.open and intercepts user-triggered navigation (<a target="_blank"> and <form target="_blank">).
  • Shadow DOM Encapsulation: Ensures dialogs and management UIs don’t conflict with site styles.
  • Persistent Storage: User preferences are stored using Userscript Manager value storage, surviving browser restarts.
  • Dynamic Caching: Rule lookups are cached for five minutes to balance performance and real-time accuracy.
  • Robust Removal and Editing: Users can manage lists interactively, removing or editing rules with minimal effort.

Use Cases

  • Block malicious popups on shady sites.
  • Allow trusted domains (e.g., Google Drive or GitHub auth flows) without manual intervention each time.
  • Maintain a tailored browsing environment with minimal disruption.

Requirements

  • Userscript Manager: Violentmonkey, Tampermonkey, or compatible alternatives.
  • Browser Support: Works on all modern browsers supporting ES6 and shadow DOM.

Author & License

  • Author: 0xArCHDeViL
  • License: Free to use and modify under personal discretion.