PixelPlace.io - Copy Coordinates

Press B to copy "123x456" | Green smooth CMD bar style GUI

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

Advertisement:

// ==UserScript==
// @name         PixelPlace.io - Copy Coordinates
// @namespace    https://greasyfork.org/users/374503
// @version      1.0
// @description  Press B to copy "123x456" | Green smooth CMD bar style GUI
// @author       @luerxz (Discord)
// @match        https://pixelplace.io/*
// @grant        none
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js
// @run-at       document-end
// @license MIT
// ==/UserScript==
// To change the key, edit the "b" inside:
// if (e.key.toLowerCase() === 'b' && !e.ctrlKey && !e.altKey) {

(function () {
    'use strict';

    // ====================== GREEN CMD BAR STYLE GUI ======================
    function createGUI() {
        const gui = $(`
            <div id="pp-copy-gui" style="
                position: fixed;
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%);
                background: rgba(0, 20, 10, 0.85);
                border: 2px solid #00ff88;
                border-radius: 12px;
                padding: 12px 24px;
                color: #00ff88;
                font-family: 'Courier New', Courier, monospace;
                font-size: 16px;
                font-weight: bold;
                box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
                backdrop-filter: blur(8px);
                z-index: 9999999;
                opacity: 0;
                transition: all 0.6s ease;
                pointer-events: none;
                white-space: nowrap;
            ">
                <span>COPY COORDINATES → Press B</span>
                <div style="margin-top: 6px; font-size: 13px; opacity: 0.8;">
                    Current position: <span id="current-coords">waiting...</span>
                </div>
            </div>
        `);

        $('body').append(gui);

        // Smooth fade-in animation
        setTimeout(() => {
            gui.css({
                opacity: 1,
                transform: 'translateX(-50%) translateY(-10px)'
            });
        }, 800);

        // Fade out after 12 seconds (CMD bar style)
        setTimeout(() => {
            gui.css({
                opacity: 0,
                transform: 'translateX(-50%) translateY(20px)'
            });
            setTimeout(() => gui.remove(), 1000);
        }, 12000);
    }

    // ====================== B KEY - COPY COORDINATES ======================
    document.addEventListener('keydown', e => {
        if (e.key.toLowerCase() === 'b' && !e.ctrlKey && !e.altKey) {
            const coordsText = $('#coordinates').text().trim();
            if (coordsText && coordsText.includes(',')) {
                const [x, y] = coordsText.split(',').map(s => s.trim());
                const toCopy = `${x}x${y}`;

                navigator.clipboard.writeText(toCopy).then(() => {
                    showToast(`COPIED → ${toCopy}`, '#00ff88');
                    $('#current-coords').text(toCopy); // Update GUI
                }).catch(() => {
                    showToast('Copy failed', '#ff4444');
                });
            } else {
                showToast('Coordinates not found', '#ff4444');
            }
        }
    });

    // ====================== TOAST (CMD STYLE) ======================
    function showToast(text, color = '#00ff88') {
        const toast = $(`
            <div style="
                position: fixed;
                bottom: 80px;
                left: 50%;
                transform: translateX(-50%);
                background: rgba(0, 20, 10, 0.9);
                border: 2px solid ${color};
                border-radius: 10px;
                padding: 12px 28px;
                color: ${color};
                font-family: 'Courier New', Courier, monospace;
                font-size: 15px;
                font-weight: bold;
                box-shadow: 0 0 25px ${color}80;
                backdrop-filter: blur(6px);
                z-index: 99999999;
                opacity: 0;
                transition: all 0.5s ease;
            ">
                ${text}
            </div>
        `);

        $('body').append(toast);

        setTimeout(() => {
            toast.css({ opacity: 1, transform: 'translateX(-50%) translateY(-10px)' });
        }, 100);

        setTimeout(() => {
            toast.css({ opacity: 0, transform: 'translateX(-50%) translateY(20px)' });
            setTimeout(() => toast.remove(), 600);
        }, 2200);
    }

    // ====================== INIT ======================
    $(() => {
        createGUI();
        showToast('Copy Coordinates → Press B to copy', '#00ff88');
        console.log('%cCoordinate Copy Loaded!', 'color:#00ff88;font-size:16px;font-weight:bold');
    });

})();