ANTON App ZAYNE SCRIPT

A collection of modules for the Anton App put into one script. This is not finished at all and will likely get you banned. I am not responsible if you do.

目前为 2025-04-04 提交的版本。查看 最新版本

// ==UserScript==
// @name ANTON App ZAYNE SCRIPT
// @namespace http://tampermonkey.net/
// @version 0.2.4.2
// @description A collection of modules for the Anton App put into one script. This is not finished at all and will likely get you banned. I am not responsible if you do.
// @author @ccm1rza
// @match https://www.tampermonkey.net/index.php?ext=dhdg&updated=true&version=5.1.1
// @icon https://salrn.github.io/publicfiles/rs.png
// @grant none
// @match        https://anton.app/*
// @match        https://www.anton.app/*
// @exclude ://sjs7.xyz/scripttest/tapermonkey/arav
// @license MIT
// ==/UserScript==

(function() {
// Styles
const styles = `
.zui {
    position: fixed;
    right: 10px;
    top: 10px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    font-family: monospace;
    font-size: 14px;
    color: #fff;
    width: 250px;
    user-select: none;
    border: 2px solid #000;
    cursor: move;
    background: #000;
    overflow: hidden;
    padding: 5px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.zui-item {
    padding: 5px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    cursor: pointer;
}
.zui-item:hover {
    background: #111;
}
.zui-header {
    background: #000;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.zui-header span {
    font-size: 16px;
}
.zui-header:hover {
    background: #111;
}
.zui-content {
    height: 0;
    overflow: hidden;
}
`;

// Add styles immediately
const styleEl = document.createElement('style');
styleEl.textContent = styles;
document.head.appendChild(styleEl);

// Store gui element globally to reference it later
let gui = null;
let guiCheckInterval = null;
let guiCreationAttempts = 0;
const MAX_CREATION_ATTEMPTS = 10;
const guiId = "zayne-gui-" + Math.random().toString(36).substring(2, 10);

// Function to create and attach the GUI
function createAndAttachGUI() {
    // Check if GUI already exists in DOM
    if (document.getElementById(guiId)) {
        return document.getElementById(guiId);
    }
    
    const guiEl = document.createElement('div');
    guiEl.className = 'zui';
    guiEl.id = guiId;
    guiEl.innerHTML = `
        <div class="zui-item zui-header">
            <span>[/] zayne 0.2.4.1</span>
            <span class="zui-item-value">[close]</span>
        </div>
        <div class="zui-content">
            <div class="zui-item">
                <input type="number" id="coinInput" placeholder="Enter coins ! WILL GET YOU BANNED !" style="width: 100%;">
            </div>
            <div class="zui-item" id="addCoinsButton">
                <span>Add Coins ! BANNABLE !</span>
            </div>
            <div class="zui-item" id="completeLevel">
                <span>Complete Level</span>
            </div>
        </div>
    `;

    const headerEl = guiEl.querySelector('.zui-header');
    const contentEl = guiEl.querySelector('.zui-content');
    const headerStatusEl = guiEl.querySelector('.zui-item-value');
    const addCoinsButton = guiEl.querySelector('#addCoinsButton');
    const coinInput = guiEl.querySelector('#coinInput');
    const completeLevelButton = guiEl.querySelector('#completeLevel');

    let isOpen = false;

    headerEl.onclick = function() {
        isOpen = !isOpen;
        animateHeight(contentEl, isOpen ? 100 : 0, 300);
        headerStatusEl.innerText = isOpen ? '[close]' : '[open]';
    };

    addCoinsButton.onclick = function() {
        const coins = parseInt(coinInput.value);
        if (!isNaN(coins)) {
            addCoins(coins);
        }
    };

    completeLevelButton.onclick = function() {
        alert('Fail');
    };

    makeDraggable(guiEl, headerEl);

    document.body.appendChild(guiEl);

    fadeIn(guiEl, 300);
    return guiEl;
}

function setupKeyboardShortcuts() {
    window.addEventListener('keyup', function(event) {
        if (document.activeElement && document.activeElement.tagName === 'INPUT') return;

        if (event.code === 'Slash') {
            ensureGUIExists();
            if (gui) {
                gui.style.display = gui.style.display === 'none' ? '' : 'none';
            }
        }
    });
}

// Function to ensure GUI exists and is in the DOM
function ensureGUIExists() {
    let existingGui = document.getElementById(guiId);
    
    if (!existingGui && guiCreationAttempts < MAX_CREATION_ATTEMPTS) {
        guiCreationAttempts++;
        console.log(`[ZAYNE] Creating GUI (attempt ${guiCreationAttempts})`);
        gui = createAndAttachGUI();
        return true;
    } else if (existingGui) {
        gui = existingGui;
        return true;
    }
    
    return false;
}

// Start persistent monitoring to ensure GUI stays visible
function startPersistentGUIMonitoring() {
    // Initial setup - wait 10 seconds before first attempt
    setTimeout(() => {
        // Create the GUI
        ensureGUIExists();
        
        // Set up interval to check if GUI is still in DOM
        guiCheckInterval = setInterval(() => {
            let guiInDom = document.getElementById(guiId);
            
            if (!guiInDom && guiCreationAttempts < MAX_CREATION_ATTEMPTS) {
                console.log("[ZAYNE] GUI not found in DOM, recreating");
                gui = createAndAttachGUI();
            } else if (guiInDom) {
                // Reset attempts counter when GUI exists
                guiCreationAttempts = 0;
            }
        }, 2000); // Check every 2 seconds
    }, 10000); // Initial delay of 10 seconds
}

function easeOutQuad(t) {
    return t * (2 - t);
}

function animateHeight(element, targetHeight, duration) {
    let startHeight = element.clientHeight;
    let startTime = performance.now();

    function step(currentTime) {
        let elapsedTime = currentTime - startTime;
        let progress = Math.min(elapsedTime / duration, 1);
        let easedProgress = easeOutQuad(progress);

        element.style.height = (startHeight + (targetHeight - startHeight) * easedProgress) + "px";

        if (progress < 1) {
            requestAnimationFrame(step);
        }
    }

    requestAnimationFrame(step);
}
// Intro
function fadeIn(element, duration) {
    element.style.opacity = '0';
    let startTime = performance.now();

    function step(currentTime) {
        let elapsedTime = currentTime - startTime;
        let progress = Math.min(elapsedTime / duration, 1);
        let easedProgress = easeOutQuad(progress);

        element.style.opacity = easedProgress;

        if (progress < 1) {
            requestAnimationFrame(step);
        }
    }

    requestAnimationFrame(step);
}

function makeDraggable(element, dragHandle) {
    let isDragging = false;
    let offsetX = 0;
    let offsetY = 0;

    dragHandle.addEventListener('mousedown', (e) => {
        isDragging = true;
        offsetX = e.clientX - element.getBoundingClientRect().left;
        offsetY = e.clientY - element.getBoundingClientRect().top;
        document.addEventListener('mousemove', move);
        document.addEventListener('mouseup', stopDrag);
    });

    function move(e) {
        if (isDragging) {
            element.style.left = `${e.clientX - offsetX}px`;
            element.style.top = `${e.clientY - offsetY}px`;
        }
    }

    function stopDrag() {
        isDragging = false;
        document.removeEventListener('mousemove', move);
        document.removeEventListener('mouseup', stopDrag);
    }
}

function addCoins(coins) {
    try {
        const sourceId = localStorage.getItem('sourceId')?.split('"').join('');
        const deviceLogId = localStorage.getItem('deviceLogId')?.split('"').join('');
        const users = JSON.parse(localStorage.getItem('users') || '[]');

        if (!sourceId || !deviceLogId || users.length === 0) {
            alert("Required login data not found. Please make sure you're logged in.");
            return;
        }

        users.forEach(users__value => {
            fetch('https://logger-lb-5.anton.app/events', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    "events":[{
                        "event":"adjustCoins",
                        "value":coins,
                        "src":sourceId,
                        "created":(new Date()).toISOString()
                    }],
                    "log":users__value.l,
                    "credentials":{
                        "authToken":users__value.t,
                        "deviceLogId":deviceLogId
                    }
                }),
            })
            .then(v=>v)
            .catch(v=>v)
            .then(data => {
                window.location.reload();
            });
        });
    } catch (e) {
        console.error("[ZAYNE] Error adding coins:", e);
        alert("Failed to add coins. Error: " + e.message);
    }
}

// Set up keyboard shortcuts
setupKeyboardShortcuts();

// Start monitoring to ensure GUI stays in the DOM
startPersistentGUIMonitoring();

// Also listen for DOM changes that might affect our GUI
const observer = new MutationObserver((mutations) => {
    // If our GUI isn't in the DOM, recreate it
    if (!document.getElementById(guiId) && guiCreationAttempts < MAX_CREATION_ATTEMPTS) {
        guiCreationAttempts++;
        console.log("[ZAYNE] DOM changed, ensuring GUI exists (attempt " + guiCreationAttempts + ")");
        gui = createAndAttachGUI();
    }
});

// Start observing DOM changes after a delay
setTimeout(() => {
    console.log("[ZAYNE] Script is running...");
    observer.observe(document.body, { 
        childList: true, 
        subtree: true 
    });
}, 15000);

})();

QingJ © 2025

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