Greasy Fork

Greasy Fork is available in English.

Claim.ourCoinCash.xyz AutoClaim Faucet

Automatically Login and Click Faucet

当前为 2024-12-19 提交的版本,查看 最新版本

// ==UserScript==
// @name            Claim.ourCoinCash.xyz AutoClaim Faucet
// @namespace       bekerja pada tampermonkey maupun violentmonkey
// @version         0.9
// @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/*
// @exclude         https://claim.ourcoincash.xyz/auth/login*
// @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: {
        Email: {
            label: "EmailFaucetpay",
            type: "text",
            default: ''
        }
    }
});

(function () {
    'use strict';

    const email = cfg.get('Email');
    const loggedIn = document.querySelector('i.fas.fa-user-circle.fa-2x');

    function isLoggedIn() {
        return loggedIn !== null;
    }

    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);
        }
    }, 2000);

    window.addEventListener('load', () => {
    GM_addStyle(`label[for="Timeout"] {white-space: pre-wrap;}`);

    const email = cfg.get('Email');
    const loggedIn = document.querySelector('i.fas.fa-user-circle.fa-2x');

    if (loggedIn) {
        if (!email) {
            alert("Please enter your FaucetPay email in the SETTINGS MENU.");
            forceLogout();
        } else {
            rotateUrls();
        }
    } else if (email) {
        fillLoginForm(email);
    } else if (window.location.href === "https://claim.ourcoincash.xyz/?r=5848") {
        window.location.replace("https://claim.ourcoincash.xyz");
    }
});


    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/trx",
        "https://claim.ourcoincash.xyz/faucet/currency/fey",
        "https://claim.ourcoincash.xyz/faucet/currency/doge"
    ];

    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 clickClaimButton() {
        var claimButton = document.querySelector('#subbutt');
        if (claimButton) {
            claimButton.click();
        }
    }

    setInterval(clickClaimButton, 3000);

    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 = "You have been rate-limited. Please try again in a few seconds.";
            const insufficientFundsMessage = "The faucet does not have sufficient funds for this transaction.";

            if (successMessage.includes(successIndicator) || successMessage.includes(insufficientFundsMessage)) {
                window.location.href = "https://claim.ourcoincash.xyz";
                return;
            }
        }
    }

    const alertDanger = document.querySelector('.alert-danger');
    if (alertDanger) {
        const alertText = alertDanger.innerText || "";
        const dailyLimitMessage = "Daily claim limit for this coin reached, please comeback again tomorrow.";

        setTimeout(() => {
            if (alertText.includes(dailyLimitMessage)) {
                window.location.replace("https://claim.ourcoincash.xyz");
            }
        }, 1000);
    }
}
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);

    if (window.location.href.includes("https://claim.ourcoincash.xyz/firewall")) {
        function detectHCaptcha() {
            return !!document.querySelector("iframe[src*='hcaptcha.com']");
        }
        (function () {
    'use strict';

    function detectReCaptcha() {
        return !!document.querySelector('iframe[src*="recaptcha/api2"]');
    }

    function isReCaptchaValidated() {
        const recaptchaResponse = document.querySelector('.g-recaptcha-response');
        return recaptchaResponse && recaptchaResponse.value.trim() !== "";
    }

    function detectTurnstile() {
        return !!document.querySelector('iframe[src*="challenges.cloudflare.com"]');
    }

    function isTurnstileValidated() {
        const turnstileResponse = document.querySelector('textarea[name="cf-turnstile-response"]');
        return turnstileResponse && turnstileResponse.value.trim() !== "";
    }

    function clickUnlockButton() {
        const unlockButton = Array.from(document.querySelectorAll('button.btn.btn-primary.w-md')).find(
            button => button.textContent.trim() === "Unlock"
        );

        if (unlockButton) {
            if (detectReCaptcha() && isReCaptchaValidated()) {
                setTimeout(() => unlockButton.click(), 500);
            } else if (detectTurnstile() && isTurnstileValidated()) {
                setTimeout(() => unlockButton.click(), 500);
            }
        }
    }

    function observeCaptcha() {
        const observer = new MutationObserver(() => {
            if (detectReCaptcha() || detectTurnstile()) {
                observer.disconnect();
                setInterval(clickUnlockButton, 2000);
            }
        });

        observer.observe(document.body, { childList: true, subtree: true });
    }

    observeCaptcha();
})();


        setInterval(() => {
            if (detectHCaptcha()) {
                location.reload();
            } else if (checkTurnstile()) {
                clickUnlock();
            }
        }, 2000);
    }
})();

(function () {

    const adSelectors = [

        '.ads',
        '.left-ads',
        '.right-ads',

    ];

    adSelectors.forEach(selector => {
        const elements = document.querySelectorAll(selector);
        elements.forEach(el => el.remove());
    });

    const scriptsToBlock = [
        'cryptocoinsad.com/ads',
        'wpadmngr.com/static/adManager.js',
        'penaikaucmu.net',
        'shebudriftaiter.net/tag.min.js',
        'a.pemsrv.com/popunder1000.js'
    ];

    const observer = new MutationObserver(() => {
        adSelectors.forEach(selector => {
            const elements = document.querySelectorAll(selector);
            elements.forEach(el => el.remove());
        });
    });

    observer.observe(document.body, { childList: true, subtree: true });

    const originalCreateElement = document.createElement;
    document.createElement = function (tagName) {
        if (tagName === 'script') {
            const script = originalCreateElement.call(document, tagName);
            Object.defineProperty(script, 'src', {
                set(url) {
                    if (!scriptsToBlock.some(blockedUrl => url.includes(blockedUrl))) {
                        script.setAttribute('src', url);
                    }
                }
            });
            return script;
        }
        return originalCreateElement.call(document, tagName);
    };
})();

(function() {

    function clickGoClaimButton() {
        const goClaimButton = document.querySelector('h4.next-button a.btn.btn-primary');

        if (goClaimButton) {
            goClaimButton.click();
        }
    }

    const observer = new MutationObserver(() => {
        clickGoClaimButton();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    clickGoClaimButton();
})();