TestGorilla Mouse Exit Bypass

Spoofs mouse behavior on TestGorilla to prevent detection of mouse movements outside the window. Clamps cursor position and blocks mouseleave/mouseout event listeners.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         TestGorilla Mouse Exit Bypass
// @namespace    https://greasyfork.org/en/users/1461725-scriptninja
// @version      1.0.1
// @description  Spoofs mouse behavior on TestGorilla to prevent detection of mouse movements outside the window. Clamps cursor position and blocks mouseleave/mouseout event listeners.
// @author       ScriptNinja
// @license      MIT
// @match        https://*.testgorilla.com/*
// @icon         https://www.google.com/s2/favicons?domain=testgorilla.com
// @grant        none
// @run-at       document-start
// ==/UserScript==


(function() {
    'use strict';

    // Define the boundaries of the "assessment window"
    const FAKE_WINDOW = {
        xMin: 0,          // Left edge
        xMax: window.innerWidth,  // Right edge
        yMin: 0,          // Top edge
        yMax: window.innerHeight // Bottom edge
    };

    // Override MouseEvent properties (clientX, clientY)
    const originalMouseEvent = MouseEvent.prototype;
    const originalClientX = Object.getOwnPropertyDescriptor(MouseEvent.prototype, 'clientX');
    const originalClientY = Object.getOwnPropertyDescriptor(MouseEvent.prototype, 'clientY');

    Object.defineProperty(MouseEvent.prototype, 'clientX', {
        get: function() {
            let x = originalClientX.get.call(this);
            // Clamp X to fake window boundaries
            return Math.max(FAKE_WINDOW.xMin, Math.min(x, FAKE_WINDOW.xMax));
        },
        configurable: true
    });

    Object.defineProperty(MouseEvent.prototype, 'clientY', {
        get: function() {
            let y = originalClientY.get.call(this);
            // Clamp Y to fake window boundaries
            return Math.max(FAKE_WINDOW.yMin, Math.min(y, FAKE_WINDOW.yMax));
        },
        configurable: true
    });

    // Block mouseleave events
    const originalAddEventListener = EventTarget.prototype.addEventListener;
    EventTarget.prototype.addEventListener = function(type, listener, options) {
        if (type === 'mouseleave' || type === 'mouseout') {
            console.log("Blocked mouseleave/mouseout listener");
            return; // Skip adding the listener
        }
        originalAddEventListener.call(this, type, listener, options);
    };

    console.log("Mouse spoofing active");
})();