Work.ink Auto Clicker 100% Working

Auto clicks Work.ink buttons, waits for offers complete,clicks all buttons

目前為 2025-09-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Work.ink Auto Clicker 100% Working
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Auto clicks Work.ink buttons, waits for offers complete,clicks all buttons
// @author       Shiva
// @match        *://*.work.ink/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Helper: simulate a real mouse click (used only for final button now)
    function simulateMouseClick(element) {
        if (!element) return false;
        ['mousedown', 'mouseup', 'click'].forEach(type => {
            const event = new MouseEvent(type, {
                view: window,
                bubbles: true,
                cancelable: true,
                buttons: 1
            });
            element.dispatchEvent(event);
        });
        return true;
    }

    // Helper: wait for an element
    function waitForElement(selector, callback, timeout = 60000) {
        const start = Date.now();
        const interval = setInterval(() => {
            const el = document.querySelector(selector);
            if (el) {
                clearInterval(interval);
                callback(el);
            } else if (Date.now() - start > timeout) {
                clearInterval(interval);
                console.warn(`Timeout waiting for element: ${selector}`);
            }
        }, 500);
    }

    // Reliable final button click: waits until enabled, then clicks and stops
    function waitAndClickFinalButton(selector, delay = 1000) {
        const interval = setInterval(() => {
            const el = document.querySelector(selector);
            if (el && !el.disabled && el.offsetParent !== null) { // visible & enabled
                console.log("Final button is now enabled. Clicking...");

                el.scrollIntoView({ behavior: "smooth", block: "center" });
                el.focus();

                ['pointerdown', 'mousedown', 'mouseup', 'click'].forEach(type => {
                    el.dispatchEvent(new MouseEvent(type, {
                        bubbles: true,
                        cancelable: true,
                        view: window,
                        buttons: 1
                    }));
                });

                console.log("Final button clicked. Stopping retries.");
                clearInterval(interval);
            } else {
                console.log("Final button still disabled. Waiting...");
            }
        }, delay);
    }

    // Step sequence
    waitForElement('div.button.large.accessBtn', el => {
        console.log("Step 1: Go To Destination (normal click)");
        el.click(); // normal click

        waitForElement('button:contains("Continue With Ads")', adsBtn => {
            console.log("Step 2: Continue With Ads");
            simulateMouseClick(adsBtn);

            waitForElement('div.button.large.accessBtn', el2 => {
                console.log("Step 3: Go To Destination Again");
                simulateMouseClick(el2);

                waitForElement('button span:contains("Proceed to Safe Destination")', finalBtn => {
                    console.log("Step 4: Proceed to Safe Destination");
                    simulateMouseClick(finalBtn.closest("button"));

                    // Final button: wait until enabled and click
                    waitAndClickFinalButton('#access-offers', 1000);
                });
            });
        });
    });

    // :contains support
    (function() {
        const contains = (selector) => {
            const regex = /:contains\(["']?(.+?)["']?\)/;
            if (!regex.test(selector)) return null;
            const text = selector.match(regex)[1];
            const baseSelector = selector.replace(regex, '');
            return [...document.querySelectorAll(baseSelector)]
                .find(el => el.textContent.trim().includes(text));
        };

        document.querySelector = new Proxy(document.querySelector, {
            apply(target, thisArg, args) {
                if (args[0].includes(':contains')) {
                    return contains(args[0]);
                }
                return Reflect.apply(target, thisArg, args);
            }
        });
    })();

    // Remove banners
    const observer = new MutationObserver(() => {
        const banner = document.querySelector('.done-banner-container');
        if (banner) banner.remove();
    });
    observer.observe(document.body, { childList: true, subtree: true });

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址