Zerofaucet Auto Loop

Fully automated faucet claim

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Zerofaucet Auto Loop
// @namespace    https://zerofaucet.top/
// @version      1.0
// @description  Fully automated faucet claim
// @author       Rubystance
// @license      MIT
// @match        https://zerofaucet.top/index.php*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const ADDRESS = "YOUR_ADDRESS_HERE";
    const LOOP_TIME = 65000; // 1 minute and 5 seconds

    function click(selector) {
        const el = document.querySelector(selector);
        if (el) {
            el.click();
            return true;
        }
        return false;
    }

    function goDashboardThenFaucet() {
        setTimeout(() => {
            click('a[href="index.php?page=dashboard"]');

            setTimeout(() => {
                click('a[href="index.php?page=faucet"]');
            }, 1500);

        }, LOOP_TIME);
    }

    if (location.pathname.endsWith("index.php") && !location.search) {
        const input = document.querySelector('input[name="address"]');
        const button = document.querySelector('button[type="submit"]');

        if (input && button) {
            input.value = ADDRESS;
            input.dispatchEvent(new Event('input', { bubbles: true }));
            setTimeout(() => button.click(), 500);
        }
    }

    if (location.search.includes("page=dashboard")) {
        setTimeout(() => {
            click('a[href="index.php?page=faucet"]');
        }, 1000);
    }

    if (location.search.includes("page=faucet")) {
        setTimeout(() => {
            click('button.btn.btn-success.btn-lg');
        }, 1000);
    }

    if (location.search.includes("page=verify")) {
        const interval = setInterval(() => {
            const claimButton = document.querySelector('button.btn.btn-success[type="submit"]');
            if (!claimButton) return;

            const rect = claimButton.getBoundingClientRect();
            const style = getComputedStyle(claimButton);

            if (
                rect.width > 0 &&
                rect.height > 0 &&
                style.display !== 'none' &&
                style.visibility !== 'hidden'
            ) {
                claimButton.click();
                clearInterval(interval);
            }
        }, 1500);
    }

    if (
        location.search.includes("page=faucet") &&
        document.body.innerText.includes("You've claimed successfully")
    ) {
        goDashboardThenFaucet();
    }

})();