Mousehunt one click send gifts and raffles to everyone in Friends page

No more sending gifts and raffles one by one! Only works in friends page

Ajankohdalta 20.3.2023. Katso uusin versio.

// ==UserScript==
// @name         Mousehunt one click send gifts and raffles to everyone in Friends page
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  No more sending gifts and raffles one by one! Only works in friends page
// @author       kaninchen
// @match        https://www.mousehuntgame.com/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/mousehunt-utils.js
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mousehuntgame.com
// @grant        none
// ==/UserScript==

(function() {
    function sendGiftRaffle(){
        for (let i = 0; i < 19; i++) {
            const delayTime = Math.floor(Math.random() * (300 - 100 + 1) + 100);

            setTimeout(function() {
                document.getElementsByClassName("userInteractionButtonsView-button sendTicket mousehuntTooltipParent  ")[i].onclick();

                const delayTime2 = Math.floor(Math.random() * (300 - 100 + 1) + 100);
                setTimeout(function() {
                    document.getElementsByClassName("userInteractionButtonsView-button sendGift mousehuntTooltipParent  ")[i].onclick();
                }, delayTime2);
            }, delayTime * i);
        }
    }

    onPageChange({
        friends: {
            show: () => {   let btn = document.createElement("BUTTON");
                         let div = document.getElementsByClassName("friendsPage-list-header")[0];
                         btn.innerHTML = "Send Gifts and Raffles to all";
                         div.appendChild(btn);

                         btn.onclick = () => {
                             sendGiftRaffle()
                         };
                        }
        },
    });

    sendGiftRaffle();
})();