PixelPlace.io - Copy Coordinates

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

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');
    });

})();