// ==UserScript== // @name YouTube Enhanced (Controls & Downloader) // @namespace https://github.com/sizwinz/YtOP // @version 3.2.0 // @description Adds a real yt-dlp download button and video player controls (speed, loop, cinema mode, screenshot) to YouTube. // @author sizwinz // @match https://www.youtube.com/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @connect 127.0.0.1 // @connect localhost // @run-at document-idle // @homepageURL https://github.com/sizwinz/YtOP // @supportURL https://github.com/sizwinz/YtOP/issues // @icon https://raw.githubusercontent.com/sizwinz/YtOP/master/ytOP.png // @updateURL https://raw.githubusercontent.com/sizwinz/YtOP/master/YouTube%20Enhanced%20Suite.user.js // @downloadURL https://raw.githubusercontent.com/sizwinz/YtOP/master/YouTube%20Enhanced%20Suite.user.js // @noframes // ==/UserScript== (function () { "use strict"; /* ═══════════════════════════════════════════════════════════════ * CONFIG & CONSTANTS * ═══════════════════════════════════════════════════════════════ */ const SERVER = "http://127.0.0.1:9898"; const BTN_ID = "ytdlp-dl-btn"; const OVL_ID = "ytdlp-overlay"; const CFG = { presetSpeeds: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3], fineStep: 0.25, minSpeed: 0.1, maxSpeed: 16, osdDuration: 1500, keySpeed: 'yt-spd-ctrl', wrapperId: 'yt-spd-wrap', featureRowId: 'yt-feat-wrap', osdId: 'yt-spd-osd', cinemaOverlayId: 'yt-cinema-overlay', }; /* ═══════════════════════════════════════════════════════════════ * STATE * ═══════════════════════════════════════════════════════════════ */ let osdTimeout = null; const presetBtnMap = new Map(); // speed value →