Gainbtc

Auto Loogin e Faucet

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Gainbtc
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Auto Loogin e Faucet
// @author       ElonMuskBR
// @match        https://gain.cryptodrops.site/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gainbtc.click
// @grant        none
// ==/UserScript==

(async function() {
    'use strict';

    const handlePageRedirection = () => {
        const url = window.location.href;

        if (url === 'https://gain.cryptodrops.site/' || url === 'https://gain.cryptodrops.site') {
            window.location.href = 'https://gain.cryptodrops.site/login';
        }
    };

    const waitForElement = async (selector) => {
        while (!document.querySelector(selector)) {
            await new Promise(resolve => requestAnimationFrame(resolve));
        }
        return document.querySelector(selector);
    };

    const preencherCampos = async () => {
        const [emailInput, passwordInput] = await Promise.all([waitForElement('#email'), waitForElement('#password')]);

        if (emailInput && passwordInput) {
            emailInput.value = 'email';
            passwordInput.value = 'password';

            await waitForCaptchaCompletion();

            clicarBotaoLogin();
        }
    };

    const clicarBotaoLogin = () => {
    const signInButton = document.querySelector('button[type="submit"][id="form-submit"].orange-button');

        if (signInButton) {
            signInButton.dispatchEvent(new MouseEvent('click'));
        }
    };

 const waitForCaptchaCompletion = async () => {
    let turnstile = document.querySelector('.cf-turnstile > input');
    while (!(turnstile && turnstile.value.length > 0)) {
        await new Promise(resolve => setTimeout(resolve, 100));
    }
    await new Promise(resolve => setTimeout(resolve, 3000));
    clicarBotaoLogin();
};


    const executeScript = async () => {

        handlePageRedirection();

        if (window.location.href.includes('https://gain.cryptodrops.site/login')) {
            await preencherCampos();
        }
    };

    await executeScript();

const targetURL = 'https://gain.cryptodrops.site/member/dashboard';

const clickClaimButtonOnce = () => {
    if (window.location.href === targetURL) {
        const claimButton = document.querySelector('a[data-bs-toggle="modal"][data-bs-target="#faucetModal"]');
        if (claimButton && !claimButton.dataset.clicked) {
            claimButton.dataset.clicked = true;
            claimButton.click();
            claimButton.removeEventListener('click', preventEventPropagation);
        }
    }
};

const waitForCaptchaAndClickClaim = async () => {
    let turnstile;
    while (!(turnstile && turnstile.value.length > 0)) {
        turnstile = document.querySelector('.cf-turnstile > input');
        await new Promise(resolve => setTimeout(resolve, 100));
    }
    const claimButton = document.querySelector('a[href="javascript:void(0);"][onclick^="$(\'#form-data\').submit()"]');

    if (claimButton) {
        await new Promise(resolve => setTimeout(resolve, 3000));
        const clickEvent = new MouseEvent('click', {
            view: window,
            bubbles: true,
            cancelable: true
        });

        claimButton.dispatchEvent(clickEvent);

        if (claimButton.onclick) {
            claimButton.onclick();
        }
    }
};

const preventEventPropagation = (event) => {
    event.stopPropagation();
    event.preventDefault();
};

const reloadPageIfZero = () => {
    const secondElement = document.getElementById('second');
    if (secondElement && secondElement.innerText.trim() === '0') {
        location.reload();
    }
};

document.addEventListener('click', preventEventPropagation, true);
setInterval(reloadPageIfZero, 3000);
waitForCaptchaAndClickClaim();
clickClaimButtonOnce();
})();