Greasy Fork is available in English.

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.

  1. // ==UserScript==
  2. // @name TestGorilla Mouse Exit Bypass
  3. // @namespace https://greatest.deepsurf.us/en/users/1461725-scriptninja
  4. // @version 1.0.1
  5. // @description Spoofs mouse behavior on TestGorilla to prevent detection of mouse movements outside the window. Clamps cursor position and blocks mouseleave/mouseout event listeners.
  6. // @author ScriptNinja
  7. // @license MIT
  8. // @match https://*.testgorilla.com/*
  9. // @icon https://www.google.com/s2/favicons?domain=testgorilla.com
  10. // @grant none
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. // Define the boundaries of the "assessment window"
  19. const FAKE_WINDOW = {
  20. xMin: 0, // Left edge
  21. xMax: window.innerWidth, // Right edge
  22. yMin: 0, // Top edge
  23. yMax: window.innerHeight // Bottom edge
  24. };
  25.  
  26. // Override MouseEvent properties (clientX, clientY)
  27. const originalMouseEvent = MouseEvent.prototype;
  28. const originalClientX = Object.getOwnPropertyDescriptor(MouseEvent.prototype, 'clientX');
  29. const originalClientY = Object.getOwnPropertyDescriptor(MouseEvent.prototype, 'clientY');
  30.  
  31. Object.defineProperty(MouseEvent.prototype, 'clientX', {
  32. get: function() {
  33. let x = originalClientX.get.call(this);
  34. // Clamp X to fake window boundaries
  35. return Math.max(FAKE_WINDOW.xMin, Math.min(x, FAKE_WINDOW.xMax));
  36. },
  37. configurable: true
  38. });
  39.  
  40. Object.defineProperty(MouseEvent.prototype, 'clientY', {
  41. get: function() {
  42. let y = originalClientY.get.call(this);
  43. // Clamp Y to fake window boundaries
  44. return Math.max(FAKE_WINDOW.yMin, Math.min(y, FAKE_WINDOW.yMax));
  45. },
  46. configurable: true
  47. });
  48.  
  49. // Block mouseleave events
  50. const originalAddEventListener = EventTarget.prototype.addEventListener;
  51. EventTarget.prototype.addEventListener = function(type, listener, options) {
  52. if (type === 'mouseleave' || type === 'mouseout') {
  53. console.log("Blocked mouseleave/mouseout listener");
  54. return; // Skip adding the listener
  55. }
  56. originalAddEventListener.call(this, type, listener, options);
  57. };
  58.  
  59. console.log("Mouse spoofing active");
  60. })();