Large Size X-Ray Toggle

Toggle dungeon transparency with large code size

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==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();

})();