ClaimCoin.in Auto Click

Mengklik tombol "View," "Watch Now," "Verify," link di halaman links, dan tombol di halaman achievements secara otomatis setelah kondisi tertentu terpenuhi di halaman yang relevan pada situs ClaimCoin.

// ==UserScript==
// @name           ClaimCoin.in Auto Click
// @namespace      Tampermonkey&violentmonkey&others
// @version        0.1
// @description    Mengklik tombol "View," "Watch Now," "Verify," link di halaman links, dan tombol di halaman achievements secara otomatis setelah kondisi tertentu terpenuhi di halaman yang relevan pada situs ClaimCoin.
// @author         OjoNgono
// @match          https://claimcoin.in/*
// @grant          none
// @license        Copyright OjoNgono
// ==/UserScript==

(function() {
    'use strict';

    const originalAlert = window.alert;
    window.alert = function(message) {
        if (message.includes('Error! Seems that window is not opening at your device. Please reload this page.')) {
            return;
        }
        originalAlert(message);
    };

    if (window.location.href.includes('/achievements')) {
        function clickAchievementsButton() {
            const achievementsButtons = document.querySelectorAll('.btn.btn-dark.mb-2.mr-2.rounded-circle');
            for (let button of achievementsButtons) {
                if (!button.disabled && button.offsetParent !== null) {
                    setTimeout(() => {
                        button.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
                    }, 500);
                    return;
                }
            }
        }
        setTimeout(clickAchievementsButton, 1000);
    }

    if (window.location.href.includes('/faucet')) {
        function scrollToMiddle() {
            window.scroll({
                top: document.body.scrollHeight / 2,
                behavior: "smooth"
            });
        }
        function waitForButtonAndClick() {
            const interval = setInterval(() => {
                const button = document.querySelector('.btn.btn-primary.btn-lg.claim-button');
                if (button && !button.disabled) {
                    button.click();
                    clearInterval(interval);
                }
            }, 1000);
        }
        scrollToMiddle();
        setTimeout(waitForButtonAndClick, 3000);
    }

    if (window.location.href.includes('/links')) {
        const linkList = [
            'https://claimcoin.in/links/go/64',
            'https://claimcoin.in/links/go/63',
            'https://claimcoin.in/links/go/61',
            'https://claimcoin.in/links/go/62',
            'https://claimcoin.in/links/go/26',
            'https://claimcoin.in/links/go/60',
            'https://claimcoin.in/links/go/69',
            'https://claimcoin.in/links/go/59',
            'https://claimcoin.in/links/go/1'
        ];
        let currentIndex = 0;

        function clickLinkButton() {
            let button = document.querySelector(`a.btn.btn-success.waves-effect.waves-light[href="${linkList[currentIndex]}"]`);
            if (button) {
                button.removeAttribute('target');
                if (!button.classList.contains('disabled')) {
                    button.click();
                    return;
                }
            }
            currentIndex++;
            if (currentIndex < linkList.length) {
                setTimeout(clickLinkButton, 1000);
            } else {
                window.location.href = 'https://claimcoin.in/faucet';
            }
        }
        setTimeout(clickLinkButton, 1000);
    }

    if (window.location.href.includes('/ptc') && !window.location.href.includes('/ptc/iframe')) {
        function clickViewButton() {
            const button = document.querySelector('.btn.btn-success.btn-block');
            if (button) {
                setTimeout(() => {
                    button.click();
                    waitForWatchNowButton();
                }, 1000);
            } else {
                window.location.href = 'https://claimcoin.in/links';
            }
        }
        function waitForWatchNowButton() {
            let watchInterval = setInterval(() => {
                let watchButton = document.querySelector('#watchNowButton');
                if (watchButton) {
                    clearInterval(watchInterval);
                    clickWatchNow();
                }
            }, 1000);
        }
        function clickWatchNow() {
            let watchButton = document.querySelector('#watchNowButton');
            if (watchButton) {
                watchButton.click();
            }
        }
        clickViewButton();
    }

    if (window.location.href.includes('/ptc/iframe')) {
        function waitForCountdown() {
            let countdownInterval = setInterval(() => {
                let countdownElement = document.querySelector('#ptcCountdown');
                if (countdownElement && countdownElement.textContent.trim() === "0 second") {
                    clearInterval(countdownInterval);
                    // Berikan sedikit waktu ekstra untuk memastikan countdown benar-benar selesai
                    setTimeout(checkVerifyModal, 500); 
                }
            }, 1000);
        }
        function checkVerifyModal() {
            let modalInterval = setInterval(() => {
                let modal = document.querySelector('.modal-content');
                if (modal) {
                    let verifyButton = modal.querySelector('#verify');
                    if (verifyButton && !verifyButton.disabled) {
                        clearInterval(modalInterval);
                        // Berikan sedikit delay untuk memastikan tombol sudah bisa diklik
                        setTimeout(() => verifyButton.click(), 500); 
                    }
                }
            }, 1000);
        }
        waitForCountdown();
    }

    if (window.location.href.includes('/ptc/window')) {
        function checkVerifyButton() {
            let verifyInterval = setInterval(() => {
                let verifyButton = document.querySelector('#verify');
                if (verifyButton) {
                    clearInterval(verifyInterval);
                    verifyButton.click();
                } else {
                    checkVerifyModal();
                }
            }, 1000);
        }
        checkVerifyButton();
    }
})();