Night Mode [MooMoo.IO]

Night mode for MooMoo.IO.

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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        Night Mode [MooMoo.IO]
// @description Night mode for MooMoo.IO.
// @version     1.0
// @author      @ihymidnight
// @namespace   https://greasyfork.org/en/users/1110675-ihymidnight
// @match       *://*.moomoo.io/*
// @grant       none
// ==/UserScript==

const originalDrawImage = CanvasRenderingContext2D.prototype.drawImage;

CanvasRenderingContext2D.prototype.drawImage = function () {
  // Set the brightness of the game UI.
  const shadowVal = 60;
  const gameUI = document.querySelector("#gameCanvas");
  gameUI.style.filter = `brightness(${shadowVal}%)`;

  // Get the width and height of the image being drawn.
  const imageWidth = arguments[3] || arguments[0].width;
  const imageHeight = arguments[4] || arguments[0].height;

  // Calculate the center of the image.
  const centerX = arguments[1] + imageWidth / 2;
  const centerY = arguments[2] + imageHeight / 2;

  // Save the current state of the canvas.
  this.save();

  // Set the shadow color and blur radius.
  this.shadowColor = "rgba(204, 0, 95, 0.5)";
  this.shadowBlur = 10;

  // Draw the image with the shadow.
  originalDrawImage.apply(this, arguments);

  // Restore the canvas to its previous state.
  this.restore();

  // Reset the shadow color and blur radius.
  this.shadowColor = "transparent";
  this.shadowBlur = 0;
};