AutoLitecoin

Auto login and faucet

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         AutoLitecoin
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Auto login and faucet
// @author       White
// @match        https://autolitecoin.xyz/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=autolitecoin.xyz
// @grant        none
// ==/UserScript==

(async function() {
    'use strict';
const pageTitle = document.title.toLowerCase();
if (pageTitle.includes('just a moment') || pageTitle.includes('um momento')) {
    console.log('O título da página contém a frase "just a moment" ou "um momento". O script será desativado.');
    return;}
if (!pageTitle.includes('just a moment') || !pageTitle.includes('um momento')) {
    const handlePageRedirection = () => {
        const url = window.location.href;

        if (url === 'https://autolitecoin.xyz' || url === 'https://autolitecoin.xyz/') {
            window.location.href = 'https://autolitecoin.xyz/login';
        } else if (url === 'https://autolitecoin.xyz/dashboard') {
            window.location.href = 'https://autolitecoin.xyz/faucet';
        }
    };

    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 = '';
            passwordInput.value = '';

            await waitForCaptchaCompletion();

            clicarBotaoLogin();
        }
    };

    const clicarBotaoLogin = () => {
        const signInButton = document.querySelector('button.btn-submit.w-100');

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

    const waitForCaptchaCompletion = async () => {
        while (!(grecaptcha && grecaptcha.getResponse().length > 0)) {
            await new Promise(resolve => setTimeout(resolve, 100));
        }
        clicarBotaoLogin();
    };

    const executeScript = async () => {
        handlePageRedirection();

        if (window.location.href.includes('https://autolitecoin.xyz/login')) {
            await preencherCampos();
        }
    };

    await executeScript();

    let hasClicked = false;

    function mbsolver() {
        const valorAntibotlinks = document.getElementById('antibotlinks').value.replace(/\s/g, '');
        return valorAntibotlinks.length === 12;
    }

    function wasButtonClicked() {
        return localStorage.getItem('buttonClicked') === 'true';
    }

    function setButtonClicked() {
        localStorage.setItem('buttonClicked', 'true');
    }

    function removeButtonClicked() {
        localStorage.removeItem('buttonClicked');
    }

    if (wasButtonClicked()) {
        removeButtonClicked();
        window.location.href = 'https://autolitecoin.xyz/faucet';
    }


let gpcaptcha = document.querySelector('input#captcha_choosen');
setInterval(function() {
    const grecaptchaResponse = (window.grecaptcha && window.grecaptcha.getResponse) ? window.grecaptcha.getResponse() : null;
    const valorAntibotlinks = document.getElementById('antibotlinks').value.replace(/\s/g, '');

    if (window.location.href.includes("/faucet") && gpcaptcha && gpcaptcha.value.length > 0 && mbsolver() && !wasButtonClicked()) {
        $(document).ready(function () {
            const buttonText = "Claim Now";
            const submitButton = $(`button:contains('${buttonText}')`);

            if (submitButton.length > 0 && !submitButton.prop('disabled')) {
                submitButton.trigger('click');
                setButtonClicked();
            }
        });
    }
}, 3000);
}
})();