Mobile Shift-Click Toggle

Adds a floating button to toggle Shift+Click for mobile/touch devices

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Mobile Shift-Click Toggle
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  Adds a floating button to toggle Shift+Click for mobile/touch devices
// @author       korphd
// @match        *://*/*
// @license       MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // State of our virtual Shift key
    let isShiftToggled = false;

    // --- 1. THE MAGIC TRICK ---
    // This overrides the browser's default event rules.
    // Whenever the game checks "event.shiftKey", it will read our toggle state instead!
    function overrideShiftKey(prototypeObject) {
        const originalDescriptor = Object.getOwnPropertyDescriptor(prototypeObject, 'shiftKey');
        if (!originalDescriptor) return;

        Object.defineProperty(prototypeObject, 'shiftKey', {
            get: function() {
                // If our button is ON, tell the game Shift is being pressed
                if (isShiftToggled) return true;
                // Otherwise, act normally
                return originalDescriptor.get.call(this);
            },
            configurable: true,
            enumerable: true
        });
    }

    // Apply the trick to Mouse, Pointer, and Touch events
    if (window.MouseEvent) overrideShiftKey(MouseEvent.prototype);
    if (window.PointerEvent) overrideShiftKey(PointerEvent.prototype);
    if (window.KeyboardEvent) overrideShiftKey(KeyboardEvent.prototype);


    // --- 2. THE UI BUTTON ---
    const toggleBtn = document.createElement('button');
    toggleBtn.id = 'mobile-shift-toggle-btn';
    toggleBtn.innerText = 'Shift: OFF';
    
    // Styling the floating button
    toggleBtn.style.cssText = `
        position: fixed;
        bottom: 20px;
        left: 20px; /* Placed on the left so it doesn't overlap your tracker */
        z-index: 999999;
        padding: 12px 18px;
        background-color: rgba(170, 0, 0, 0.4); /* Semi-transparent Red */
        color: white;
        border: 2px solid #fff;
        border-radius: 8px;
        font-family: Arial, sans-serif;
        font-size: 16px;
        font-weight: bold;
        box-shadow: 0 4px 6px rgba(0,0,0,0.5);
        cursor: pointer;
        user-select: none;
    `;

    document.body.appendChild(toggleBtn);

    // --- 3. BUTTON LOGIC ---
    function toggleShift(e) {
        // Prevent the game from registering you clicking the toggle button
        e.preventDefault();
        e.stopPropagation();

        isShiftToggled = !isShiftToggled;

        if (isShiftToggled) {
            toggleBtn.innerText = 'Shift: ON';
            toggleBtn.style.backgroundColor = 'rgba(0, 170, 0, 0.8)'; // Green
            toggleBtn.style.boxShadow = '0 0 15px rgba(0, 255, 0, 0.8)'; // Glow effect
        } else {
            toggleBtn.innerText = 'Shift: OFF';
            toggleBtn.style.backgroundColor = 'rgba(170, 0, 0, 0.8)'; // Red
            toggleBtn.style.boxShadow = '0 4px 6px rgba(0,0,0,0.5)';
        }
    }

    // We use 'pointerdown' instead of 'click' so it responds instantly on touchscreens
    // and intercepts the touch before the game registers it.
    toggleBtn.addEventListener('pointerdown', toggleShift);
    toggleBtn.addEventListener('click', (e) => e.stopPropagation());

})();