TPU

Auto CLAIM

// ==UserScript==
// @name         TPU
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  Auto CLAIM
// @author       👽
// @match        https://tronpayu.io/faucet.php
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const verificationSelector = 'div.iconcaptcha-modal__body-title';
    const claimButtonSelector = '#process_claim_hourly_faucet';
    const refreshIntervalMs = 60000; // 1 minute
    const maxRefreshCount = 60; // Refresh every 1 minute for 1 hour (60 minutes total)
    let refreshCount = 0;

    // 🔒 Step 1: Disable the CLAIM button until CAPTCHA is solved
    function disableClaimUntilCaptcha() {
        const claimBtn = document.querySelector(claimButtonSelector);
        if (claimBtn) {
            claimBtn.disabled = true;
            console.log('🚫 CLAIM button disabled until CAPTCHA is solved.');
        }
    }

    // ✅ Step 2: Wait for CAPTCHA to be marked complete, then click CLAIM
    function waitForCaptchaCompletion() {
        const interval = setInterval(() => {
            const verificationText = document.querySelector(verificationSelector);
            if (verificationText && verificationText.textContent.trim() === 'Verification complete.') {
                console.log('✅ CAPTCHA solved. Enabling CLAIM button...');
                clearInterval(interval);

                const claimBtn = document.querySelector(claimButtonSelector);
                if (claimBtn) {
                    claimBtn.disabled = false;

                    setTimeout(() => {
                        if (!claimBtn.disabled) {
                            console.log('🚀 Clicking CLAIM button...');
                            claimBtn.click();

                            // Step 3: Start 1-hour refresh countdown
                            startRefreshCountdown();
                        }
                    }, 2000); // Wait 2 seconds after CAPTCHA
                }
            }
        }, 1000); // Check every second
    }

    // ⏳ Step 3: Refresh the page after 1 hour
    function startRefreshCountdown() {
        console.log('⏰ Starting 1-hour countdown...');
        refreshCount = 0; // Reset refresh count after clicking CLAIM

        const countdownInterval = setInterval(() => {
            refreshCount++;
            console.log(`⏳ 1-minute countdown: (${refreshCount}/60)`);
            if (refreshCount >= maxRefreshCount) {
                clearInterval(countdownInterval);
                console.log('⏳ 1 hour done. Refreshing the page...');
                location.reload(); // Refresh the page after 1 hour
            }
        }, refreshIntervalMs); // Refreshes every minute
    }

    // ▶️ Start everything when page loads
    window.addEventListener('load', () => {
        console.log('🚦 Script loaded. Setting up...');
        disableClaimUntilCaptcha();
        waitForCaptchaCompletion();
    });
})();