SwordMasters.io - Custom UI Panel

Panel kéo được + On/Off + Slider (UI only, safe)

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 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         SwordMasters.io - Custom UI Panel
// @namespace    https://greasyfork.org/
// @version      2.0
// @description  Panel kéo được + On/Off + Slider (UI only, safe)
// @match        https://swordmasters.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let value = 50;
    let isEnabled = false;

    const panel = document.createElement('div');
    panel.style.cssText = `
        position: fixed; left: 30px; top: 30px; z-index: 999999;
        background: rgba(0,0,0,0.85); color: white; padding: 15px;
        border-radius: 12px; font-family: Arial; width: 250px;
    `;

    panel.innerHTML = `
        <div style="font-weight:bold; margin-bottom:10px;">⚔️ Custom Panel</div>
        <div id="status">OFF</div>

        <input type="range" id="slider" min="1" max="100" value="${value}">
        <div>Value: <span id="val">${value}</span></div>

        <button id="btn">BẬT</button>
    `;

    document.body.appendChild(panel);

    const slider = panel.querySelector('#slider');
    const val = panel.querySelector('#val');
    const btn = panel.querySelector('#btn');
    const status = panel.querySelector('#status');

    slider.oninput = () => {
        value = slider.value;
        val.textContent = value;
    };

    btn.onclick = () => {
        isEnabled = !isEnabled;
        status.textContent = isEnabled ? "ON" : "OFF";
    };

    // drag
    let drag = false, x, y;

    panel.onmousedown = (e) => {
        drag = true;
        x = e.clientX - panel.offsetLeft;
        y = e.clientY - panel.offsetTop;
    };

    document.onmousemove = (e) => {
        if (drag) {
            panel.style.left = (e.clientX - x) + "px";
            panel.style.top = (e.clientY - y) + "px";
        }
    };

    document.onmouseup = () => drag = false;

})();