AF

Auto faucet claim after IconCaptcha waits 5 minutes, then refreshes

// ==UserScript==
// @name         AF
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Auto faucet claim after IconCaptcha waits 5 minutes, then refreshes
// @author       👽
// @match        https://autofaucet.org/earn/faucet
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to simulate clicking the claim button
    function clickClaimButton() {
        const claimButton = document.querySelector('#submitButton.claim-button.mt-3.mb-3.rounded-pill');

        if (claimButton) {
            console.log("Button found:", claimButton);
            console.log("Button display:", window.getComputedStyle(claimButton).display);
            console.log("Button disabled state:", claimButton.disabled);
            console.log("Button visibility - Width:", claimButton.offsetWidth, "Height:", claimButton.offsetHeight);

            if (!claimButton.disabled && claimButton.offsetWidth > 0 && claimButton.offsetHeight > 0) {
                console.log("Button is visible and clickable. Attempting to trigger click...");

                claimButton.focus();

                const clickEvent = new MouseEvent('click', {
                    bubbles: true,
                    cancelable: true,
                    view: window
                });

                claimButton.dispatchEvent(clickEvent);
                console.log("✅ Click dispatched.");
            } else {
                console.log("❌ Button is either disabled or not interactable.");
            }
        } else {
            console.log("❌ Claim button not found.");
        }
    }

    // Main function to observe captcha verification and handle claim + refresh
    function observeForVerification() {
        const observer = new MutationObserver((mutations, obs) => {
            const verificationMessage = document.querySelector('.iconcaptcha-modal__body-title');
            if (verificationMessage && verificationMessage.textContent.includes('Verification complete')) {
                console.log('✅ IconCaptcha solved: Verification complete.');

                obs.disconnect();

                setTimeout(() => {
                    clickClaimButton();

                    // Wait 5 minutes before refreshing the page
                    console.log('⏳ Waiting 5 minutes before refreshing the page...');
                    setTimeout(() => {
                        console.log('🔁 Refreshing the page...');
                        location.reload();
                    }, 5 * 60 * 1000); // 5 minutes = 300000 ms

                }, 7000); // wait 7 seconds before clicking claim
            }
        });

        observer.observe(document.body, { childList: true, subtree: true });
    }

    // Start the script after page load
    window.addEventListener('load', () => {
        console.log("🚀 Page loaded. Starting automation...");
        observeForVerification();
    });
})();