Greasy Fork is available in English.

Auto Click pepecoin

Automatically clicks ptc/shortlink/faucet on earn-pepe.com

// ==UserScript==
// @name         Auto Click pepecoin
// @namespace    auto click ptc,shorlink,faucet 
// @version      0.2.2
// @description  Automatically clicks ptc/shortlink/faucet on earn-pepe.com
// @author       Ojo Ngono
// @match        https://earn-pepe.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=earn-pepe.com
// @license      Copyright Ojo Ngono
// @grant        none
// ==/UserScript==





(function() {
    'use strict';

    function clickButton(selector, delay = 0) {
        const button = document.querySelector(selector);
        if (button) {
            setTimeout(() => button.click(), delay);
        }
    }

    function randomDelay(min, max) {
        return Math.floor(Math.random() * (max - min + 1) + min);
    }

    function solveCaptcha() {
        const captchaIcon = document.querySelector('.captcha-icon');
        if (captchaIcon) {
            const captchaClass = [...captchaIcon.classList].find(cls => cls.startsWith('fa-'));
            if (captchaClass) {
                const iconOptions = document.querySelectorAll('#icon-options .icon-option');
                for (const option of iconOptions) {
                    if ([...option.classList].includes(captchaClass)) {
                        option.click();
                        return true;
                    }
                }
            }
        }
        return false;
    }

    function clickClaimButtonWithDelay() {
        const delay = randomDelay(2000, 4000); // Random delay between 2-4 seconds
        clickButton('button[type="submit"].btn-primary', delay);
    }

    function startAdClickProcess() {
        clickButton('button.nav-link#pills-profile-tab[data-bs-toggle="pill"]');
        const checkExist = setInterval(() => {
            const viewAdButton = document.querySelector('#pills-profile a.btn.btn-info.text-white.w-100[onclick^="window.location.href="]');
            if (viewAdButton) {
                viewAdButton.click();
                clearInterval(checkExist);
            }
        }, 500);
    }

    window.addEventListener('load', () => {
        startAdClickProcess();
        clickButton('#ctaButton');
        const interval = setInterval(() => {
            if (solveCaptcha()) {
                clearInterval(interval);
                clickClaimButtonWithDelay();
            }
        }, 1000);

        // Click the button with classes "btn btn-lg btn-primary" with a random delay between 5-9 seconds
        const delay = randomDelay(5000, 9000); // Random delay between 5-9 seconds
        clickButton('.btn.btn-lg.btn-primary', delay);
    });

    window.addEventListener('load', function() {
        const button = document.querySelector('a.btn.btn-info.text-white.w-100');
        if (button) button.click();
    }, false);
})();