Freebitco.in Auto ROLL | With Turnstile CloudFlare CAPTCHA

Automatically clicks “ROLL” when the Turnstile Cloudflare CAPTCHA is solved.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Freebitco.in Auto ROLL | With Turnstile CloudFlare CAPTCHA
// @namespace    https://freebitco.in/
// @version      1.1
// @description  Automatically clicks “ROLL” when the Turnstile Cloudflare CAPTCHA is solved.
// @author       Rubystance
// @license      MIT
// @match        https://freebitco.in/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const log = (...args) => console.log('[AutoROLL]', ...args);

    function isCaptchaResolved() {
        const input = document.querySelector('input[name="cf-turnstile-response"]');
        return input && input.value.trim().length > 0;
    }

    function tryClickRollButton() {
        const button = document.getElementById('free_play_form_button');
        if (!button) {
            log("ROLL! not found.");
            return;
        }

        if (isCaptchaResolved() && !button.disabled && button.offsetParent !== null) {
            log("CAPTCHA solved. Clicking on ROLL! button");
            button.click();
        } else {
            log("Waiting for CAPTCHA...");
        }
    }

    function observeCaptcha() {
        const captchaInput = document.querySelector('input[name="cf-turnstile-response"]');

        if (!captchaInput) {
            log("CAPTCHA fiel not detected. Repeating in 2s...");
            setTimeout(observeCaptcha, 2000);
            return;
        }

        const observer = new MutationObserver(() => {
            if (isCaptchaResolved()) {
                log("CAPTCHA detected!");
                tryClickRollButton();
            }
        });

        observer.observe(captchaInput, { attributes: true, attributeFilter: ['value'] });

        setInterval(() => {
            if (isCaptchaResolved()) {
                tryClickRollButton();
            }
        }, 1000);

        log("Waiting for CAPTCHA to detect a solution...");
    }

    window.addEventListener('load', () => {
        setTimeout(observeCaptcha, 2000);
    });
})();