Stake.bet Auto Claim Reload (Back Button, Timer, Sound)

Automatically claims the "Claim Reload" button every 10 minutes and 20 seconds, closes the popup, and navigates back to repeat. Refreshes every 3 successful claims.

Versão de: 12/03/2025. Veja: a última versão.

// ==UserScript==
// @name         Stake.bet Auto Claim Reload (Back Button, Timer, Sound)
// @namespace    http://tampermonkey.net/
// @version      3.6
// @description  Automatically claims the "Claim Reload" button every 10 minutes and 20 seconds, closes the popup, and navigates back to repeat. Refreshes every 3 successful claims.
// @author       jayfantz
// @match        https://stake.bet/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let claimCount = 0; // Track successful claims

    // Function to create the countdown timer
    function createTimer() {
        const timer = document.createElement('div');
        Object.assign(timer.style, {
            position: 'fixed', top: '1.5cm', left: '0', backgroundColor: 'black',
            color: 'white', padding: '10px', fontFamily: 'monospace',
            fontSize: '20px', zIndex: '10000', borderRadius: '5px'
        });
        timer.id = 'countdown-timer';
        timer.textContent = '10:20';
        document.body.appendChild(timer);
        return timer;
    }

    // Function to update the countdown timer
    function updateTimer(timer, timeInSeconds) {
        const minutes = Math.floor(timeInSeconds / 60);
        const seconds = timeInSeconds % 60;
        timer.textContent = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
        timer.style.backgroundColor = timeInSeconds <= 5 ? (timer.style.backgroundColor === 'black' ? 'red' : 'black') : 'black';
    }

    // Function to play a sound
    function playSound() {
        const sound = new Audio('https://assets.mixkit.co/active_storage/sfx/1121/1121-preview.mp3');
        sound.volume = 0.5;
        sound.play();
    }

    // Function to click a button
    function forceClick(element) {
        if (!element) return;
        element.scrollIntoView({ behavior: 'smooth', block: 'center' });
        ['mouseover', 'mousedown', 'mouseup', 'click'].forEach(eventType => {
            element.dispatchEvent(new MouseEvent(eventType, { bubbles: true, cancelable: true, view: window }));
        });
    }

    // Function to find and click the "Claim Reload" button
    function clickClaimReload() {
        let buttons = Array.from(document.querySelectorAll('button'));
        let reloadButton = buttons.find(button => button.innerText.trim().toLowerCase().includes('claim reload'));

        if (reloadButton) {
            console.log('Claim Reload button found! Clicking...');
            forceClick(reloadButton);
            playSound();
            claimCount++;
            setTimeout(closePopup, 30000); // Wait 30 seconds, then close popup
        } else {
            console.log('Claim Reload button not found!');
        }
    }

    // Function to close the popup
    function closePopup() {
        let closeButton = document.querySelector('[data-testid="modal-close-button"]');
        if (closeButton) {
            console.log('Closing the popup...');
            forceClick(closeButton);
        } else {
            console.log('No close button found, attempting Esc key press.');
            document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
        }
        setTimeout(navigateBack, 620000); // Wait 10m 20s, then navigate back
    }

    // Function to navigate back
    function navigateBack() {
        if (claimCount >= 3) {
            console.log('3 successful claims reached. Refreshing in 30 seconds...');
            setTimeout(() => {
                location.reload();
            }, 30000);
            claimCount = 0;
        } else {
            console.log('Navigating back to claim page...');
            history.back(); // Mimic back button click
            setTimeout(clickClaimReload, 5000); // Wait 5s, then attempt to claim
        }
    }

    // Create the timer
    const timer = createTimer();
    let countdownTime = 620; // 10 minutes and 20 seconds

    // Update the timer every second
    const timerInterval = setInterval(() => {
        countdownTime -= 1;
        updateTimer(timer, countdownTime);

        if (countdownTime <= 0) {
            clearInterval(timerInterval);
            countdownTime = 620; // Reset the countdown time
            updateTimer(timer, countdownTime);
            clickClaimReload();
        }
    }, 1000);
})();

长期地址
遇到问题?请前往 GitHub 提 Issues。