Greasy Fork

Greasy Fork is available in English.

Script-Free-BTC

https://freebitco.in/?r=1393623

当前为 2025-02-02 提交的版本,查看 最新版本

// ==UserScript==
// @name         Script-Free-BTC
// @namespace    https://github.com/HaygoNunes/Script-FreeBTC
// @version      2.0
// @description  https://freebitco.in/?r=1393623
// @author       Hyago Nunes
// @match        https://freebitco.in/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function selecionarElementoXPath(xpath) {
        return document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
    }

    function elementoEstaVisivel(elemento) {
        return elemento && elemento.offsetParent !== null;
    }

    function aguardarElemento(xpath, callback) {
        const intervalo = setInterval(() => {
            const elemento = selecionarElementoXPath(xpath);
            if (elementoEstaVisivel(elemento)) {
                clearInterval(intervalo);
                setTimeout(callback, 3000);
            }
        }, 1000);
    }

    function clicarClaim() {
        const botaoClaim = selecionarElementoXPath("/html/body/div[2]/div/div/div[7]/p[3]/input");
        if (elementoEstaVisivel(botaoClaim)) {
            botaoClaim.click();
            console.log("Botão 'Claim' clicado com sucesso.");
        } else {
            console.log("Botão 'Claim' não encontrado ou não visível.");
        }
    }

    function executarAcoes() {
        console.log("Script iniciado. Aguardando CAPTCHA...");
        aguardarElemento("/html/body//div/div/div[3]", clicarClaim);
    }

    window.addEventListener('load', () => {
        console.log("Página carregada. Iniciando script...");
        executarAcoes();
    });
})();