您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Kontrola gestów mobilnych w The West
// ==UserScript== // @name The West - Mobile Controls // @namespace http://tampermonkey.net/ // @version 3.5 // @description Kontrola gestów mobilnych w The West // @author DK // @include https://*.the-west.*/game.php* // @grant none // ==/UserScript== (function() { 'use strict'; // Style CSS const style = document.createElement('style'); style.textContent = ` * { touch-action: manipulation; } body { overscroll-behavior-y: none; -webkit-user-select: none; -webkit-touch-callout: none; } `; document.head.appendChild(style); // Kontrola klawiatury i autofocus function handleInputs() { const inputs = document.querySelectorAll('input, textarea, [contenteditable]'); inputs.forEach(input => { // Początkowa blokada if (!input.hasAttribute('data-handled')) { input.setAttribute('data-handled', 'true'); input.setAttribute('readonly', 'readonly'); input.removeAttribute('autofocus'); // Odblokuj przy kliknięciu input.addEventListener('touchstart', function(e) { this.removeAttribute('readonly'); setTimeout(() => this.focus(), 100); // Opóźnione focusowanie }, { passive: false }); // Odblokuj przy kliknięciu myszką (dla testów na PC) input.addEventListener('mousedown', function(e) { this.removeAttribute('readonly'); }); } }); } // Obserwator dla nowych elementów const observer = new MutationObserver(() => handleInputs()); observer.observe(document.body, { childList: true, subtree: true }); // Blokada double-tap let lastTap = 0; document.addEventListener('touchend', function(event) { const currentTime = new Date().getTime(); const tapLength = currentTime - lastTap; if (tapLength < 300 && tapLength > 0) { event.preventDefault(); } lastTap = currentTime; }); // Blokada podwójnego kliknięcia document.addEventListener('dblclick', function(e) { e.preventDefault(); }); // Blokada pull-to-refresh document.addEventListener('touchmove', function(e) { if (document.documentElement.scrollTop === 0) { e.preventDefault(); } }, { passive: false }); // Inicjalizacja handleInputs(); })();