Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Universal On-Screen Console & Pointer (v71 - Final Tuner Fix)
- // @namespace https://viayoo.com
- // @version 2025-06-27.71
- // @description Final Production Build. Fixed a bug where the speed tuner (key 5) could not be hidden after being shown. All features are stable.
- // @author Gemini & Vyacheslav
- // @match *://*/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // ===================================================================================
- // --- PART 1: IMMEDIATE HIJACK (Stable) ---
- // ===================================================================================
- let logBuffer = []; let uiReady = false; let _renderLogs = () => {};
- let _showCustomDialog = () => {};
- const originalConsole = { log: console.log, error: console.error, warn: console.warn, info: console.info, debug: console.debug };
- window.alert = (message) => { if(uiReady) _showCustomDialog({ type: 'alert', message }); };
- window.confirm = (message) => { return new Promise(resolve => uiReady ? _showCustomDialog({ type: 'confirm', message, resolve }) : resolve(false)); };
- window.prompt = (message, defaultValue = '') => { return new Promise(resolve => uiReady ? _showCustomDialog({ type: 'prompt', message, defaultValue, resolve }) : resolve(null)); };
- const hijack = (type, color) => { console[type] = function(...args) { let isFromPointerScript = args.length > 0 && args[args.length - 1] && args[args.length - 1].__fromPointerScript === true; if (isFromPointerScript) args.pop(); const source = isFromPointerScript ? 'script' : 'external'; const message = args.map(arg => { try { if (arg instanceof Error) return arg.stack || arg.message; if (arg && typeof arg === 'object') return JSON.stringify(arg); return String(arg); } catch (e) { return '[Unserializable Object]'; } }).join(' '); logBuffer.push({ message: `[${type.toUpperCase()}] ${message}`, color, source, timestamp: Date.now() }); if (logBuffer.length > 250) logBuffer.shift(); if (uiReady) { _renderLogs(); } if (originalConsole[type]) { originalConsole[type].apply(console, args); } }; };
- hijack('log', '#FFFFFF'); hijack('warn', '#FFD700'); hijack('error', '#FF6B6B'); hijack('info', '#61AFEF'); hijack('debug', '#BE50F4');
- window.addEventListener('error', (e) => { console.error(`Uncaught: ${e.message} at ${e.filename}:${e.lineno}`); });
- window.addEventListener('unhandledrejection', (e) => { console.error('Promise Rejection:', e.reason); });
- // ===================================================================================
- // --- PART 2: UI AND SCRIPT INITIALIZATION ---
- // ===================================================================================
- function initializeScript() {
- let debugConsole, consoleContent, scriptModeButton, allModeButton, tunerUI, tunerValueElement, consoleInputElement, pointer, modalOverlay;
- let consoleIsVisible = false, consoleDisplayMode = 'script', tunerIsVisible = false;
- let scriptActive, currentMode, isDragging, enterHoldStartTime, dragTarget, textInputMode, scrollTarget, escapeKeyPressed, currentPointerStyleIndex;
- const cursor = { x: window.innerWidth / 2, y: window.innerHeight / 2 }; const keysDown = {}; let lastFrameTime = performance.now();
- const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
- const SETTINGS = { POINTER_INITIAL_SPEED: 150, POINTER_TOP_SPEED: 900, POINTER_ACCELERATION_TIME: 800, CURSOR_SIZE: 24, ENTER_HOLD_THRESHOLD: 220, SCROLL_SPEED_INITIAL: 8, SCROLL_SPEED_MAX: 40, SCROLL_ACCELERATION_TIME: 1200, };
- const COLORS = { NORMAL: 'black', SCROLL: '#0EA5E9' };
- const POINTER_STYLES = [ { width: `${SETTINGS.CURSOR_SIZE}px`, height: `${SETTINGS.CURSOR_SIZE}px`, backgroundColor: 'rgba(255, 255, 255, 0.5)', border: '3px solid', baseBorderColor: COLORS.NORMAL, borderRadius: '50%', boxShadow: '0 2px 5px rgba(0,0,0,0.5)' }, { width: '12px', height: '12px', backgroundColor: 'rgba(255, 20, 20, 0.9)', border: '1px solid', baseBorderColor: 'rgba(255, 255, 255, 0.8)', borderRadius: '50%', boxShadow: '0 0 5px red' }, ];
- const scriptConsole = { info: (message) => console.info(message, { __fromPointerScript: true }) };
- function renderLogs() { if (!consoleContent) return; consoleContent.innerHTML = ''; const f = logBuffer.filter(l=>consoleDisplayMode==='all'||l.source==='script'); f.forEach(l=>{const e=document.createElement('div');e.textContent=l.message.startsWith('>') ? l.message : ` ${l.message}`;e.style.color=l.color;e.style.borderBottom='1px solid #333';e.style.padding='2px 5px';e.style.fontFamily='monospace';if(l.source==='external')e.style.opacity='0.7';consoleContent.appendChild(e);}); consoleContent.scrollTop = consoleContent.scrollHeight; }
- _renderLogs = renderLogs;
- function createDebugUI() {
- if(document.getElementById('gm-debug-console'))return;
- debugConsole=document.createElement('div');debugConsole.id='gm-debug-console';Object.assign(debugConsole.style,{position:'fixed',top:'10px',left:'10px',width:'calc(100% - 20px)',maxWidth:'800px',maxHeight:'50vh',backgroundColor:'rgba(20,20,20,0.95)',color:'white',fontFamily:'monospace',fontSize:'13px',zIndex:'2147483647',border:'1px solid #555',display:'none',flexDirection:'column',boxShadow:'0 5px 15px rgba(0,0,0,0.5)'});
- const h=document.createElement('div');Object.assign(h.style,{padding:'8px',borderBottom:'1px solid #444',display:'flex',gap:'10px',alignItems:'center',backgroundColor:'rgba(40,40,40,0.9)'});
- scriptModeButton=document.createElement('button');scriptModeButton.textContent='Script Logs';allModeButton=document.createElement('button');allModeButton.textContent='All Logs';
- [scriptModeButton,allModeButton].forEach(b=>{Object.assign(b.style,{background:'transparent',border:'1px solid #718096',color:'white',padding:'4px 10px',borderRadius:'4px',cursor:'pointer',fontFamily:'sans-serif',fontSize:'12px'});h.appendChild(b);});
- scriptModeButton.addEventListener('click',e=>{e.stopPropagation();consoleDisplayMode='script';updateConsoleModeButtons();renderLogs();});
- allModeButton.addEventListener('click',e=>{e.stopPropagation();consoleDisplayMode='all';updateConsoleModeButtons();renderLogs();});
- consoleContent=document.createElement('div');Object.assign(consoleContent.style,{padding:'8px',overflowY:'scroll',flexGrow:'1',wordWrap:'break-word',whiteSpace:'pre-wrap'});
- const consoleInputWrapper = document.createElement('div');
- Object.assign(consoleInputWrapper.style, { display: 'flex', alignItems: 'center', padding: '4px 8px', borderTop: '1px solid #444', backgroundColor: 'rgba(0,0,0,0.3)' });
- const prompt = document.createElement('span');prompt.textContent = '>';Object.assign(prompt.style, { marginRight: '8px', color: '#61AFEF', userSelect:'none' });
- consoleInputElement = document.createElement('input');consoleInputElement.id = 'gm-console-input'; consoleInputElement.type = 'text';consoleInputElement.placeholder = 'Click to activate...';
- Object.assign(consoleInputElement.style, { flexGrow: '1', background: 'transparent', border: 'none', color: 'white', fontFamily: 'monospace', fontSize: '14px', outline: 'none' });
- consoleInputElement.addEventListener('keydown', async (e) => {
- if (e.key === 'Enter') {
- e.preventDefault(); const command = consoleInputElement.value.trim(); if (!command) return;
- consoleInputElement.placeholder = 'Execute JavaScript...';
- logBuffer.push({ message: `> ${command}`, color: '#FFFFFF', source: 'script', timestamp: Date.now() });
- renderLogs();
- try { const executor = new AsyncFunction(command); const result = await executor.call(window); if (result !== undefined) { const resultString = JSON.stringify(result, null, 2); logBuffer.push({ message: `⇐ ${resultString}`, color: '#BE50F4', source: 'script', timestamp: Date.now() }); }
- } catch (error) { logBuffer.push({ message: `[EXECUTION ERROR] ${error.stack || error.message}`, color: '#FF6B6B', source: 'script', timestamp: Date.now() }); }
- consoleInputElement.value = ''; renderLogs();
- exitTextInputMode(true);
- }
- });
- consoleInputWrapper.appendChild(prompt); consoleInputWrapper.appendChild(consoleInputElement);
- debugConsole.appendChild(h); debugConsole.appendChild(consoleContent); debugConsole.appendChild(consoleInputWrapper);
- document.body.appendChild(debugConsole);
- };
- function createModalOverlay() { if (document.getElementById('gm-modal-overlay')) return; modalOverlay = document.createElement('div'); modalOverlay.id = 'gm-modal-overlay'; Object.assign(modalOverlay.style, { position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', zIndex: '2147483648', display: 'none', justifyContent: 'center', alignItems: 'center', backgroundColor: 'rgba(0,0,0,0.6)'}); document.body.appendChild(modalOverlay); }
- function showCustomDialog({ type, message, defaultValue, resolve }) {
- modalOverlay.innerHTML = '';
- modalOverlay.appendChild(pointer);
- const dialog = document.createElement('div');
- Object.assign(dialog.style, { background: '#2d3748', color: 'white', padding: '20px', borderRadius: '8px', boxShadow: '0 5px 20px rgba(0,0,0,0.4)', border: '1px solid #4A5568', minWidth: '300px', maxWidth: '500px', zIndex: '1' });
- const messageEl = document.createElement('p');
- messageEl.textContent = message;
- Object.assign(messageEl.style, { margin: '0 0 15px 0', whiteSpace: 'pre-wrap', wordWrap: 'break-word' });
- dialog.appendChild(messageEl);
- let inputEl, okButton, cancelButton;
- const buttonContainer = document.createElement('div');
- Object.assign(buttonContainer.style, { display: 'flex', justifyContent: 'flex-end', gap: '10px', marginTop: '10px' });
- const cleanup = () => { modalOverlay.style.display = 'none'; document.body.appendChild(pointer); if (textInputMode && document.activeElement && document.activeElement.id.startsWith('gm-dialog-input')) { exitTextInputMode(true); } };
- okButton = document.createElement('button'); okButton.textContent = 'OK'; okButton.id = `gm-dialog-ok-${Date.now()}`;
- Object.assign(okButton.style, { padding: '8px 16px', border: 'none', borderRadius: '4px', cursor: 'pointer', background: '#3182CE' });
- if (type === 'prompt') {
- inputEl = document.createElement('input'); inputEl.id = `gm-dialog-input-${Date.now()}`;
- Object.assign(inputEl.style, { width: 'calc(100% - 20px)', padding: '8px', background: '#1A202C', border: '1px solid #4A5568', borderRadius: '4px', color: 'white', marginBottom: '10px' });
- inputEl.value = defaultValue || '';
- dialog.appendChild(inputEl);
- }
- if (type === 'confirm' || type === 'prompt') {
- cancelButton = document.createElement('button'); cancelButton.textContent = 'Cancel';
- cancelButton.id = `gm-dialog-cancel-${Date.now()}`;
- Object.assign(cancelButton.style, { padding: '8px 16px', border: 'none', borderRadius: '4px', cursor: 'pointer', background: '#4A5568' });
- buttonContainer.appendChild(cancelButton);
- }
- buttonContainer.appendChild(okButton);
- dialog.appendChild(buttonContainer);
- modalOverlay.appendChild(dialog);
- okButton.addEventListener('click', () => { if (type === 'prompt') resolve(inputEl.value); else if (type === 'confirm') resolve(true); cleanup(); });
- if (cancelButton) { cancelButton.addEventListener('click', () => { if (type === 'prompt') resolve(null); else if (type === 'confirm') resolve(false); cleanup(); }); }
- if (type === 'alert') { const t = setTimeout(cleanup, 7000); okButton.addEventListener('click', () => clearTimeout(t)); }
- modalOverlay.style.display = 'flex';
- if (type === 'prompt') { textInputMode = true; inputEl.focus(); }
- }
- _showCustomDialog = showCustomDialog;
- const updateConsoleModeButtons = () => { if (!scriptModeButton || !allModeButton) return; const a={backgroundColor:'#4A5568',borderColor:'#A0AEC0'},i={backgroundColor:'transparent',borderColor:'#718096'};Object.assign(scriptModeButton.style,consoleDisplayMode==='script'?a:i);Object.assign(allModeButton.style,consoleDisplayMode==='all'?a:i); };
- const toggleConsole = () => { consoleIsVisible = !consoleIsVisible; if (debugConsole) { debugConsole.style.display = consoleIsVisible ? 'flex' : 'none'; } if (consoleIsVisible) { renderLogs(); } };
- function createTunerUI() { if(document.getElementById('gm-tuner-ui'))return;tunerUI=document.createElement('div');tunerUI.id='gm-tuner-ui';Object.assign(tunerUI.style,{position:'fixed',top:'20px',left:'50%',transform:'translateX(-50%)',display:'none',alignItems:'center',gap:'20px',backgroundColor:'rgba(0,0,0,0.7)',color:'white',fontFamily:'sans-serif',padding:'10px 20px',borderRadius:'8px',zIndex:'2147483647',border:'1px solid #555'});const l=document.createElement('div');l.textContent='<';const r=document.createElement('div');r.textContent='>';tunerValueElement=document.createElement('div');[l,r].forEach(a=>Object.assign(a.style,{fontSize:'24px',fontWeight:'bold',cursor:'pointer'}));Object.assign(tunerValueElement.style,{fontSize:'18px',minWidth:'80px',textAlign:'center'});tunerUI.appendChild(l);tunerUI.appendChild(tunerValueElement);tunerUI.appendChild(r);document.body.appendChild(tunerUI);}
- const toggleTuner = () => { tunerIsVisible = !tunerIsVisible; if (tunerUI) tunerUI.style.display = tunerIsVisible ? 'flex' : 'none'; };
- function saveState() { sessionStorage.setItem('gm-pointer-active', JSON.stringify(scriptActive)); sessionStorage.setItem('gm-console-visible', JSON.stringify(consoleIsVisible)); if(consoleIsVisible) { sessionStorage.setItem('gm-console-logs', JSON.stringify(logBuffer)); sessionStorage.setItem('gm-console-mode', consoleDisplayMode); } }
- function loadState() { const wasPointerActive = sessionStorage.getItem('gm-pointer-active'); scriptActive = wasPointerActive === null ? true : JSON.parse(wasPointerActive); const wasConsoleVisible = sessionStorage.getItem('gm-console-visible') === 'true'; if (wasConsoleVisible) { consoleIsVisible = true; const savedLogs = sessionStorage.getItem('gm-console-logs'); if (savedLogs) { try { const parsedLogs = JSON.parse(savedLogs); if (Array.isArray(parsedLogs)) { logBuffer.splice(0, 0, ...parsedLogs); } } catch(e) { /* ignore */ } } consoleDisplayMode = sessionStorage.getItem('gm-console-mode') || 'script'; } }
- function createPointer() { pointer = document.createElement('div'); pointer.id = 'gm-pointer'; Object.assign(pointer.style, { position: 'fixed', top: '0px', left: '0px', zIndex: '2147483649', transform: 'translate(-50%, -50%)', transition: 'transform 0.1s ease-out, border-color 0.2s, background-color 0.2s, border-radius 0.2s, width 0.2s, height 0.2s, box-shadow 0.2s', pointerEvents: 'none' }); document.body.appendChild(pointer); }
- const updateUIVisibility = () => { if(!pointer) return; pointer.style.display = scriptActive ? 'block' : 'none'; const currentStyle = POINTER_STYLES[currentPointerStyleIndex]; let borderColor = currentStyle.baseBorderColor || COLORS.NORMAL; if (currentMode === 'scroll') { borderColor = COLORS.SCROLL; } pointer.style.borderColor = borderColor; };
- function applyPointerStyle() { if (!pointer) return; const style = POINTER_STYLES[currentPointerStyleIndex]; Object.assign(pointer.style, { width: style.width, height: style.height, backgroundColor: style.backgroundColor, border: style.border, borderRadius: style.borderRadius, boxShadow: style.boxShadow, }); updateUIVisibility(); }
- const dispatchMouseEvent = (type, target, options) => { if (!target) return; const eventOptions = { bubbles: true, cancelable: true, view: window, clientX: options.x, clientY: options.y, pointerType: 'mouse', isPrimary: true, button: options.button || 0, ...options }; target.dispatchEvent(new (typeof PointerEvent === 'function' ? PointerEvent : MouseEvent)(type, eventOptions)); };
- const clickAtPoint = (x, y) => {
- let elements = document.elementsFromPoint(x, y);
- let el = elements.find(e => e.id.startsWith('gm-dialog-') || e.id.startsWith('gm-console-') || e.isContentEditable || ['INPUT', 'TEXTAREA'].includes(e.tagName));
- if (!el) el = elements[0];
- if (!el) return;
- if (el.id.startsWith('gm-dialog-')) { if (el.tagName === 'BUTTON') el.click(); else if (el.tagName === 'INPUT' && !textInputMode) { textInputMode = true; el.focus(); } return; }
- if (el.id === 'gm-console-input') { textInputMode = true; el.focus(); el.placeholder='Execute JavaScript...'; return; }
- if (el.id.startsWith('gm-')) return;
- if (['INPUT', 'TEXTAREA'].includes(el.tagName) || el.isContentEditable) { textInputMode = true; el.focus(); return; }
- dispatchMouseEvent('mousedown', el, { x, y }); dispatchMouseEvent('mouseup', el, { x, y }); dispatchMouseEvent('click', el, { x, y });
- };
- const findScrollableParent = (element) => { if (!element) return null; let el = element; while (el && el !== document.body && el !== document.documentElement) { const style = window.getComputedStyle(el); if ((style.overflowY === 'scroll' || style.overflowY === 'auto' || style.overflowX === 'scroll' || style.overflowX === 'auto') && (el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth)) { return el; } el = el.parentElement; } return null; };
- const exitTextInputMode = (isSilent = false) => { textInputMode = false; if (document.activeElement && (document.activeElement.id === 'gm-console-input' || document.activeElement.id.startsWith('gm-dialog-input'))) { if (document.activeElement.id === 'gm-console-input') document.activeElement.placeholder = 'Click to activate...'; } if (document.activeElement) document.activeElement.blur(); };
- const updateTunerText = () => { if (tunerValueElement) tunerValueElement.textContent = `${SETTINGS.POINTER_ACCELERATION_TIME} ms`; };
- const gameLoop = () => { const now = performance.now(); const deltaTime = (now - lastFrameTime) / 1000.0; lastFrameTime = now; if (scriptActive && !textInputMode && !tunerIsVisible) { if (currentMode === 'pointer') { if (keysDown.Enter && !isDragging && (now - enterHoldStartTime > SETTINGS.ENTER_HOLD_THRESHOLD)) { isDragging = true; pointer.style.display = 'none'; dragTarget = document.elementsFromPoint(cursor.x, cursor.y).find(e => !e.id.startsWith('gm-')) || window; pointer.style.display = 'block'; dispatchMouseEvent('mousedown', dragTarget, { x: cursor.x, y: cursor.y }); } let moveX = 0, moveY = 0; for (const key in keysDown) { if (key === 'Enter') continue; const rampFactor = Math.min(1, (now - (keysDown[key] || now)) / SETTINGS.POINTER_ACCELERATION_TIME); const currentSpeed = SETTINGS.POINTER_INITIAL_SPEED + (SETTINGS.POINTER_TOP_SPEED - SETTINGS.POINTER_INITIAL_SPEED) * rampFactor; if (key === 'ArrowUp') moveY -= currentSpeed; if (key === 'ArrowDown') moveY += currentSpeed; if (key === 'ArrowLeft') moveX -= currentSpeed; if (key === 'ArrowRight') moveX += currentSpeed; } cursor.x += moveX * deltaTime; cursor.y += moveY * deltaTime; if (isDragging) { dispatchMouseEvent('mousemove', dragTarget, { x: cursor.x, y: cursor.y }); } cursor.x = Math.max(0, Math.min(window.innerWidth, cursor.x)); cursor.y = Math.max(0, Math.min(window.innerHeight, cursor.y)); } else if (currentMode === 'scroll') { const target = scrollTarget || window; for (const key in keysDown) { if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) continue; const holdDuration = now - (keysDown[key] || now); const rampFactor = Math.min(1, holdDuration / SETTINGS.SCROLL_ACCELERATION_TIME); const currentSpeed = SETTINGS.SCROLL_SPEED_INITIAL + (SETTINGS.SCROLL_SPEED_MAX - SETTINGS.SCROLL_SPEED_INITIAL) * rampFactor; if (key === 'ArrowUp') target.scrollBy(0, -currentSpeed); if (key === 'ArrowDown') target.scrollBy(0, currentSpeed); if (key === 'ArrowLeft') target.scrollBy(-currentSpeed, 0); if (key === 'ArrowRight') target.scrollBy(currentSpeed, 0); } } if(pointer) pointer.style.transform = `translate(${cursor.x}px, ${cursor.y}px) translate(-50%, -50%) scale(${isDragging ? '0.8' : '1'})`; } requestAnimationFrame(gameLoop); };
- const handleKeyDown = (e) => {
- if (modalOverlay && modalOverlay.style.display === 'flex' && !textInputMode) {
- if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter'].includes(e.key)) {
- if (!keysDown[e.key]) { keysDown[e.key] = performance.now(); }
- } else { e.preventDefault(); e.stopImmediatePropagation(); }
- return;
- }
- if (e.key === '6') { escapeKeyPressed = true; e.preventDefault(); e.stopImmediatePropagation(); return; }
- if (consoleIsVisible && document.activeElement === consoleInputElement) return;
- if (e.key === '4') { e.preventDefault(); e.stopPropagation(); toggleConsole(); return; }
- if (e.key === '5') { e.preventDefault(); e.stopPropagation(); toggleTuner(); return; }
- if (tunerIsVisible) { if (e.key === 'ArrowLeft') { SETTINGS.POINTER_ACCELERATION_TIME = Math.max(100, SETTINGS.POINTER_ACCELERATION_TIME - 50); updateTunerText(); } else if (e.key === 'ArrowRight') { SETTINGS.POINTER_ACCELERATION_TIME = Math.min(2000, SETTINGS.POINTER_ACCELERATION_TIME + 50); updateTunerText(); } e.preventDefault(); e.stopPropagation(); return; }
- if (textInputMode) { if (['3', 'Escape'].includes(e.key)) { e.preventDefault(); e.stopPropagation(); exitTextInputMode(); } return; }
- if (e.key === '1') { e.preventDefault(); e.stopPropagation(); scriptActive = !scriptActive; updateUIVisibility(); return; }
- if (!scriptActive) return;
- if (e.key === '8') { e.preventDefault(); e.stopPropagation(); currentPointerStyleIndex = (currentPointerStyleIndex + 1) % POINTER_STYLES.length; applyPointerStyle(); return; }
- if (e.key === '2') { e.preventDefault(); e.stopPropagation(); currentMode = (currentMode === 'pointer') ? 'scroll' : 'pointer'; scrollTarget = findScrollableParent(document.elementFromPoint(cursor.x, cursor.y)); updateUIVisibility(); return; }
- if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter'].includes(e.key)) { e.preventDefault(); e.stopPropagation(); if (!keysDown[e.key]) { keysDown[e.key] = performance.now(); if (e.key === 'Enter') enterHoldStartTime = keysDown.Enter; } }
- };
- const handleKeyUp = (e) => {
- if (modalOverlay && modalOverlay.style.display === 'flex' && !textInputMode) { if (e.key === 'Enter') { clickAtPoint(cursor.x, cursor.y); } delete keysDown[e.key]; return; }
- if (e.key === '6') { escapeKeyPressed = false; }
- if (!scriptActive || textInputMode || tunerIsVisible) { delete keysDown[e.key]; return; }
- if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter'].includes(e.key)) { e.preventDefault(); e.stopPropagation(); if (e.key === 'Enter') { if (isDragging) { dispatchMouseEvent('mouseup', dragTarget, { x: cursor.x, y: cursor.y }); } else { clickAtPoint(cursor.x, cursor.y); } isDragging = false; dragTarget = null; } delete keysDown[e.key]; }
- };
- currentMode = 'pointer'; isDragging = false; enterHoldStartTime = 0; dragTarget = null; textInputMode = false; scrollTarget = null; escapeKeyPressed = false; currentPointerStyleIndex = 0;
- createDebugUI(); createTunerUI(); createPointer(); createModalOverlay();
- loadState();
- updateConsoleModeButtons(); updateTunerText(); applyPointerStyle();
- if (consoleIsVisible) { debugConsole.style.display = 'flex'; renderLogs(); }
- if (scriptActive) { updateUIVisibility(); }
- uiReady = true;
- scriptConsole.info("Universal Pointer & Console is ready.");
- setInterval(() => { if (document.activeElement && document.activeElement.tagName === 'IFRAME' && escapeKeyPressed) { window.focus(); escapeKeyPressed = false; } }, 100);
- document.addEventListener('keydown', handleKeyDown, true); document.addEventListener('keyup', handleKeyUp, true); window.addEventListener('beforeunload', saveState);
- requestAnimationFrame(gameLoop);
- }
- document.addEventListener('DOMContentLoaded', initializeScript, { once: true });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement