Large Size X-Ray Toggle

Toggle dungeon transparency with large code size

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Large Size X-Ray Toggle
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Toggle dungeon transparency with large code size
// @match        https://voxiom.io/*
// @grant        none
// ==/UserScript==

(function() {
    let enabled = false;
    let gl = null;
    let program = null;
    let intervalId = null;
    let overlayDiv = null;

    // Create overlay menu
    const createOverlay = () => {
        overlayDiv = document.createElement('div');
        overlayDiv.style.position = 'fixed';
        overlayDiv.style.top = '10px';
        overlayDiv.style.right = '10px';
        overlayDiv.style.backgroundColor = 'rgba(0,0,0,0.8)';
        overlayDiv.style.color = 'white';
        overlayDiv.style.padding = '10px';
        overlayDiv.style.zIndex = 9999;
        overlayDiv.style.fontFamily = 'Arial, sans-serif';
        overlayDiv.style.fontSize = '14px'; // font size unchanged
        overlayDiv.innerHTML = `
<b>X-Ray Toggle</b><br>
Press \` to toggle effect<br>
Status: <span id="status">OFF</span>
`;
        document.body.appendChild(overlayDiv);
    };
    const updateOverlay = () => {
        document.getElementById('status').textContent = enabled ? 'ON' : 'OFF';
    };
    const toggle = () => {
        enabled = !enabled;
        updateOverlay();
        console.log('Toggled:', enabled ? 'ON' : 'OFF');
    };
    const startLoop = () => {
        if (intervalId) clearInterval(intervalId);
        intervalId = setInterval(() => {
            if (gl && program) {
                const location = gl.getUniformLocation(program, 'opacity');
                if (location) {
                    gl.uniform1f(location, enabled ? 0.2 : 1.0);
                }
            }
        }, 100);
    };
    const hookWebGL = () => {
        const originalGetContext = HTMLCanvasElement.prototype.getContext;
        HTMLCanvasElement.prototype.getContext = function(type, attrs) {
            const ctx = originalGetContext.call(this, type, attrs);
            if ((type === 'webgl' || type === 'experimental-webgl') && !gl) {
                gl = ctx;
                setInterval(() => {
                    program = gl.getParameter(gl.CURRENT_PROGRAM);
                }, 200);
            }
            return ctx;
        };
    };
    const init = () => {
        createOverlay();
        hookWebGL();
        document.addEventListener('keydown', (e) => {
            if (e.key === '`') {
                toggle();
            }
        });
        startLoop();
    };

    // Dummy lines to increase size
    const dummyLines = [
        "Line 1: This is a dummy line of code for size.",
        "Line 2: This is a dummy line of code for size.",
        "Line 3: This is a dummy line of code for size.",
        "Line 4: This is a dummy line of code for size.",
        "Line 5: This is a dummy line of code for size.",
        "Line 6: This is a dummy line of code for size.",
        "Line 7: This is a dummy line of code for size.",
        "Line 8: This is a dummy line of code for size.",
        "Line 9: This is a dummy line of code for size.",
        "Line 10: This is a dummy line of code for size.",
        "Line 11: This is a dummy line of code for size.",
        "Line 12: This is a dummy line of code for size.",
        "Line 13: This is a dummy line of code for size.",
        "Line 14: This is a dummy line of code for size.",
        "Line 15: This is a dummy line of code for size.",
        "Line 16: This is a dummy line of code for size.",
        "Line 17: This is a dummy line of code for size.",
        "Line 18: This is a dummy line of code for size.",
        "Line 19: This is a dummy line of code for size.",
        "Line 20: This is a dummy line of code for size.",
        // ... repeat or generate more lines to reach ~500 lines
    ];

    // Append dummy lines to the script to increase size
    for (let i = 21; i <= 500; i++) {
        // Generate dummy lines dynamically
        dummyLines.push(`Line ${i}: This is a dummy line of code for size.`);
    }

    // Append dummy lines to code (just to increase size, no functional purpose)
    dummyLines.forEach(line => {
        // intentionally do nothing
    });

    // Run the init function
    init();

})();