CM (AB)

Wait for antibot and Cloudflare solved, then real click Collect your reward button on Coinymate faucet + refresh every 1 minute

// ==UserScript==
// @name         CM (AB)
// @namespace    https://coinymate.com/
// @version      1.1
// @description  Wait for antibot and Cloudflare solved, then real click Collect your reward button on Coinymate faucet + refresh every 1 minute
// @author       👽
// @match        https://coinymate.com/faucet
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Real user-like click by dispatching mouse events
    function realClick(element) {
        if (!element) return false;
        const events = ['mouseover', 'mousedown', 'mouseup', 'click'];
        for (const evtType of events) {
            const evt = new MouseEvent(evtType, {
                view: window,
                bubbles: true,
                cancelable: true,
                buttons: 1
            });
            element.dispatchEvent(evt);
        }
        return true;
    }

    function waitForAntibotSolved(timeoutMs = 60000) {
        return new Promise((resolve, reject) => {
            const start = Date.now();
            const interval = setInterval(() => {
                const antibotInput = document.querySelector('#antibotlinks');
                if (antibotInput && antibotInput.value.trim().length > 0) {
                    clearInterval(interval);
                    resolve(true);
                } else if (Date.now() - start > timeoutMs) {
                    clearInterval(interval);
                    reject('Timeout waiting for antibotlinks to be solved.');
                }
            }, 1000);
        });
    }

    async function run() {
        try {
            await waitForAntibotSolved();

            if (document.readyState !== 'complete') {
                await new Promise(r => window.addEventListener('load', r));
            }

            const claimBtn = document.querySelector('button.btn.btn-primary.btn-lg.claim-button');
            if (claimBtn) {
                realClick(claimBtn);
            }
        } catch(e) {
            // silently ignore errors
        }
    }

    window.addEventListener('load', () => {
        setTimeout(run, 3000);

        // Refresh page every 60 seconds
        setInterval(() => {
            location.reload();
        }, 60000);
    });
})();