// ==UserScript== // @name YouTube Queue Manager // @namespace https://github.com/Alpacinator/Youtube-Custom-Queue/ // @version 2.6.1 // @description A persistent, cross-tab YouTube queue manager with drag-to-reorder, auto-advance, and optional auto theater mode. // @match *://*.youtube.com/* // @grant none // @run-at document-start // ==/UserScript== // Changelog moved to CHANGELOG.md (kept out of the script to reduce its // size). See that file for the full per-version history. /** * ───────────────────────────────────────────────────────────────────────────── * * YouTube Queue Manager * * A persistent, cross-tab queue manager injected into YouTube via a userscript. * * Architecture overview: * ───────────────────────────────────────────────────────────────────────────── * Storage Persists queue, history, and pause state to localStorage. * An in-memory cache is invalidated whenever another tab writes. * * PlayingTab Claims "ownership" of playback via a heartbeat in localStorage * so that other tabs know not to also start playing. * * Navigator Single navigation entry point. Hijacks an SPA-wired anchor * (a.yt-simple-endpoint, preferring the mini-guide "Home" * entry), points it at the target via both href rewriting * and a yt-navigate endpoint mutation, then fakes a click. * Used by every navigation site in the script. * * Player Owns the end-to-end playback lifecycle: attaches to the *