// ==UserScript== // @name 计时器掌控者 | 视频广告加速器 // @namespace http://tampermonkey.net/ // @version 1.0.1 // @description 无需外部依赖,直接加速计时器、跳过广告、视频倍速 // @author // @match *://*/* // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function() { 'use strict'; if (window.TimerHookerRunning) return; window.TimerHookerRunning = true; console.log("[TimerHooker] 无依赖版启动中..."); let speed = 1.0; let lastRealTime = Date.now(); let lastHookTime = Date.now(); // ========================================= // 劫持 setTimeout // ========================================= const originalSetTimeout = window.setTimeout; window.setTimeout = function(cb, delay) { const realDelay = delay / speed; return originalSetTimeout(cb, realDelay); }; // ========================================= // 劫持 setInterval // ========================================= const originalSetInterval = window.setInterval; window.setInterval = function(cb, delay) { const realDelay = delay / speed; return originalSetInterval(cb, realDelay); }; // ========================================= // 劫持 Date.now() // ========================================= const originalDateNow = Date.now; Date.now = function() { const now = originalDateNow(); const delta = now - lastRealTime; lastRealTime = now; lastHookTime += delta * speed; return lastHookTime; }; // ========================================= // UI 界面 // ========================================= function createUI() { const style = document.createElement('style'); style.textContent = ` .th-ui{position:fixed;left:-36px;top:22%;z-index:999999;transition:all 0.3s} .th-ui:hover{left:8px} .th-btn{width:38px;height:38px;background:#5eead4;border-radius:50%;margin:5px 0; text-align:center;line-height:38px;cursor:pointer;opacity:0.7;color:#000;font-weight:bold} .th-btn:hover{opacity:1} .th-speed{position:fixed;inset:0;display:flex;align-items:center;justify-content:center; font-size:48px;background:rgba(0,0,0,0.04);z-index:99999} .th-hide{display:none!important} `; document.head.appendChild(style); const ui = document.createElement('div'); ui.innerHTML = `