Gota.io Macros By ReF and split

some macros for gota and spolit 16

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Gota.io Macros By ReF and split
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  some macros for gota and spolit 16
// @author       ReF
// @match        http://gota.io/web/*
// @grant        none
// ==/UserScript==
 
(function() {
    'use strict';
 
    var timeoutId;
    var isHeld = false;
   
function splitST() {
 $(document).trigger({type: 'keydown', which: 69, keyCode: 69});
    $(document).trigger({type: 'keydown', which: 69, keyCode: 69});
    $(document).trigger({type: 'keydown', which: 69, keyCode: 69});
    $(document).trigger({type: 'keydown', which: 69, keyCode: 69});
}
 
    function macroFeed() {
        if (isHeld) {
        $(document).trigger({type: 'keydown', which: 69, keyCode: 69});
            console.log("mousehold");
        } else $(document).trigger({type: 'keyup', which: 69, keyCode: 69});
    }
   
     document.addEventListener('keydown', function(event) {
            if (event.keyCode == 16) {
                console.log("shift");
splitST();
            }
    }, false);
   
$('canvas').on('mousedown mouseup', function mouseState(e) {
    if (e.type == "mousedown") {
        isHeld = true;
    } else isHeld = false;
});
    setInterval(macroFeed,10);
})();

(function() {
    var amount = 6;
    var duration = 50; //ms

    var overwriting = function(evt) {
        if (evt.keyCode === 82) { // KEY_Z
            for (var i = 0; i < amount; ++i) {
                setTimeout(function() {
                    window.onkeydown({keyCode: 32}); // KEY_SPACE
                    window.onkeyup({keyCode: 32});
                }, i * duration);
            }
        }
    };

    window.addEventListener('keydown', overwriting);
})();