-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear-mobile-flag.html
More file actions
119 lines (110 loc) · 4.11 KB
/
clear-mobile-flag.html
File metadata and controls
119 lines (110 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clear Mobile Controls Flag</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 500px;
margin: 50px auto;
padding: 20px;
background: #f5f5f5;
}
.panel {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin: 20px 0;
}
button {
background: #007bff;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
margin: 5px;
}
button:hover {
background: #0056b3;
}
.danger { background: #dc3545; }
.danger:hover { background: #c82333; }
.success { background: #28a745; }
.success:hover { background: #218838; }
.status {
padding: 10px;
margin: 10px 0;
border-radius: 5px;
background: #e9ecef;
}
</style>
</head>
<body>
<h1>🔧 Mobile Controls Flag Manager</h1>
<div class="panel">
<h3>Current Status</h3>
<div id="status" class="status">Checking...</div>
<button onclick="checkStatus()">Refresh Status</button>
</div>
<div class="panel">
<h3>Actions</h3>
<button class="danger" onclick="clearFlag()">Clear Mobile Controls Flag</button>
<button onclick="setFlag()">Set Mobile Controls Flag</button>
<button class="danger" onclick="disableMobileControlsNow()">Disable Mobile Controls (Immediate)</button>
<button class="success" onclick="openGame()">Open Game</button>
</div>
<script>
function checkStatus() {
const forceMobile = localStorage.getItem('forceMobileControls');
const windowWidth = window.innerWidth;
const hasTouch = 'ontouchstart' in window;
const isMobileUA = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
document.getElementById('status').innerHTML = `
<strong>Force Mobile Flag:</strong> ${forceMobile || 'Not set'}<br>
<strong>Window Width:</strong> ${windowWidth}px<br>
<strong>Touch Support:</strong> ${hasTouch}<br>
<strong>Mobile User Agent:</strong> ${isMobileUA}<br>
<strong>Should Show Mobile Controls:</strong> ${
forceMobile === 'true' ? 'YES (Due to flag)' :
isMobileUA ? 'YES (Mobile device)' :
(hasTouch && windowWidth <= 768) ? 'YES (Touch + small screen)' :
'NO'
}
`;
}
function clearFlag() {
localStorage.removeItem('forceMobileControls');
alert('Mobile controls flag cleared! Refresh the game to see changes.');
checkStatus();
}
function setFlag() {
localStorage.setItem('forceMobileControls', 'true');
alert('Mobile controls flag set! Refresh the game to see mobile controls.');
checkStatus();
}
function openGame() {
window.open('./public/index.html', '_blank');
}
function disableMobileControlsNow() {
// Clear the flag
localStorage.removeItem('forceMobileControls');
// Try to disable in current window if game is loaded
try {
if (typeof window.disableMobileControls === 'function') {
window.disableMobileControls();
}
} catch (e) {
console.log('Game not loaded in this window');
}
alert('Mobile controls disabled! Open or refresh the game to see changes.');
checkStatus();
}
// Initialize
checkStatus();
</script>
</body>
</html>