Mousehunt one click send gifts and raffles

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

安裝腳本?
作者推薦腳本

您可能也會喜歡 Mousehunt manually send gits and raffles

安裝腳本
// ==UserScript==
// @name         Mousehunt one click send gifts and raffles
// @namespace    http://tampermonkey.net/
// @version      0.3
// @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);
        }
    }

    function showButtons(){
        if (document.getElementsByClassName("friendsPage-list-header")[0].children.length < 3){
            var prevButton = document.createElement("BUTTON");
            var nextButton = document.createElement("BUTTON");
            let btn = document.createElement("BUTTON");
            let div = document.getElementsByClassName("friendsPage-list-header")[0];
            btn.innerHTML = "Send Gifts and Raffles to all";
            prevButton.innerHTML = "Previous";
            nextButton.innerHTML = "Next";

            div.appendChild(prevButton);
            div.appendChild(btn);
            div.appendChild(nextButton);

            prevButton.onclick = () => {
                app.pages.FriendsPage.tab_view_friends.pager.showPreviousPage(event);
            };
            btn.onclick = () => {
                sendGiftRaffle()
            };
            nextButton.onclick = () => {
                app.pages.FriendsPage.tab_view_friends.pager.showNextPage(event);
            };
        }
    }

    onPageChange({
        friends: {
            show: () => {   showButtons()
                        }
        },
    });

    showButtons();
})();