You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Know Foolery - Offline</title>
<style>
body {
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
color: white;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.offline-container {
max-width: 500px;
padding: 2rem;
}
.offline-icon {
font-size: 4rem;
margin-bottom: 1rem;
opacity: 0.8;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
font-weight: 300;
}
p {
font-size: 1.1rem;
margin-bottom: 2rem;
opacity: 0.9;
line-height: 1.6;
}
.features {
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 1.5rem;
margin: 2rem 0;
backdrop-filter: blur(10px);
}
.features h3 {
margin-top: 0;
font-size: 1.2rem;
color: #fff;
}
.features ul {
list-style: none;
padding: 0;
margin: 0;
}
.features li {
padding: 0.5rem 0;
opacity: 0.9;
}
.features li::before {
content: "✓";
margin-right: 0.5rem;
color: #4caf50;
font-weight: bold;
}
.retry-button {
background: rgba(255, 255, 255, 0.2);
border: 2px solid white;
color: white;
padding: 0.75rem 2rem;
font-size: 1rem;
border-radius: 25px;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
margin-top: 1rem;
}
.retry-button:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
}
.status-indicator {
position: fixed;
top: 20px;
right: 20px;
background: rgba(244, 67, 54, 0.9);
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.9rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.status-indicator.online {
background: rgba(76, 175, 80, 0.9);
}
@media (max-width: 600px) {
.offline-container {
padding: 1rem;
}
h1 {
font-size: 1.5rem;
}
.offline-icon {
font-size: 3rem;
}
}
@keyframes pulse {
0% { opacity: 0.8; }
50% { opacity: 0.4; }
100% { opacity: 0.8; }
}
.pulse {
animation: pulse 2s infinite;
}
</style>
</head>
<body>
<div class="status-indicator" id="status">
<span id="status-icon">📶</span>
<span id="status-text">Checking connection...</span>
</div>
<div class="offline-container">
<div class="offline-icon pulse">🌐</div>
<h1>You're Offline</h1>
<p>Don't worry! Know Foolery works offline too. You can still enjoy many features while disconnected from the internet.</p>
<div class="features">
<h3>Available Offline:</h3>
<ul>
<li>Continue your current game session</li>
<li>Review cached questions and answers</li>
<li>Browse question themes</li>
<li>View your recent scores</li>
<li>Access game rules and help</li>
</ul>
</div>
<p>Your progress will be automatically synchronized when you're back online.</p>
<a href="/" class="retry-button" onclick="checkConnection()">Try Again</a>
</div>
<script>
// Check online status
function updateStatus() {
const statusEl = document.getElementById('status');
const statusIcon = document.getElementById('status-icon');
const statusText = document.getElementById('status-text');
if (navigator.onLine) {
statusEl.classList.add('online');
statusIcon.textContent = '🟢';
statusText.textContent = 'Back Online!';
// Auto-redirect after 2 seconds when back online
setTimeout(() => {
window.location.href = '/';
}, 2000);
} else {
statusEl.classList.remove('online');
statusIcon.textContent = '🔴';
statusText.textContent = 'Offline';
}
}
function checkConnection() {
if (navigator.onLine) {
window.location.href = '/';
}
return false;
}
// Listen for online/offline events
window.addEventListener('online', updateStatus);
window.addEventListener('offline', updateStatus);
// Initial status check
updateStatus();
// Periodically check connection
setInterval(updateStatus, 5000);
// Service worker registration check
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistration().then(registration => {
if (registration) {
console.log('Service Worker is registered');
// Try to sync when online
if (navigator.onLine && 'sync' in registration) {
registration.sync.register('background-sync');
}
}
});
}
</script>
</body>
</html>