C Fr C

Click Roll & Win, select Cloudflare, then claim (no redirect) + auto refresh every 1 minute

2025-07-11 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

// ==UserScript==
// @name         C Fr C
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Click Roll & Win, select Cloudflare, then claim (no redirect) + auto refresh every 1 minute
// @author       👽
// @match        https://claimfreecoins.cc/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const wait = ms => new Promise(resolve => setTimeout(resolve, ms));

    function realClick(el) {
        if (!el) return;
        el.scrollIntoView({ behavior: 'smooth', block: 'center' });
        el.focus();
        ['mouseover', 'mousedown', 'mouseup', 'click'].forEach(type => {
            el.dispatchEvent(new MouseEvent(type, { bubbles: true, cancelable: true, view: window }));
        });
    }

    async function selectCloudflare() {
        const select = document.querySelector('select.form-control.custom-select');
        if (!select) {
            console.warn('[AutoRoll] Cloudflare select not found');
            return false;
        }
        select.value = '3';
        select.dispatchEvent(new Event('change', { bubbles: true }));
        console.log('[AutoRoll] Cloudflare selected');
        return true;
    }

    async function clickRollWin() {
        const buttons = Array.from(document.querySelectorAll('button'))
            .filter(b => b.textContent.includes('Roll & Win') && !b.hasAttribute('data-target'));
        if (buttons.length === 0) {
            console.warn('[AutoRoll] Final Roll & Win button not found');
            return false;
        }
        realClick(buttons[0]);
        console.log('[AutoRoll] Final Roll & Win button clicked');
        return true;
    }

    async function main() {
        await wait(10000);
        const openBtn = Array.from(document.querySelectorAll('button'))
            .find(b =>
                b.getAttribute('data-target') === '#captchaModal' &&
                b.textContent.includes('ROLL & WIN FREE COINS')
            );
        if (!openBtn) {
            console.warn('[AutoRoll] Open captcha modal button not found');
            return;
        }
        realClick(openBtn);
        console.log('[AutoRoll] Captcha modal opened');

        await wait(2000);
        const cloudflareSelected = await selectCloudflare();
        if (!cloudflareSelected) return;

        const delay = Math.floor(Math.random() * 6 + 7) * 1000;
        await wait(delay);

        await clickRollWin();
    }

    main();

    // Auto refresh every 1 minute
    setInterval(() => {
        console.log('[AutoRoll] Refreshing page after 1 minute');
        window.location.reload();
    }, 60000);

})();