-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoffline.html
More file actions
198 lines (175 loc) · 4.82 KB
/
offline.html
File metadata and controls
198 lines (175 loc) · 4.82 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="./" />
<title>Offline - Mind Gym</title>
<link rel="icon" type="image/svg+xml" href="./assets/icon.svg" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
sans-serif;
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
color: white;
}
.container {
max-width: 500px;
text-align: center;
}
.icon {
font-size: 5rem;
margin-bottom: 1rem;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
font-weight: 700;
}
p {
font-size: 1.125rem;
line-height: 1.6;
margin-bottom: 1.5rem;
opacity: 0.9;
}
.tips {
background: rgba(255, 255, 255, 0.1);
border-radius: 0.75rem;
padding: 1.5rem;
margin-top: 2rem;
text-align: left;
}
.tips h2 {
font-size: 1.25rem;
margin-bottom: 0.75rem;
}
.tips ul {
list-style: none;
padding: 0;
}
.tips li {
padding: 0.5rem 0;
padding-left: 1.5rem;
position: relative;
}
.tips li::before {
content: '✓';
position: absolute;
left: 0;
font-weight: bold;
}
.btn-group {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
margin-top: 1rem;
}
.btn {
background: white;
color: #4f46e5;
border: none;
padding: 1rem 2rem;
border-radius: 0.5rem;
font-size: 1.125rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
text-decoration: none;
display: inline-block;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.btn:active {
transform: translateY(0);
}
.btn-secondary {
background: transparent;
color: white;
border: 2px solid white;
}
.status {
margin-top: 2rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 0.5rem;
font-size: 0.875rem;
opacity: 0.8;
}
</style>
</head>
<body>
<div class="container">
<div class="icon">📡</div>
<h1>You're Offline</h1>
<p id="message">
It looks like you've lost your internet connection. Don't worry - Mind Gym may still work if
you've visited it before!
</p>
<div class="btn-group">
<button class="btn" onclick="window.location.reload()">🔄 Try Again</button>
<a href="./" class="btn btn-secondary">🏠 Go Home</a>
</div>
<div class="tips">
<h2>Quick Tips:</h2>
<ul>
<li>Check your internet connection</li>
<li>If you've played before, try reloading - the game might be cached</li>
<li>Try disabling WiFi and using mobile data (or vice versa)</li>
<li>Clear browser cache if the game isn't loading</li>
</ul>
</div>
<div class="status" id="cache-status">Checking cache status...</div>
</div>
<script>
// Auto-retry when connection is restored
window.addEventListener('online', () => {
window.location.reload();
});
// Check cache status
if ('caches' in window) {
caches
.match('./index.html')
.then(cached => {
const statusEl = document.getElementById('cache-status');
const messageEl = document.getElementById('message');
if (cached) {
statusEl.textContent = '✅ Cached version available';
statusEl.style.background = 'rgba(34, 197, 94, 0.3)';
messageEl.textContent =
"You're offline, but a cached version of Mind Gym is available. You should be able to play!";
} else {
statusEl.textContent = '❌ No cached version found';
statusEl.style.background = 'rgba(239, 68, 68, 0.3)';
}
})
.catch(() => {
document.getElementById('cache-status').textContent = '⚠️ Unable to check cache';
});
}
</script>
</body>
</html>