☰

Minefun.io Ultimate Ping HUD v21

Pure centered network ping monitor for minefun.io. Press (=) to instantly update ping. Press CTRL or P for settings.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.sleazyfork.org/scripts/581790/1846426/Minefunio%20Ultimate%20Ping%20HUD%20v21.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Minefun.io Ultimate Ping HUD v21
// @namespace    http://tampermonkey.net/
// @version      21.0
// @description  Pure centered network ping monitor for minefun.io. Press (=) to instantly update ping. Press CTRL or P for settings.
// @author       YourName
// @license      MIT
// @match        *://minefun.io/*
// @match        *://*.minefun.io/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    // 1. إنشاء عداد البينج وتثبيته في أعلى المنتصف تماماً (Top Center)
    const hud = document.createElement('div');
    hud.id = 'minefun-hud-counter-v21';
    hud.style.position = 'fixed';
    hud.style.top = '10px';
    hud.style.left = '50%';
    hud.style.transform = 'translateX(-50%)'; 
    hud.style.padding = '6px 14px';
    hud.style.background = 'rgba(0, 0, 0, 0.85)';
    hud.style.color = '#00FF00';
    hud.style.fontFamily = 'monospace';
    hud.style.fontSize = '15px'; 
    hud.style.fontWeight = 'bold';
    hud.style.zIndex = '2147483647'; 
    hud.style.borderRadius = '5px';
    hud.style.border = '1px solid #00FF00';
    hud.style.pointerEvents = 'none'; 
    hud.style.transition = 'transform 0.1s ease'; 
    hud.innerHTML = '🌐 PING: -- ms';

    // 2. إنشاء لوحة التحكم (Settings)
    const settingsMenu = document.createElement('div');
    settingsMenu.style.position = 'fixed';
    settingsMenu.style.top = '50%';
    settingsMenu.style.left = '50%';
    settingsMenu.style.transform = 'translate(-50%, -50%)';
    settingsMenu.style.background = '#111';
    settingsMenu.style.color = '#fff';
    settingsMenu.style.padding = '20px';
    settingsMenu.style.borderRadius = '10px';
    settingsMenu.style.border = '2px solid #00FF00';
    settingsMenu.style.boxShadow = '0 0 20px rgba(0,255,0,0.6)';
    settingsMenu.style.fontFamily = 'sans-serif';
    settingsMenu.style.zIndex = '2147483647'; 
    settingsMenu.style.display = 'none'; 
    settingsMenu.style.textAlign = 'center';

    settingsMenu.innerHTML = `
        <h3 style="margin-top:0; color:#00FF00;">⚙️ PING SETTINGS</h3>
        <div style="display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-bottom:15px;">
            <button id="btn-tc" style="padding:6px; cursor:pointer; background:#222; color:#fff; border:1px solid #555;">Top Center</button>
            <button id="btn-tr" style="padding:6px; cursor:pointer; background:#222; color:#fff; border:1px solid #555;">Top Right</button>
            <button id="btn-tl" style="padding:6px; cursor:pointer; background:#222; color:#fff; border:1px solid #555;">Top Left</button>
            <button id="btn-br" style="padding:6px; cursor:pointer; background:#222; color:#fff; border:1px solid #555;">Bottom Right</button>
        </div>
        <button id="btn-toggle-hud" style="padding:8px; cursor:pointer; background:#00FF00; color:#000; border:none; font-weight:bold; border-radius:5px; width:100%;">SHOW / HIDE HUD</button>
        <p style="font-size:11px; color:#aaa; margin-top:10px;">Press <b>=</b> to update Ping instantly</p>
    `;

    // حقن العناصر
    const injectElements = () => {
        if (!document.getElementById('minefun-hud-counter-v21')) {
            (document.body || document.documentElement).appendChild(hud);
            (document.body || document.documentElement).appendChild(settingsMenu);
        }
    };
    setInterval(injectElements, 1000);

    // برمجة الأزرار
    function resetPosition() {
        hud.style.top = 'auto'; hud.style.bottom = 'auto';
        hud.style.left = 'auto'; hud.style.right = 'auto';
        hud.style.transform = 'none';
    }
    settingsMenu.querySelector('#btn-tc').addEventListener('click', () => { resetPosition(); hud.style.top = '10px'; hud.style.left = '50%'; hud.style.transform = 'translateX(-50%)'; });
    settingsMenu.querySelector('#btn-tr').addEventListener('click', () => { resetPosition(); hud.style.top = '10px'; hud.style.right = '10px'; });
    settingsMenu.querySelector('#btn-tl').addEventListener('click', () => { resetPosition(); hud.style.top = '10px'; hud.style.left = '10px'; });
    settingsMenu.querySelector('#btn-br').addEventListener('click', () => { resetPosition(); hud.style.bottom = '10px'; hud.style.right = '10px'; });
    settingsMenu.querySelector('#btn-toggle-hud').addEventListener('click', () => {
        hud.style.display = hud.style.display === 'none' ? 'block' : 'none';
    });

    // 3. دالة فحص البينج
    let currentPing = 0;
    let isChecking = false;

    function checkPing() {
        if (isChecking) return; 
        isChecking = true;
        
        const startTime = performance.now();
        const img = new Image();
        img.src = "https://minefun.io/favicon.ico?t=" + startTime;
        img.onload = img.onerror = () => {
            currentPing = Math.round(performance.now() - startTime);
            updateHUD();
            isChecking = false;
        };
    }
    setInterval(checkPing, 4000);
    checkPing();

    // 4. الاختصارات
    window.addEventListener('keydown', (e) => {
        if (e.key === '=') {
            checkPing(); 
            if (hud.style.left === '50%') {
                hud.style.transform = 'translateX(-50%) scale(1.1)';
                setTimeout(() => hud.style.transform = 'translateX(-50%) scale(1)', 100);
            } else {
                hud.style.transform = 'scale(1.1)'; 
                setTimeout(() => hud.style.transform = 'scale(1)', 100);
            }
        }
        if (e.key === 'Control' || e.key.toLowerCase() === 'p') {
            settingsMenu.style.display = settingsMenu.style.display === 'none' ? 'block' : 'none';
        }
    }, true);

    function updateHUD() {
        hud.innerHTML = `🌐 PING: ${currentPing} ms`;
        if (typeof currentPing === 'number' && currentPing > 120) {
            hud.style.borderColor = '#FF0000'; hud.style.color = '#FF0000';
        } else {
            hud.style.borderColor = '#00FF00'; hud.style.color = '#00FF00';
        }
    }
})();