Greasy Fork

Greasy Fork is available in English.

OurCoinCash.xyz AutoClaim Faucet

Automatically Login and Click Faucet

当前为 2024-10-06 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         OurCoinCash.xyz AutoClaim Faucet
// @namespace    bekerja pada tampermonkey maupun violentmonkey
// @version      0.2
// @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.icu/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
// @match        *://claim.ourcoincash.xyz/*
// @license      Copyright OjoNgono
// ==/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: ''
        },
        Timeout: {
            label: "Timeout for reCAPTCHA not solved",
            type: "number",
            default: 35
        }
    }
});

(function() {
    'use strict';

    const email = cfg.get('Email');
    const timeoutDuration = cfg.get('Timeout') * 1000;
    const loggedIn = document.querySelector("#logoutModal");

    function isLoggedIn() {
        return !!document.querySelector("#logoutModal");
    }

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

    let enforceReferralInterval = setInterval(function() {
        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://claim.ourcoincash.xyz/auth/logout"]');
        if (logoutButton) {
            logoutButton.click();
        }
    }

    const urls = [
        "https://claim.ourcoincash.xyz/faucet/currency/bnb",
        "https://claim.ourcoincash.xyz/faucet/currency/bch",
        "https://claim.ourcoincash.xyz/faucet/currency/dash",
        "https://claim.ourcoincash.xyz/faucet/currency/doge",
        "https://claim.ourcoincash.xyz/faucet/currency/dgb",
        "https://claim.ourcoincash.xyz/faucet/currency/eth",
        "https://claim.ourcoincash.xyz/faucet/currency/fey",
        "https://claim.ourcoincash.xyz/faucet/currency/ltc",
        "https://claim.ourcoincash.xyz/faucet/currency/sol",
        "https://claim.ourcoincash.xyz/faucet/currency/trx",
        "https://claim.ourcoincash.xyz/faucet/currency/zec"
    ];

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

    const rotateUrls = () => {
        const loggedIn = document.querySelector('#logoutModal') || document.querySelector('a[href*="logout"]');
        if (loggedIn && window.location.href === "https://claim.ourcoincash.xyz/") {
            window.location.href = urls[currentIndex];
            currentIndex = (currentIndex + 1) % urls.length;
            localStorage.setItem('currentIndex', currentIndex);
        }
    };

    function isRecaptchaSolved() {
        var recaptchaResponse = document.querySelector('#g-recaptcha-response');
        return recaptchaResponse && recaptchaResponse.value.length > 0;
    }

    function smoothScrollToElement(element) {
        element.scrollIntoView({
            behavior: 'smooth',
            block: 'center'
        });
    }

    function clickClaimButton() {
        var claimButton = document.querySelector('#subbutt');
        if (claimButton) {
            claimButton.click();
        }
    }

    var checkRecaptchaInterval = setInterval(function() {
        if (isRecaptchaSolved()) {
            clickClaimButton();
            clearInterval(checkRecaptchaInterval);
        }
    }, 1000);

    setTimeout(function() {
        clickClaimButton();
        clearInterval(checkRecaptchaInterval);
    }, timeoutDuration);

    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 Captcha";
                if (successMessage.includes(successIndicator) || successMessage.includes(claimSuccessIndicator)) {
                    window.location.href = "https://claim.ourcoincash.xyz";
                } else if (successMessage.includes(insufficientFundsMessage)) {
                    window.location.href = "https://claim.ourcoincash.xyz";
                } else if (successMessage.includes(invalidCaptchaMessage)) {
                    window.location.href = "https://claim.ourcoincash.xyz";
                }
            }
        }

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

    setInterval(checkForMessage, 1000);

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

    setInterval(clickTryAgain, 2000);

})();