$ show code-charity/youtube
A browser extension (ImprovedTube) that provides 80+ configuration options to customize YouTube's appearance and behavior. It injects CSS and JavaScript into YouTube pages to modify the player, sidebar, comments, thumbnails, themes, and more. Features include ad blocking, forced playback parameters, keyboard shortcuts, a blocklist for channels/videos, smart speed based on heatmap data, and integration with Return YouTube Dislike. The extension uses a message-passing architecture between content scripts and page-world scripts via custom DOM events, and a custom Satus UI framework for the settings panel. It is localized into 40+ languages but has a high number of open issues and dependencies on fragile YouTube DOM structures. The codebase is functionally comprehensive but shows signs of maintenance drift with hardcoded API keys, heavy use of !important CSS, and incomplete locale coverage.
The LLM identified 3 files worth highlighting for reuse:
Implements a two-way communication system between the extension's content script and the page-world script using custom DOM events (it-message-from-extension, it-message-from-youtube). This pattern allows the extension to securely exchange data and commands with the page context without direct access, maintaining isolation. The core.js files in both extension/ and web-accessible/ directories mirror each other's messaging interface, making this a self-contained pattern for cross-context script communication.
A keyboard shortcut engine that stores key combinations as structured objects, supports modifier keys, wheel events, and click events, and implements stuck-key recovery by listening to native blur/visibilitychange events. It is self-contained within the ImprovedTube object and can be extracted for any web application requiring complex keyboard shortcut management with robust state handling.
Provides three fallback methods for removing videos from YouTube playlists: Innertube API calls (edit_playlist and modify endpoints), UI-driven click simulation, and custom event dispatching. This abstraction layers reliability by attempting the most efficient method first and falling back to less reliable ones. The logic is parameterized and could be reused for any bulk playlist modification task on YouTube.