$ show XIU2/UserScript
This repository is a collection of over 20 user scripts (Tampermonkey/Greasemonkey) that enhance the browsing experience on various websites. The scripts provide site-specific beautifications, functional enhancements (e.g., removing login popups, blocking users/keywords, restoring original images), and general utilities like dark mode, auto-pagination, and high-speed download acceleration for GitHub. The architecture is monolithic: each script is a single, self-contained JavaScript file that runs in the browser via the userscript manager. The code heavily relies on DOM manipulation, MutationObserver, and GM_* APIs for storage, notifications, and cross-origin requests. The most notable component is the Autopage engine, a generic infinite-scroll and pagination system that uses an external rules JSON to support hundreds of sites. While functional and popular (10k+ stars), the codebase suffers from code duplication across scripts, tight coupling to specific website DOM structures, and lack of modularization or testing. The repository is actively maintained with issue templates and regular updates, but the reliance on external rules and site-specific selectors introduces ongoing maintenance risk.
The LLM identified 2 files worth highlighting for reuse:
A generic, self-contained userscript that automatically loads next pages for infinite scroll or traditional pagination across thousands of sites. It uses a remote rules JSON to define site-specific selectors and strategies (scroll, click, URL change). The script demonstrates a sophisticated rule engine with fallback detection for common CMS frameworks, dynamic content handling via MutationObserver, and a custom rule editor UI. It is reusable as a standalone pagination library for any website, requiring only a rules configuration.
A comprehensive dark mode userscript that applies CSS overrides to any website. It features a dynamic menu system for toggling modes (dark, sepia, custom), adjusting brightness/warmth, scheduling automatic day/night switching, and excluding sites with native dark mode. The script demonstrates a clean pattern for managing multiple user preferences via GM_registerMenuCommand and GM_setValue, and injects styles efficiently. It is reusable as a template for any site-wide theming userscript.