Wolf_ Karambit

Hide/show karambit

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         Wolf_ Karambit
// @match        *://kour.io/*
// @version      final
// @author       wolf_
// @description  Hide/show karambit
// @run-at       document-start
// @grant        none
// @namespace https://greasyfork.org/users/1598070
// ==/UserScript==

(function() {
    'use strict';

    const karambitVertices = [5808];
    let blockActive = true;
    let menuVisible = true;

    const hookContext = (ctx) => {
        if (!ctx) return;
        const originalDraw = ctx.drawElements;
        ctx.drawElements = function(mode, count, type, offset) {
            if (blockActive && karambitVertices.includes(count)) {
                return;
            }
            return originalDraw.call(this, mode, count, type, offset);
        };
    };

    const orgGetContext = HTMLCanvasElement.prototype.getContext;
    HTMLCanvasElement.prototype.getContext = function(type) {
        const ctx = orgGetContext.apply(this, arguments);
        if (type === 'webgl' || type === 'webgl2') {
            hookContext(ctx);
        }
        return ctx;
    };

    const ui = document.createElement('div');
    ui.id = "wolf-ui-simple";
    document.body.appendChild(ui);

    const style = document.createElement('style');
    style.innerHTML = `
        #wolf-ui-simple {
            position: fixed; top: 100px; right: 20px;
            background: rgba(15, 15, 15, 0.98);
            border: 1px solid #444; z-index: 1000000;
            border-radius: 6px; width: 180px;
            font-family: 'Segoe UI', sans-serif;
            color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
            display: ${menuVisible ? 'block' : 'none'};
        }
        .header {
            padding: 10px; text-align: center; cursor: move;
            font-weight: bold; background: #222; font-size: 13px;
            border-bottom: 1px solid #333; border-radius: 6px 6px 0 0;
            color: #eee;
        }
        .btn {
            width: calc(100% - 16px); margin: 8px 8px 4px 8px; background: #1a1a1a; color: #fff;
            border: 1px solid #333; padding: 10px; cursor: pointer; font-size: 11px;
            text-transform: uppercase; border-radius: 4px;
        }
        .info-text {
            text-align: center; font-size: 9px; color: #666; margin-bottom: 8px;
        }
        .active { color: #f44; font-weight: bold; }
        .inactive { color: #4f4; font-weight: bold; }
    `;
    document.head.appendChild(style);

    function render() {
        ui.style.display = menuVisible ? 'block' : 'none';
        ui.innerHTML = `
            <div class="header" id="drag-m">Wolf_</div>
            <button id="toggleK" class="btn">
                Karambit: <span class="${blockActive ? 'active' : 'inactive'}">${blockActive ? 'HIDDEN' : 'VISIBLE'}</span>
            </button>
            <div class="info-text">[G] to Open/Close</div>
        `;

        document.getElementById('toggleK').onclick = () => {
            blockActive = !blockActive;
            render();
        };

        const h = document.getElementById("drag-m");
        h.onmousedown = (e) => {
            let ox = e.clientX - ui.offsetLeft;
            let oy = e.clientY - ui.offsetTop;
            document.onmousemove = (m) => {
                ui.style.left = (m.clientX - ox) + "px";
                ui.style.top = (m.clientY - oy) + "px";
            };
            document.onmouseup = () => document.onmousemove = null;
        };
    }

    window.addEventListener('keydown', (e) => {
        if (e.key.toLowerCase() === 'g') {
            menuVisible = !menuVisible;
            render();
        }
    });

    render();
})();