Initial Hex Mines fork with hex tiles and mine-count slider.
Based on StefanOltmann/mines (AGPL-3.0): flat-top hex grid, configurable board size, and a mine-count slider replacing fixed difficulty presets. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mines</title>
|
||||
<link rel="icon" href="icon.ico" type="image/x-icon">
|
||||
<link rel="apple-touch-icon" href="icon_114.png">
|
||||
<link rel="icon" type="image/png" sizes="256x256" href="icon_256.png">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="icon_512.png">
|
||||
<link type="text/css" rel="stylesheet" href="styles.css">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<meta name="color-scheme" content="dark">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="loader">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
/*
|
||||
* Register service worker for offline functionality
|
||||
*/
|
||||
if ('serviceWorker' in navigator) {
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
|
||||
/*
|
||||
* Check if we're in development mode by looking for webpack dev server
|
||||
*/
|
||||
const isDevelopment = window.location.hostname === 'localhost' ||
|
||||
window.location.hostname === '127.0.0.1' ||
|
||||
window.location.port !== '';
|
||||
|
||||
if (isDevelopment) {
|
||||
|
||||
/*
|
||||
* In development mode, unregister any existing service workers to prevent infinite loops
|
||||
*/
|
||||
|
||||
console.log('Development mode detected, not registering service worker');
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
for (let registration of registrations) {
|
||||
registration.unregister();
|
||||
console.log('Unregistered service worker in development mode');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* Only register service worker in production mode
|
||||
*/
|
||||
|
||||
navigator.serviceWorker.register('./service-worker.js', {updateViaCache: 'none'})
|
||||
.then(registration => {
|
||||
|
||||
console.log('Service Worker registered with scope:', registration.scope);
|
||||
|
||||
/*
|
||||
* Check for updates on page load
|
||||
*/
|
||||
registration.update();
|
||||
|
||||
/*
|
||||
* Don't let the service worker control the page on first load
|
||||
* This prevents refresh loops in production mode
|
||||
*/
|
||||
if (registration.active) {
|
||||
|
||||
if (!navigator.serviceWorker.controller) {
|
||||
console.log('Service worker is active but not controlling the page');
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Service Worker registration failed:', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<footer>
|
||||
<!-- The app.js script is placed in the footer to ensure the loader displays as quickly as possible. -->
|
||||
<script type="application/javascript" src="app.js"></script>
|
||||
</footer>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user