Work.ink Auto Clicker (with delays)

Automatically clicks through Work.ink buttons in sequence and removes ad banners (with delays)

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

// ==UserScript==
// @name         Work.ink Auto Clicker (with delays)
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Automatically clicks through Work.ink buttons in sequence and removes ad banners (with delays)
// @author       Shiva
// @match        *://*.work.ink/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 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);
            }
        }, 500);
    }

    // Step 1: Click "Go To Destination"
    waitForElement('div.button.large.accessBtn', el => {
        console.log("Clicking Go To Destination (step 1)...");
        setTimeout(() => el.click(), 500);

        // Step 2: Wait for "Continue With Ads"
        waitForElement('button:contains("Continue With Ads")', adsBtn => {
            console.log("Clicking Continue With Ads...");
            setTimeout(() => adsBtn.click(), 500);

            // Step 3: Click "Go To Destination" again
            waitForElement('div.button.large.accessBtn', el2 => {
                console.log("Clicking Go To Destination (step 2)...");
                setTimeout(() => el2.click(), 500);

                // Step 4: Wait for "Proceed to Safe Destination"
                waitForElement('button span:contains("Proceed to Safe Destination")', finalBtn => {
                    console.log("Clicking Proceed to Safe Destination...");
                    setTimeout(() => finalBtn.closest("button").click(), 500);

                    // Step 5: Final button (id="access-offers") with 1.5s delay
                    waitForElement('#access-offers', lastBtn => {
                        console.log("Clicking Final Go To Destination...");
                        setTimeout(() => lastBtn.click(), 1500);
                    });
                });
            });
        });
    });

    // Add support for :contains since querySelector doesn’t support it natively
    (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 annoying done-banner-container if it appears
    const observer = new MutationObserver(() => {
        const banner = document.querySelector('.done-banner-container');
        if (banner) {
            console.log("Removing done-banner-container...");
            banner.remove();
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

})();

QingJ © 2025

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