Muestra tu ping
// ==UserScript==
// @name Medidor de Ping
// @namespace http://tampermonkey.net/
// @version 1.3
// @description Muestra tu ping
// @author El_SR_exee
// @match *://*.minefun.io/*
// @license MIT
// @grant none
// ==/UserScript==
/*
MIT License
Copyright (c) 2026 El_SR_exee
*/
(function() {
'use strict';
let elementoPing = null;
// --- CREACIÓN DEL CARTEL DE PING (Centrado arriba) ---
const crearCartelPing = () => {
const cartel = document.createElement('div');
cartel.id = 'cartel-ping-exee';
cartel.innerText = 'Ping: ...';
// ESTILOS COMPACTOS Y CENTRADO ARRIBA
cartel.style.position = 'fixed';
cartel.style.top = '10px';
cartel.style.left = '50%';
cartel.style.transform = 'translateX(-50%)';
cartel.style.color = '#ffffff';
cartel.style.fontWeight = 'bold';
cartel.style.fontSize = '14px';
cartel.style.fontFamily = 'Arial, sans-serif';
cartel.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
cartel.style.padding = '4px 10px';
cartel.style.borderRadius = '4px';
cartel.style.zIndex = '99999';
cartel.style.pointerEvents = 'none';
document.body.appendChild(cartel);
elementoPing = cartel;
};
if (document.body) {
crearCartelPing();
} else {
window.addEventListener('DOMContentLoaded', crearCartelPing);
}
// --- FUNCIÓN PARA MEDIR EL PING ---
const medirPing = async () => {
const startTime = Date.now();
try {
await fetch('https://www.google.com/generate_204?id=' + Math.random(), {
mode: 'no-cors',
cache: 'no-store'
});
const ping = Date.now() - startTime;
actualizarCartel(ping);
} catch (error) {
if (elementoPing) {
elementoPing.innerText = 'Ping: Error';
elementoPing.style.color = '#ff0000';
}
}
};
// --- ACTUALIZAR TEXTO Y COLORES SEGÚN TU ESCALA ---
const actualizarCartel = (ms) => {
if (!elementoPing) return;
// CORREGIDO: Ahora dice solo "Ping: 83" sin el "ms" molestando
elementoPing.innerText = `Ping: ${ms}`;
// Tu escala exacta de colores:
if (ms >= 10 && ms <= 115) {
elementoPing.style.color = '#00ff00'; // Verde
}
else if (ms > 115 && ms <= 200) {
elementoPing.style.color = '#ffff00'; // Amarillo
}
else if (ms > 200 && ms <= 800) {
elementoPing.style.color = '#ffaa00'; // Naranja
}
else if (ms > 800) {
elementoPing.style.color = '#ff0000'; // Rojo
}
};
// Mide cada 2 segundos
medirPing();
setInterval(medirPing, 2000);
})();