Hofaucet.xyz AutoClaim Faucet

Automatically Login and Click Faucet

在您安装前,Greasy Fork 希望您知道此脚本声明其包含了一些负面功能。这些功能也许会使脚本作者获利,而不能给您带来任何直接的金钱收益。

作者可从这份脚本获得佣金,例如通过修改链接地址或提供优惠券代码以包含推荐或附属代码。 脚本作者的说明: Directs to a referral link when not logged in

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            Hofaucet.xyz AutoClaim Faucet
// @namespace       bekerja pada tampermonkey maupun violentmonkey
// @version         0.1
// @author          Ojo Ngono
// @description     Automatically Login and Click Faucet
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_addStyle
// @grant           GM_registerMenuCommand
// @require         https://update.greasyfork.org/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
// @match           https://hofaucet.xyz/*
// @icon            https://i.ibb.co.com/XJSPdz0/large.png
// @license         Copyright OjoNgono
// @antifeature     referral-link Directs to a referral link when not logged in
// ==/UserScript==

const cfg = new MonkeyConfig({
    title: 'Input Email Faucetpay:',
    menuCommand: true,
    params: {
        Announcements: {
            type: 'text',
            default: 'Input Email Faucetpay',
            long: 2
        },
        Email: {
            label: "EmailFaucetpay",
            type: "text",
            default: ''
        }
    }
});

(function() {
    'use strict';

    const email = cfg.get('Email');
    const loggedIn = document.querySelector('a.nav-link[data-target="#logoutModal"]');

    function isLoggedIn() {
    const logoutButton = document.querySelector('a.nav-link[data-target="#logoutModal"]');
    return logoutButton !== null;
}


    function enforceReferralUrl() {
    if (!isLoggedIn() && window.location.href === "https://hofaucet.xyz/" && !window.location.href.includes("?r=1878")) {
        window.location.replace("https://hofaucet.xyz/?r=1878");
    }
}

    let enforceReferralInterval = setInterval(() => {
    if (!isLoggedIn()) {
        enforceReferralUrl();
    } else {
        clearInterval(enforceReferralInterval);
    }
}, 1000);


    window.addEventListener('load', () => {
        GM_addStyle(`label[for="Timeout"] {white-space: pre-wrap;}`);
        if (loggedIn) {
            if (!email) {
                alert("Please enter your FaucetPay email in the SETTINGS MENU.");
                forceLogout();
            } else {
                rotateUrls();
            }
        } else {
            if (email) {
                fillLoginForm(email);
            }
        }
    });

    function fillLoginForm(email) {
        const form = document.querySelector('form.user');
        if (form) {
            const emailInput = form.querySelector('input[name="wallet"]');
            if (emailInput) {
                emailInput.value = email;
            }
            const loginButton = form.querySelector('button[type="submit"]');
            if (loginButton) {
                loginButton.click();
            }
        }
    }

    function forceLogout() {
        const logoutButton = document.querySelector('a[href="https://hofaucet.xyz/auth/logout"]');
        if (logoutButton) {
            logoutButton.click();
        }
    }

    const urls = [
        "https://hofaucet.xyz/faucet/currency/trx",
        "https://hofaucet.xyz/faucet/currency/ltc",
        "https://hofaucet.xyz/faucet/currency/doge",
        "https://hofaucet.xyz/faucet/currency/usdt",
        "https://hofaucet.xyz/faucet/currency/eth"
    ];

    let currentIndex = parseInt(localStorage.getItem('currentIndex')) || 0;

    const rotateUrls = () => {
        const loggedIn = document.querySelector('#logoutModal') || document.querySelector('a.nav-link[data-target="#logoutModal"]');
        if (loggedIn && window.location.href === "https://hofaucet.xyz/") {
            window.location.href = urls[currentIndex];
            currentIndex = (currentIndex + 1) % urls.length;
            localStorage.setItem('currentIndex', currentIndex);
        }
    };

    function clickClaimButton() {
    const claimNowButton = Array.from(document.querySelectorAll('button.btn.btn-primary')).find(
        button => button.textContent.trim() === "Claim Now"
    );

    if (claimNowButton) {
        claimNowButton.scrollIntoView({ behavior: "smooth", block: "center" });

        const recaptchaResponse = document.querySelector('.g-recaptcha-response');
        if (recaptchaResponse && recaptchaResponse.value.trim() !== "") {
            setTimeout(() => {
                claimNowButton.click();
            }, 500);
        }
    }
}

setInterval(clickClaimButton, 4000);


    function checkForMessage() {
    const swalPopup = document.querySelector('.swal2-popup.swal2-show');
    if (swalPopup) {
        const successMessageContainer = swalPopup.querySelector('.swal2-html-container');
        if (successMessageContainer) {
            const successMessage = successMessageContainer.innerText || "";
            const successIndicator = "has been sent to your FaucetPay account!";
            const claimSuccessIndicator = "Success!";
            const insufficientFundsMessage = "The faucet does not have sufficient funds for this transaction.";
            const invalidCaptchaMessage = "Invalid Claim";

            if (successMessage.includes(successIndicator) || successMessage.includes(claimSuccessIndicator)) {
                window.location.href = "https://hofaucet.xyz";
            } else if (successMessage.includes(insufficientFundsMessage)) {
                window.location.href = "https://hofaucet.xyz";
            } else if (successMessage.includes(invalidCaptchaMessage)) {
                window.location.href = "https://hofaucet.xyz";
            }
        }
    }

    const emptyBadge = document.querySelector('span.badge.badge-danger');
    if (emptyBadge && emptyBadge.textContent.trim() === "Empty") {
        window.location.href = "https://hofaucet.xyz";
    }

    const goClaimButton = document.querySelector('h4.next-button a.btn.btn-primary');
    if (goClaimButton && goClaimButton.innerText.includes('Go Claim')) {
        goClaimButton.click();
    }
}

setInterval(checkForMessage, 2000);

    function clickTryAgain() {
        let tryAgainButton = document.querySelector('a.btn.btn-primary');
        if (tryAgainButton && tryAgainButton.textContent.includes('Try Again')) {
            tryAgainButton.click();
        }
    }

    setInterval(clickTryAgain, 2000);
})();