Timer Accelerator (Testing & Debugging Tool)

Speeds up client-side timers for development, testing, and educational purposes.

Stan na 31-03-2026. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Timer Accelerator (Testing & Debugging Tool)
// @namespace    https://github.com/hgcfkuyfliyfl/
// @version      2.1
// @description  Speeds up client-side timers for development, testing, and educational purposes.
// @author       Wisdom Ng'oma
// @license      MIT
// @match        *://*/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const SPEED_FACTOR = 100;
    let startTime = Date.now();
    let performanceStart = performance.now();

    // Override Date.now
    const originalDateNow = Date.now;
    Date.now = function() {
        return startTime + (originalDateNow() - startTime) * SPEED_FACTOR;
    };

    // Override performance.now
    const originalPerformanceNow = performance.now;
    performance.now = function() {
        return performanceStart + (originalPerformanceNow() - performanceStart) * SPEED_FACTOR;
    };

    // Override timers
    const originalSetTimeout = window.setTimeout;
    const originalSetInterval = window.setInterval;

    window.setTimeout = function(callback, delay, ...args) {
        return originalSetTimeout(callback, Math.max(1, delay / SPEED_FACTOR), ...args);
    };

    window.setInterval = function(callback, delay, ...args) {
        return originalSetInterval(callback, Math.max(1, delay / SPEED_FACTOR), ...args);
    };

    console.log(`Time Accelerator Active: ${SPEED_FACTOR}x`);
})();