ISCUT

(click, math, proceed).

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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();
    }

})();