Q p c Auto Claim + OK + Go Claim

Auto click Claim when antibot solved

// ==UserScript==
// @name         Q p c Auto Claim + OK + Go Claim
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Auto click Claim when antibot solved
// @author       👽
// @match        https://qpcrypto.com/faucet/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    console.log("🟡 QPCrypto Auto Claim + OK + Go Claim Script started.");

    // 1. Check antibot status and click claim when ready
    const antibotChecker = setInterval(() => {
        const antibotInput = document.getElementById("antibotlinks");
        const claimBtn = document.getElementById("subbutt");

        if (antibotInput && claimBtn) {
            const value = antibotInput.value.trim();
            const parts = value.split(" ").filter(v => v.length > 0);

            if (parts.length >= 3) {
                console.log("✅ Antibot solved! Clicking claim button...");
                claimBtn.click();
                clearInterval(antibotChecker); // Stop checking
            } else {
                console.log("⏳ Antibot not solved yet. Waiting...");
            }
        }
    }, 1000);

    // 2. Watch for SweetAlert "OK" buttons and click them after 5 seconds
    const observer = new MutationObserver(() => {
        // SweetAlert OK button
        const okBtn = document.querySelector('button.swal2-confirm.swal2-styled');

        if (okBtn && okBtn.offsetParent !== null) { // visible
            console.log("🟢 'OK' button detected. Waiting 5 seconds...");
            setTimeout(() => {
                if (okBtn && okBtn.offsetParent !== null) {
                    console.log("👉 Clicking 'OK' button...");
                    okBtn.click();
                }
            }, 5000);
        }

        // "Go Claim" links
        const goClaimLinks = document.querySelectorAll('a.btn.btn-primary');
        goClaimLinks.forEach(link => {
            if (link.textContent.trim() === "Go Claim" && link.href.includes("/faucet/currency/")) {
                if (!link.dataset.clicked) { // prevent double clicks
                    link.dataset.clicked = "true";
                    console.log("🟢 'Go Claim' link detected. Waiting 5 seconds to click:", link.href);
                    setTimeout(() => {
                        console.log("👉 Clicking 'Go Claim' link:", link.href);
                        link.click();
                    }, 5000);
                }
            }
        });
    });

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

})();