AllFaucet True Same-Tab Rotator

Rotates TRX → XRP → LTC → XLM automatically in the same tab, waits for CAPTCHA, claims once per faucet

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         AllFaucet True Same-Tab Rotator
// @namespace    https://allfaucet.xyz/
// @version      1.1
// @description  Rotates TRX → XRP → LTC → XLM automatically in the same tab, waits for CAPTCHA, claims once per faucet
// @author       Rubystance
// @license      MIT
// @match        https://allfaucet.xyz/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const faucets = [
        'trx',
        'xrp',
        'ltc',
        'xlm'
    ];

    const WAIT_AFTER_CLAIM_MS = 5000;
    const CHECK_INTERVAL_MS = 1000;

    function getCurrentFaucetIndex() {
        const url = window.location.href;
        return faucets.findIndex(f => url.includes(f));
    }

    function getNextFaucetUrl() {
        const currentIndex = getCurrentFaucetIndex();
        const nextIndex = (currentIndex + 1) % faucets.length;
        return `https://allfaucet.xyz/faucet/currency/${faucets[nextIndex]}`;
    }

    function recaptchaSolved() {
        const response = document.querySelector('textarea[name="g-recaptcha-response"]');
        return !response || response.value.length > 0;
    }

    function claimCurrentFaucet() {
        const claimBtn = document.querySelector('button.btn.btn-primary[type="submit"]');
        if (!claimBtn) return false;

        const interval = setInterval(() => {
            if (recaptchaSolved()) {
                clearInterval(interval);
                console.log('Claim clicked on', window.location.href);
                claimBtn.click();

                setTimeout(() => {
                    window.location.href = getNextFaucetUrl();
                }, WAIT_AFTER_CLAIM_MS);
            }
        }, CHECK_INTERVAL_MS);

        return true;
    }

    function goToAnyFaucetFromDashboard() {

        const faucetLinks = Array.from(document.querySelectorAll('a[href*="/faucet/currency/"]'));
        if (faucetLinks.length > 0) {
            const firstFaucet = faucetLinks[0].href;
            console.log('Going to faucet:', firstFaucet);
            window.location.href = firstFaucet;
        } else {
            console.log('No faucet links found on dashboard');
        }
    }

    if (window.location.pathname === '/dashboard') {
        goToAnyFaucetFromDashboard();
    } else {
        if (!claimCurrentFaucet()) {

            setTimeout(() => {
                window.location.href = getNextFaucetUrl();
            }, WAIT_AFTER_CLAIM_MS);
        }
    }

})();