Mouse Click Buttons for sploop.io

Adds left and right mouse click buttons to the top left corner of the sploop.io webpage.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Mouse Click Buttons for sploop.io
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds left and right mouse click buttons to the top left corner of the sploop.io webpage.
// @author       hayden422
// @match        https://sploop.io/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create a container div
    const container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.top = '0';
    container.style.left = '0';
    container.style.padding = '10px';
    document.body.appendChild(container);

    // Create left mouse click button
    const leftClickButton = document.createElement('button');
    leftClickButton.textContent = 'LMB';
    leftClickButton.style.padding = '10px 25px';
    leftClickButton.style.backgroundColor = '#007bff';
    leftClickButton.style.color = '#fff';
    leftClickButton.style.border = 'none';
    leftClickButton.style.cursor = 'pointer';
    container.appendChild(leftClickButton);

    // Create right mouse click button
    const rightClickButton = document.createElement('button');
    rightClickButton.textContent = 'RMB';
    rightClickButton.style.padding = '10px 25px';
    rightClickButton.style.backgroundColor = '#dc3545';
    rightClickButton.style.color = '#fff';
    rightClickButton.style.border = 'none';
    rightClickButton.style.cursor = 'pointer';
    container.appendChild(rightClickButton);

    // Function to toggle button color
    function toggleButtonColor(button) {
        const originalColor = button.dataset.originalColor || '';
        const currentColor = button.style.backgroundColor || '';

        if (originalColor && currentColor) {
            button.style.backgroundColor = currentColor === originalColor ? '#f0f0f0' : originalColor;
        } else {
            button.dataset.originalColor = currentColor;
            button.style.backgroundColor = '#f0f0f0';
        }
    }

    // Add mousedown event listeners to toggle button colors
    document.addEventListener('mousedown', (event) => {
        if (event.button === 0) { // Left mouse button (LMB)
            toggleButtonColor(leftClickButton);
        } else if (event.button === 2) { // Right mouse button (RMB)
            toggleButtonColor(rightClickButton);
        }
    });

    // Add mouseup event listeners to reset button colors
    document.addEventListener('mouseup', () => {
        leftClickButton.style.backgroundColor = '#007bff';
        rightClickButton.style.backgroundColor = '#dc3545';
    });
})();