Idle Detection Bypasser

Give a fake active response to the caller of the Idle Detection API

Verze ze dne 24. 09. 2021. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

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

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

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

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name                Idle Detection Bypasser
// @name:zh             绕过 Idle Detection
// @name:zh-CN          绕过 Idle Detection
// @namespace           https://github.com/flyhaozi
// @version             0.1.0
// @description         Give a fake active response to the caller of the Idle Detection API
// @description:zh      给 Idle Detection API 的调用者一个虚假的 active 响应
// @description:zh-CN   给 Idle Detection API 的调用者一个虚假的 active 响应
// @author              flyhaozi
// @match               https://*/*
// @match               http://*/*
// @grant               none
// ==/UserScript==

(function() {
    'use strict';
    if (!('IdleDetector' in window)) {
        return console.log('Idle Detector is not available.');
    }

    let callback = null;
    window.IdleDetector.prototype.addEventListener = function(type, listener, options) {
        callback = listener;

        console.log('Idle Detection Detected!');
    };
    window.IdleDetector.prototype.start = function() {
        Object.defineProperty(this, 'userState', { value: 'active', writable: false });
        Object.defineProperty(this, 'screenState', { value: 'unlocked', writable: false });
        callback && callback({ currentTarget: this, target: this });

        console.log('Idle Detection Bypassed!');
    };
})();