ISCUT

(click, math, proceed).

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         ISCUT
// @namespace    Mrtznx
// @version      1.0
// @description  (click, math, proceed).
// @match        *://*.mylinkat.com/*
// @match        *://trendzilla.club/*
// @match        *://earnzilla.net/*
// @match        *://gamerev.us/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    console.log('[Auto] Script started. Waiting for Turnstile...');

    // ---------- 1. Wait for Turnstile token (user solves manually) ----------
    function waitForTurnstile() {
        return new Promise((resolve) => {
            const checkToken = setInterval(() => {
                const inp = document.querySelector('input[name="alcaptcha-response"]');
                if (inp && inp.value && inp.value.trim() !== '') {
                    clearInterval(checkToken);
                    console.log('[Auto] Turnstile token found:', inp.value);
                    resolve();
                }
            }, 500);
        });
    }

    // ---------- 2. Click on the image to start the 15-sec countdown ----------
    function clickImageToStartTimer() {
        const imgBox = document.getElementById('ad-gate-inline');
        if (imgBox && imgBox.style.display !== 'none') {
            console.log('[Auto] Clicking on ad-gate image to start timer.');
            imgBox.click(); // triggers the click event listener
            return true;
        }
        return false;
    }

    // ---------- 3. Wait for Step 2 (Math captcha) to appear ----------
    function waitForStep2() {
        return new Promise((resolve) => {
            const checkStep2 = setInterval(() => {
                const step2 = document.getElementById('visit-steps-2');
                if (step2 && step2.style.display === 'block') {
                    clearInterval(checkStep2);
                    console.log('[Auto] Step 2 (Math) is visible.');
                    resolve();
                }
            }, 300);
        });
    }

    // ---------- 4. Auto-solve Math captcha ----------
    function autoSolveMath() {
        const mathInput = document.getElementById('math-a');
        const checkBtn = document.getElementById('math-check');
        if (mathInput && checkBtn && window.MATH && window.MATH.ans !== undefined) {
            // Fill the correct answer
            mathInput.value = window.MATH.ans;
            console.log('[Auto] Math answer filled:', window.MATH.ans);
            // Click the check button
            checkBtn.click();
            console.log('[Auto] Math check button clicked.');
            return true;
        }
        return false;
    }

    // ---------- 5. Wait for success/final message or proceed button ----------
    function waitForProceed() {
        return new Promise((resolve) => {
            const checkProceed = setInterval(() => {
                // Either proceed message (with link) or final code box
                const proceedMsg = document.getElementById('proceed-msg');
                const finalDiv = document.getElementById('proceed-final');
                const codeValue = document.getElementById('visit-code-value');

                if (proceedMsg && proceedMsg.style.display !== 'none') {
                    clearInterval(checkProceed);
                    console.log('[Auto] Proceed message found.');
                    // Click on the link inside proceed-msg if any
                    const link = proceedMsg.querySelector('a');
                    if (link) {
                        console.log('[Auto] Clicking proceed link:', link.href);
                        link.click();
                    }
                    resolve();
                } else if (finalDiv && finalDiv.style.display !== 'none') {
                    clearInterval(checkProceed);
                    console.log('[Auto] Final code box appeared.');
                    // Optionally copy code or just finish
                    if (codeValue) {
                        console.log('[Auto] Code received:', codeValue.textContent);
                    }
                    resolve();
                } else {
                    // Also check if there is any success message with "alert-success"
                    const successAlert = document.querySelector('.alert-success');
                    if (successAlert && successAlert.style.display !== 'none') {
                        clearInterval(checkProceed);
                        console.log('[Auto] Success alert found.');
                        resolve();
                    }
                }
            }, 300);
        });
    }

    // ---------- Main flow ----------
    async function runAuto() {
        // Step 1: Wait for Turnstile to be solved manually
        await waitForTurnstile();

        // Step 2: Click on the image to start timer (if not already started)
        // Wait a bit for the image to appear
        setTimeout(() => {
            if (!clickImageToStartTimer()) {
                // If image not found, maybe timer already started; check step 2 directly
                console.log('[Auto] Image not found or already clicked.');
            }
        }, 1000);

        // Step 3: Wait for Step 2 to become visible
        await waitForStep2();

        // Step 4: Auto-solve math (may need to wait a bit for math to be generated)
        // Try a few times if not immediately available
        let mathSolved = false;
        for (let i = 0; i < 10; i++) {
            if (autoSolveMath()) {
                mathSolved = true;
                break;
            }
            await new Promise(r => setTimeout(r, 300));
        }

        if (!mathSolved) {
            console.warn('[Auto] Could not solve math automatically.');
        }

        // Step 5: Wait for the final proceed or code
        await waitForProceed();

        console.log('[Auto] Funnel completed automatically!');
    }

    // Start the automation once DOM is ready
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', runAuto);
    } else {
        runAuto();
    }

})();