Little Big Snake Custom Menu Mejorado

Menú personalizado con zoom slider, optimización de lag, y personalización de colores

目前為 2024-10-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Little Big Snake Custom Menu Mejorado
// @namespace    http://tampermonkey.net/
// @version      2024-08-17
// @description  Menú personalizado con zoom slider, optimización de lag, y personalización de colores
// @author       You
// @match        https://littlebigsnake.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    if (window.location.hostname !== 'littlebigsnake.com') return;

    const styles = `
        .custom-menu {
            position: fixed;
            top: 20px;
            left: 0;
            width: 300px;
            height: auto;
            background-color: rgba(255, 255, 255, 0.95); /* Fondo blanco predeterminado */
            color: #000; /* Texto negro */
            border: 5px solid #000; /* Borde predeterminado */
            transition: all 0.3s ease;
            transform: translateX(-100%);
            z-index: 9999;
            padding: 20px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
            border-radius: 15px;
            backdrop-filter: blur(5px);
        }

        .menu-title {
            text-align: center;
            margin-bottom: 20px;
            color: #4CAF50;
            font-size: 24px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        .option {
            margin: 15px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 10px;
        }

        .option span {
            font-size: 16px;
            font-weight: 500;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 34px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 26px;
            width: 26px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #4CAF50;
        }

        input:checked + .slider:before {
            transform: translateX(26px);
        }

        .color-picker {
            width: 100%;
            height: 40px;
            border: none;
            margin-top: 10px;
            cursor: pointer;
        }

        .zoom-slider {
            width: 100%;
            height: 10px;
            border-radius: 5px;
            background: #ccc;
            outline: none;
            -webkit-appearance: none;
        }

        .zoom-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #4CAF50;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .zoom-slider::-webkit-slider-thumb:hover {
            background: #45a049;
            transform: scale(1.1);
        }

        .zoom-value {
            text-align: center;
            margin-top: 5px;
            font-size: 14px;
            color: #4CAF50;
        }

        .menu-toggle-btn {
            position: fixed;
            top: 20px;
            left: 310px;
            z-index: 10000;
            padding: 12px 20px;
            border-radius: 10px;
            background-color: #4CAF50;
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
        }

        .menu-toggle-btn:hover {
            background-color: #45a049;
            transform: translateY(-2px);
        }
    `;

    const styleSheet = document.createElement("style");
    styleSheet.textContent = styles;
    document.head.appendChild(styleSheet);

    const menuHTML = `
        <div id="custom-menu" class="custom-menu">
            <h2 class="menu-title">Opciones de Juego</h2>
            <div class="option">
                <span>Zoom</span>
                <div style="width: 150px;">
                    <input type="range" id="zoomSlider" class="zoom-slider" min="50" max="150" value="100">
                    <div id="zoomValue" class="zoom-value">100%</div>
                </div>
            </div>
            <div class="option">
                <span>Ad Blocker</span>
                <label class="switch">
                    <input type="checkbox" id="adBlockerToggle">
                    <span class="slider"></span>
                </label>
            </div>
            <div class="option">
                <span>Reducir Lag</span>
                <label class="switch">
                    <input type="checkbox" id="lagReducerToggle">
                    <span class="slider"></span>
                </label>
            </div>
            <div class="option">
                <span>Borde RGB</span>
                <label class="switch">
                    <input type="checkbox" id="rgbBorderToggle">
                    <span class="slider"></span>
                </label>
                <input type="color" id="borderColorPicker" class="color-picker" value="#000000" disabled>
            </div>
            <div class="option">
                <span>Fondo del Menú</span>
                <input type="color" id="backgroundColorPicker" class="color-picker" value="#ffffff">
            </div>
        </div>
        <button id="menuToggle" class="menu-toggle-btn">Menú</button>
    `;

    document.body.insertAdjacentHTML('beforeend', menuHTML);

    // Funciones principales
    function toggleMenu() {
        const menu = document.getElementById('custom-menu');
        const isHidden = menu.style.transform === 'translateX(-100%)' || !menu.style.transform;
        menu.style.transform = isHidden ? 'translateX(0)' : 'translateX(-100%)';
    }

    // Cambiar color del borde del menú
    const rgbBorderToggle = document.getElementById('rgbBorderToggle');
    const borderColorPicker = document.getElementById('borderColorPicker');
    rgbBorderToggle.addEventListener('change', function() {
        borderColorPicker.disabled = !this.checked; // Habilitar/Deshabilitar selector de color
        if (!this.checked) {
            document.getElementById('custom-menu').style.border = '5px solid #000'; // Restaurar borde predeterminado
        }
    });
    borderColorPicker.addEventListener('input', function() {
        document.getElementById('custom-menu').style.border = `5px solid ${this.value}`; // Aplicar color de borde seleccionado
    });

    // Cambiar color del fondo del menú
    const backgroundColorPicker = document.getElementById('backgroundColorPicker');
    backgroundColorPicker.addEventListener('input', function() {
        document.getElementById('custom-menu').style.backgroundColor = this.value; // Aplicar color de fondo seleccionado
    });

    // Event Listener para el botón del menú
    document.getElementById('menuToggle').addEventListener('click', toggleMenu);
})();