YsBypass

Bypasses all work.ink systems, VERY fast!

// ==UserScript==
// @name         YsBypass
// @namespace    Hi
// @version      1.1
// @description  Bypasses all work.ink systems, VERY fast!
// @author       YassinY01
// @match        https://*.work.ink/*
// @icon         https://www.svgrepo.com/show/524760/moon.svg
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    if (document.title === 'Just a moment...') return;

    if (window.location.hostname.includes("work.ink")) {
        let overlay = null;
        let statusText = null;
        let skipCount = 0;
        let isolated = false;
        let lastAction = Date.now();
        let stalled = false;
        let clickedFinal = false;
        let overlayVisible = true;

        const setupOverlay = () => {
            if (overlay) return;

            overlay = document.createElement('div');
            overlay.style.cssText = `
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.95);
                color: white;
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                z-index: 999999;
                font-family: Arial, sans-serif;
            `;

            const closeButton = document.createElement('div');
            closeButton.textContent = 'X';
            closeButton.style.cssText = `
                position: absolute;
                top: 15px;
                right: 15px;
                width: 35px;
                height: 35px;
                background: rgba(255, 255, 255, 0.1);
                border-radius: 50%;
                display: flex;
                justify-content: center;
                align-items: center;
                font-size: 18px;
                cursor: pointer;
            `;
            closeButton.onclick = () => {
                if (overlay && overlay.parentNode) {
                    overlay.parentNode.removeChild(overlay);
                    overlay = null;
                    statusText = null;
                    overlayVisible = false;
                }
            };

            const spinner = document.createElement('div');
            spinner.style.cssText = `
                width: 45px;
                height: 45px;
                border: 4px solid rgba(255, 255, 255, 0.3);
                border-radius: 50%;
                border-top-color: #10b981;
                animation: spin 1s linear infinite;
                margin-bottom: 15px;
            `;

            const text = document.createElement('div');
            text.textContent = 'Processing...';
            text.style.fontSize = '16px';

            statusText = document.createElement('div');
            statusText.textContent = 'Starting';
            statusText.style.marginTop = '8px';
            statusText.style.fontSize = '13px';
            statusText.style.color = '#ccc';

            const styleElem = document.createElement('style');
            styleElem.textContent = '@keyframes spin { to { transform: rotate(360deg); } }';

            overlay.appendChild(styleElem);
            overlay.appendChild(closeButton);
            overlay.appendChild(spinner);
            overlay.appendChild(text);
            overlay.appendChild(statusText);
            document.body.appendChild(overlay);
        };

        const removeOverlay = () => {
            if (overlay && overlay.parentNode) {
                overlay.parentNode.removeChild(overlay);
                overlay = null;
                statusText = null;
            }
        };

        const updateStatus = (message, showOverlay) => {
            if (showOverlay && !overlay) {
                setupOverlay();
            }

            if (statusText) {
                statusText.textContent = message;
            }
            lastAction = Date.now();
        };

        const checkStall = () => {
            const timeSinceAction = Date.now() - lastAction;

            if (timeSinceAction > 19000 && !stalled) {
                stalled = true;
                updateStatus('Taking too long - refreshing', true);

                setTimeout(() => {
                    window.location.reload();
                }, 1500);
            }
        };

        const selectors = [
            '.button-box .accessBtn',
            'button.closelabel',
            '.btn-access',
            '.access-button',
            'button[onclick*="access"]',
            '.btn-skip',
            '.skip-button',
            'button[onclick*="skip"]'
        ];

        const botClick = (element) => {
            if (!element || clickedFinal) return false;

            try {
                element.click();
                return true;
            } catch (e) {
                try {
                    const event = new MouseEvent('click', {
                        bubbles: true,
                        cancelable: true,
                        view: window
                    });
                    element.dispatchEvent(event);
                    return true;
                } catch (err) {
                    return false;
                }
            }
        };

        const scanAndClick = () => {
            let clickedSomething = false;

            selectors.forEach(sel => {
                const elements = document.querySelectorAll(sel);
                for (let i = 0; i < elements.length; i++) {
                    const elem = elements[i];
                    if (elem && elem.offsetParent !== null) {
                        if (botClick(elem)) {
                            clickedSomething = true;
                        }
                    }
                }
            });

            return clickedSomething;
        };

        const removeOverlays = () => {
            const overlaysToRemove = [
                'div.fixed.top-16.left-0.right-0.bottom-0.bg-white.z-40.overflow-y-auto',
                '.main-modal',
                '.popup-overlay',
                '.overlay',
                '.modal-backdrop',
                '.interstitial',
                '.ad-container'
            ];

            overlaysToRemove.forEach(sel => {
                try {
                    const elements = document.querySelectorAll(sel);
                    elements.forEach(elem => {
                        if (elem && elem.parentNode) {
                            elem.parentNode.removeChild(elem);
                        }
                    });
                } catch (e) {}
            });
        };

        const checkForDestination = () => {
            const destSelectors = [
                'button#access-offers.accessBtn',
                'a#access-offers',
                'button[onclick*="destination"]',
                'a[href*="destination"]'
            ];

            for (const sel of destSelectors) {
                const elem = document.querySelector(sel);
                if (elem) return elem;
            }

            // Check for text content
            const allElements = document.querySelectorAll('button, a');
            for (let i = 0; i < allElements.length; i++) {
                const elem = allElements[i];
                if (elem.textContent && elem.textContent.toLowerCase().includes("go to destination")) {
                    return elem;
                }
            }

            return null;
        };

        const forceClickDestination = (btn) => {
            if (!btn) return false;

            for (let i = 0; i < 3; i++) {
                if (botClick(btn)) {
                    return true;
                }

                try {
                    const rect = btn.getBoundingClientRect();
                    const clickEvent = new MouseEvent('click', {
                        bubbles: true,
                        cancelable: true,
                        view: window,
                        clientX: rect.left + rect.width / 2,
                        clientY: rect.top + rect.height / 2
                    });
                    btn.dispatchEvent(clickEvent);
                    return true;
                } catch (e) {}
            }

            return false;
        };

        const performBypass = () => {
            if (clickedFinal) return;

            checkStall();
            removeOverlays();

            if (scanAndClick()) {
                updateStatus('Processing page elements', true);
            }

            const skipBtn = document.querySelector('button.skipBtn');
            if (skipBtn && skipBtn.offsetParent !== null && skipCount < 4) {
                if (botClick(skipBtn)) {
                    skipCount++;
                    updateStatus(`Completed step ${skipCount} of 4`, true);
                }
            }

            const destBtn = checkForDestination();
            if (destBtn && !clickedFinal) {
                updateStatus('Destination found - processing', true);
                clickedFinal = true;

                if (forceClickDestination(destBtn)) {
                    updateStatus('Fetching info', true);
                } else {
                    updateStatus('Could not auto-click destination', true);

                    try {
                        const url = destBtn.getAttribute('href') ||
                                   destBtn.getAttribute('data-href') ||
                                   (destBtn.getAttribute('onclick') || '').match(/https?:\/\/[^'"]+/)?.[0];

                        if (url) {
                            window.location.href = url;
                        }
                    } catch (e) {}
                }

                setTimeout(removeOverlay, 800);
            }

            if (skipCount >= 4 && !isolated) {
                const accessBtn = document.querySelector('#access-offers.accessBtn');
                if (accessBtn) {
                    updateStatus('Finalizing access', true);
                    document.body.innerHTML = '';
                    document.body.style.cssText = `
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        height: 100vh;
                        background: white;
                    `;
                    document.body.appendChild(accessBtn);
                    accessBtn.style.cssText = `
                        font-size: 1.2rem;
                        padding: 1rem 2rem;
                        border-radius: 8px;
                        background-color: #10b981;
                        color: white;
                        border: none;
                        cursor: pointer;
                    `;
                    isolated = true;
                    removeOverlay();
                }
            }
        };

        const interval = setInterval(performBypass, 80);

        window.addEventListener('beforeunload', () => {
            clearInterval(interval);
        });

        setTimeout(() => {
            if (window.location.hostname.includes("work.ink")) {
                clearInterval(interval);
                removeOverlay();
                updateStatus('Done');
            }
        }, 40000);

        const observer = new MutationObserver((mutations) => {
            for (const mutation of mutations) {
                for (const node of mutation.addedNodes) {
                    if (node.nodeType === 1) {
                        if (node.querySelector && (
                            node.querySelector('[class*="captcha"]') ||
                            node.querySelector('[class*="verify"]') ||
                            node.querySelector('[class*="challenge"]')
                        )) {
                            updateStatus('Verification needed', false);
                            removeOverlay();
                        }
                    }
                }
            }
        });

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

        performBypass();
    }
})();