Sigmally Macros

Macro for sigmally

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

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 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         Sigmally Macros
// @version      1
// @description  Macro for sigmally
// @author       Cursed
// @match        *://sigmally.com/*
// @match        *://beta.sigmally.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=sigmally.com
// @run-at       document-end
// @license      MIT
// @namespace https://greasyfork.org/users/1219775
// ==/UserScript==

(function() {
    'use strict';
    let ff = null;
    let keydown = false;

    function keypress(key, keycode) {
        const keyDownEvent = new KeyboardEvent("keydown", { key: key, code: keycode });
        const keyUpEvent = new KeyboardEvent("keyup", { key: key, code: keycode });

        window.dispatchEvent(keyDownEvent);
        window.dispatchEvent(keyUpEvent);
    }
    function feed() {
        let x = 15;
        while (x--) {
            keypress("w", "KeyW");
        }
    }

    document.addEventListener("keyup", (e) => {
        const key = e.key.toLowerCase();
        if (key == "w" && keydown) {
            clearInterval(ff);
            keydown = false;
        }
    });

    document.addEventListener("keydown", (e) => {
        const key = e.key.toLowerCase();

        if (key == "w" && !keydown) {
            keydown = true;
            ff = setInterval(feed, 50);
        }
    });
})();