Auto Reload Claimer + Full Panel

Stake reload auto claimer (never stuck: guaranteed claim detection + error retry + full panel with reset + last claim date & time)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Auto Reload Claimer + Full Panel
// @version      3.4
// @description  Stake reload auto claimer (never stuck: guaranteed claim detection + error retry + full panel with reset + last claim date & time)
// @author       natah3
// @match        https://stake.com/*
// @match        https://stake.games/*
// @match        https://stake.bet/*
// @match        https://stake.link/*
// @match        https://stake1069.com/*
// @run-at       document-idle
// @namespace    https://greasyfork.org/users/1514052
// ==/UserScript==

(function() {
    'use strict';

    const TARGET_URL = 'https://' + window.location.hostname + '/?tab=rewards&modal=claimReload';
    const CLAIM_WAIT_TIME = 610; // 10 min + 10s buffer
    const ERROR_RETRY_WAIT_TIME = 10 * 1000; // 10 seconds
    const BUTTON_RETRY_INTERVAL = 5000; // retry every 5 seconds

    let claimCounter = parseInt(localStorage.getItem("claimCounter") || "0", 10);
    let lastClaimTime = localStorage.getItem("lastClaimTime") || "None";
    let countdownInterval;
    let buttonRetryInterval;

    // Format date as DD/MM/YYYY HH:mm:ss
    function formatDate(d) {
        const day = String(d.getDate()).padStart(2, "0");
        const month = String(d.getMonth() + 1).padStart(2, "0");
        const year = d.getFullYear();
        const hours = String(d.getHours()).padStart(2, "0");
        const minutes = String(d.getMinutes()).padStart(2, "0");
        const seconds = String(d.getSeconds()).padStart(2, "0");
        return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
    }

    // Create panel
    function createPanel() {
        const panel = document.createElement("div");
        panel.id = "auto-reload-claimer-panel";
        panel.style.position = "fixed";
        panel.style.bottom = "20px";
        panel.style.right = "20px";
        panel.style.backgroundColor = "rgba(0,0,0,0.75)";
        panel.style.color = "#fff";
        panel.style.padding = "12px 15px";
        panel.style.borderRadius = "10px";
        panel.style.zIndex = "9999";
        panel.style.fontSize = "14px";
        panel.style.fontFamily = "monospace";
        panel.innerHTML = `
            <div style="margin-bottom:6px"><b>Auto Reload Claimer</b></div>
            <div>Claims: <span id="arc-counter">${claimCounter}</span></div>
            <div>Last Claim: <span id="arc-last">${lastClaimTime}</span></div>
            <div>Next Reload in: <span id="arc-timer">--:--</span></div>
            <button id="arc-reset" style="margin-top:8px;padding:2px 6px;font-size:12px;background:#c33;color:#fff;border:none;border-radius:4px;cursor:pointer;">Reset</button>
        `;
        document.body.appendChild(panel);
        document.getElementById("arc-reset").addEventListener("click", resetStats);
    }

    // Update panel values
    function updatePanel() {
        document.getElementById("arc-counter").textContent = claimCounter;
        document.getElementById("arc-last").textContent = lastClaimTime;
    }

    // Start countdown
    function startCountdown() {
        let timeLeft = CLAIM_WAIT_TIME;
        const timerDisplay = document.getElementById("arc-timer");

        clearInterval(countdownInterval);
        countdownInterval = setInterval(() => {
            const minutes = Math.floor(timeLeft / 60);
            const seconds = timeLeft % 60;
            timerDisplay.textContent = `${String(minutes).padStart(2,"0")}:${String(seconds).padStart(2,"0")}`;

            if (timeLeft <= 0) {
                clearInterval(countdownInterval);
                reloadPage();
            }
            timeLeft--;
        }, 1000);
    }

    // Init
    function init() {
        createPanel();
        if (window.location.href !== TARGET_URL) {
            window.location.href = TARGET_URL;
        } else {
            tryClaim();
        }
    }

    // Retry until claim button clicked
    function tryClaim() {
        clearInterval(buttonRetryInterval);
        buttonRetryInterval = setInterval(() => {
            const claimButton = document.querySelector('button[data-testid="claim-reload"]');
            const errorModal = Array.from(document.querySelectorAll("h2"))
                .find(el => el.textContent.includes("Reload Unavailable"));

            if (claimButton) {
                claimButton.click();
                clearInterval(buttonRetryInterval);
                onClaimSuccess();
            }
            else if (errorModal) {
                clearInterval(buttonRetryInterval);
                setTimeout(reloadPage, ERROR_RETRY_WAIT_TIME);
            }
            // else → keep retrying
        }, BUTTON_RETRY_INTERVAL);
    }

    // After successful claim
    function onClaimSuccess() {
        claimCounter++;
        lastClaimTime = formatDate(new Date());
        localStorage.setItem("claimCounter", claimCounter);
        localStorage.setItem("lastClaimTime", lastClaimTime);
        updatePanel();
        startCountdown();
    }

    // Reload page
    function reloadPage() {
        window.location.reload();
    }

    // Reset stats
    function resetStats() {
        claimCounter = 0;
        lastClaimTime = "None";
        localStorage.setItem("claimCounter", claimCounter);
        localStorage.setItem("lastClaimTime", lastClaimTime);
        updatePanel();
    }

    window.addEventListener("load", init);
})();