Space AutoFire

Turn spacebar into AutoFire toggle (E)

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Space AutoFire
// @namespace    https://greatest.deepsurf.us/en/users/467236-diepiodiscord
// @version      1
// @description  Turn spacebar into AutoFire toggle (E)
// @author       diep.io#7444
// @match        https://diep.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var keyDown = document.createEvent("Events"); keyDown.initEvent("keydown", true, true); keyDown.keyCode = 69; // 69 is the keyCode for E
    var keyUp = document.createEvent("Events"); keyUp.initEvent("keyup", true, true); keyUp.keyCode = 69;

    document.addEventListener('keydown', function(event)
    {
        if (event.keyCode === 32) // spacebar
        {
            event.cancelBubble = true; // Prevent spacebar from firing when held down, we are changing it to a toggle
            if (event.repeat) return; // Disable holding down key to spam
            window.dispatchEvent(keyDown);
            window.dispatchEvent(keyUp);
        }
    });
})();