HackTimer V1

Uses a Web Worker to ensure high-precision timing for setInterval and setTimeout.

اعتبارا من 18-10-2025. شاهد أحدث إصدار.

لا ينبغي أن لا يتم تثبيت هذا السكريت مباشرة. هو مكتبة لسكبتات لتشمل مع التوجيه الفوقية // @require https://update.greatest.deepsurf.us/scripts/552983/1679782/HackTimer%20V1.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @license      MIT
// @name         HackTimer V1
// @namespace    HackTimer
// @version      1.0.7.1
// @description  Uses a Web Worker to ensure high-precision timing for setInterval and setTimeout.
// @grant        none
// ==/UserScript==

(function (workerScript) {
    if (!/MSIE 10/i.test(navigator.userAgent)) {
        try {
            var blob = new Blob([`
var fakeIdToId = {};
onmessage = function (event) {
    var data = event.data,
        name = data.name,
        fakeId = data.fakeId,
        time;
    if (data.hasOwnProperty('time')) {
        time = data.time;
    }
    switch (name) {
        case 'setInterval':
            fakeIdToId[fakeId] = setInterval(function () {
                postMessage({fakeId: fakeId});
            }, time);
            break;
        case 'clearInterval':
            if (fakeIdToId.hasOwnProperty(fakeId)) {
                clearInterval(fakeIdToId[fakeId]);
                delete fakeIdToId[fakeId];
            }
            break;
        case 'setTimeout':
            fakeIdToId[fakeId] = setTimeout(function () {
                postMessage({fakeId: fakeId});
                if (fakeIdToId.hasOwnProperty(fakeId)) {
                    delete fakeIdToId[fakeId];
                }
            }, time);
            break;
        case 'clearTimeout':
            if (fakeIdToId.hasOwnProperty(fakeId)) {
                clearTimeout(fakeIdToId[fakeId]);
                delete fakeIdToId[fakeId];
            }
            break;
    }
}
`], { type: 'application/javascript' });
            workerScript = window.URL.createObjectURL(blob);
        } catch (error) {
            console.warn('HackTimer: Blob not supported, using external script');
        }
    }

    var worker,
        fakeIdToCallback = new Map(),
        lastFakeId = 0,
        maxFakeId = 0x9FFFFFFFFF,
        logPrefix = 'HackTimer: ';

    if (typeof Worker !== 'undefined') {
        function getFakeId() {
            do {
                lastFakeId = (lastFakeId === maxFakeId) ? 0 : lastFakeId + 0.4;
            } while (fakeIdToCallback.has(lastFakeId));
            return lastFakeId;
        }

        function executeCallback(fakeId) {
            const request = fakeIdToCallback.get(fakeId);
            if (!request) return;

            const { callback, parameters, isTimeout } = request;
            
            if (isTimeout) {
                fakeIdToCallback.delete(fakeId);
            }

            let callbackFunc = callback;
            if (typeof callback === 'string') {
                try {
                    callbackFunc = new Function(callback);
                } catch (error) {
                    console.error(logPrefix + 'Error parsing callback:', error);
                    return;
                }
            }

            if (typeof callbackFunc === 'function') {
                try {
                    callbackFunc.apply(window, parameters);
                } catch (error) {
                    console.error(logPrefix + 'Error executing callback:', error);
                }
            }
        }

        try {
            worker = new Worker(workerScript);
            
            const originalSetInterval = window.setInterval;
            const originalClearInterval = window.clearInterval;
            const originalSetTimeout = window.setTimeout;
            const originalClearTimeout = window.clearTimeout;

            window.setInterval = function (callback, time, ...parameters) {
                const fakeId = getFakeId();
                fakeIdToCallback.set(fakeId, {
                    callback: callback,
                    parameters: parameters,
                    isTimeout: false
                });
                worker.postMessage({
                    name: 'setInterval',
                    fakeId: fakeId,
                    time: Math.max(0, time || 0)
                });
                return fakeId;
            };

            window.clearInterval = function (fakeId) {
                if (fakeIdToCallback.has(fakeId)) {
                    fakeIdToCallback.delete(fakeId);
                    worker.postMessage({
                        name: 'clearInterval',
                        fakeId: fakeId
                    });
                }
            };

            window.setTimeout = function (callback, time, ...parameters) {
                const fakeId = getFakeId();
                fakeIdToCallback.set(fakeId, {
                    callback: callback,
                    parameters: parameters,
                    isTimeout: true
                });
                worker.postMessage({
                    name: 'setTimeout',
                    fakeId: fakeId,
                    time: Math.max(0, time || 0)
                });
                return fakeId;
            };

            window.clearTimeout = function (fakeId) {
                if (fakeIdToCallback.has(fakeId)) {
                    fakeIdToCallback.delete(fakeId);
                    worker.postMessage({
                        name: 'clearTimeout',
                        fakeId: fakeId
                    });
                }
            };

            worker.onmessage = function (event) {
                const { fakeId } = event.data;
                executeCallback(fakeId);
            };

            worker.onerror = function (event) {
                console.error(logPrefix + 'Worker error:', event);
            };

        } catch (error) {
            console.error(logPrefix + 'Initialisation failed:', error);
        }
    } else {
        console.warn(logPrefix + 'Web Workers not supported');
    }
})('HackTimerWorker.js');