Moomoo.io Game grid removal

Removes the game grid

  1. // ==UserScript==
  2. // @name Moomoo.io Game grid removal
  3. // @author Murka
  4. // @description Removes the game grid
  5. // @icon https://moomoo.io/img/favicon.png?v=1
  6. // @version 0.3
  7. // @match *://moomoo.io/*
  8. // @match *://*.moomoo.io/*
  9. // @run-at document-start
  10. // @grant none
  11. // @license MIT
  12. // @namespace https://greasyfork.org/users/919633
  13. // ==/UserScript==
  14. /* jshint esversion:6 */
  15.  
  16. /*
  17. Author: Murka
  18. Github: https://github.com/Murka007
  19. Discord: https://discord.gg/sG9cyfGPj5
  20. Greasyfork: https://greasyfork.org/en/users/919633
  21. MooMooForge: https://github.com/MooMooForge
  22. */
  23.  
  24. (function() {
  25. "use strict";
  26.  
  27. // Change to true or false
  28. const GRID_ENABLED = false;
  29. function inRange(value, min, max) {
  30. return value > min && value < max;
  31. }
  32.  
  33. function createHook(target, prop, callback) {
  34. const symbol = Symbol(prop);
  35. Object.defineProperty(target, prop, {
  36. get() { return this[symbol]; },
  37. set(value) { callback(this, symbol, value); },
  38. configurable: true
  39. })
  40. }
  41.  
  42. createHook(window, "config", function(that, symbol, value) {
  43. if (typeof value === "object" && value.hasOwnProperty("maxScreenHeight")) {
  44. delete window.config;
  45. Object.defineProperty(window, "config", {
  46. value: value,
  47. configurable: false,
  48. writeable: false
  49. })
  50. }
  51. })
  52.  
  53. CanvasRenderingContext2D.prototype.moveTo = new Proxy(CanvasRenderingContext2D.prototype.moveTo, {
  54. apply(target, _this, args) {
  55.  
  56. if (!GRID_ENABLED) {
  57. const [ x, y ] = args;
  58. const { maxScreenWidth, maxScreenHeight } = window.config || {};;
  59. if (inRange(x, 0, maxScreenWidth) || inRange(y, 0, maxScreenHeight)) return null;
  60. }
  61.  
  62. return target.apply(_this, args);
  63. }
  64. })
  65.  
  66. })();