$ show maxchang3/BiliReveal
BiliReveal is a browser user script that enhances Bilibili's web interface by displaying IP location information in comment sections. The script detects which comment system is in use (Vue 2, Vue 3, or Lit-based web components) and hooks into the appropriate rendering mechanism to inject IP data fetched from Bilibili's APIs. It features a modular architecture with URL-based routing, separate injection strategies for different comment systems, and user-configurable text replacement rules. The project is actively maintained with recent updates, comprehensive end-to-end tests using Playwright, and a modern build setup using Vite and vite-plugin-monkey to generate both standard and Lite versions of the user script.
The LLM identified 2 files worth highlighting for reuse:
A lightweight URL routing system designed specifically for content scripts. It matches URLs against registered prefixes with optional suffix constraints and executes corresponding handlers. The implementation is isolated (only depends on logging), self-contained with a clear interface, and demonstrates non-obvious skill in route-based execution patterns for browser extensions. Could be extracted to any web extension needing URL-based behavior dispatch with minimal modification (logging calls could be replaced with console.log or removed).
Provides the `isElementLoaded` utility function that efficiently waits for DOM elements to appear using MutationObserver with automatic cleanup. It handles both immediate and asynchronous element loading, includes debug logging, and properly disconnects observers to prevent memory leaks. The component is highly isolated (only depends on logging), solves a universal problem in web scraping and DOM manipulation, and exhibits proper MutationObserver usage patterns. Extractable to any project needing to wait for dynamic content with almost no changes (logging could be stripped or replaced).