Spaces:
Sleeping
Sleeping
Delete index.html
Browse files- index.html +0 -116
index.html
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
7 |
-
<meta name="description" content="Hangman Game - Gradio Interface">
|
8 |
-
<title>Hangman Game - Gradio Interface</title>
|
9 |
-
|
10 |
-
<!-- Caricamento ottimizzato del CSS -->
|
11 |
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
|
12 |
-
|
13 |
-
<!-- Ottimizzazione delle risorse (favicon) -->
|
14 |
-
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
15 |
-
|
16 |
-
<!-- Preload dei font per migliorare la velocità di rendering -->
|
17 |
-
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" as="font" type="font/woff2" crossorigin="anonymous">
|
18 |
-
|
19 |
-
<!-- Ottimizzazione SEO per migliorare l'indicizzazione -->
|
20 |
-
<meta name="robots" content="index, follow">
|
21 |
-
<meta name="author" content="ServerX">
|
22 |
-
|
23 |
-
<!-- Personalizzazione dello stile -->
|
24 |
-
<style>
|
25 |
-
/* Colore della label */
|
26 |
-
.label {
|
27 |
-
color: black; /* Colore di default per la label */
|
28 |
-
}
|
29 |
-
|
30 |
-
/* Quando il gioco è finito, la label cambierà colore */
|
31 |
-
.game-over .label {
|
32 |
-
color: red;
|
33 |
-
}
|
34 |
-
|
35 |
-
/* Styling per il campo di input */
|
36 |
-
.form-control {
|
37 |
-
font-size: 1.25rem;
|
38 |
-
}
|
39 |
-
</style>
|
40 |
-
</head>
|
41 |
-
<body>
|
42 |
-
<header class="container mt-4">
|
43 |
-
<h1 class="text-center">Welcome to Hangman Game</h1>
|
44 |
-
</header>
|
45 |
-
|
46 |
-
<main class="container">
|
47 |
-
<section id="game-container" class="mt-5">
|
48 |
-
<!-- Display della parola da indovinare -->
|
49 |
-
<div id="word-display" class="text-center mb-3">
|
50 |
-
<span class="label">____</span>
|
51 |
-
</div>
|
52 |
-
|
53 |
-
<!-- Input per la lettera -->
|
54 |
-
<div class="d-flex justify-content-center mb-3">
|
55 |
-
<input type="text" id="guess-input" class="form-control w-25" placeholder="Enter a letter" aria-label="Enter a letter for the game">
|
56 |
-
</div>
|
57 |
-
|
58 |
-
<!-- Bottone per fare la guess -->
|
59 |
-
<div class="d-flex justify-content-center">
|
60 |
-
<button id="guess-button" class="btn btn-primary" onclick="makeGuess()">Guess</button>
|
61 |
-
</div>
|
62 |
-
|
63 |
-
<!-- Status del gioco -->
|
64 |
-
<div id="game-status" class="text-center mt-3">Status: Playing</div>
|
65 |
-
</section>
|
66 |
-
|
67 |
-
<!-- Modal Game Over -->
|
68 |
-
<div id="game-over-modal" class="text-center mt-5" style="display:none;">
|
69 |
-
<p>Game Over! Would you like to play again?</p>
|
70 |
-
<button class="btn btn-success" onclick="restartGame()">Play Again</button>
|
71 |
-
</div>
|
72 |
-
</main>
|
73 |
-
|
74 |
-
<footer class="container mt-5 text-center">
|
75 |
-
<p>© 2025 ServerX. All rights reserved.</p>
|
76 |
-
</footer>
|
77 |
-
|
78 |
-
<!-- Caricamento asincrono di JavaScript -->
|
79 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" async defer></script>
|
80 |
-
|
81 |
-
<!-- Script di gioco -->
|
82 |
-
<script>
|
83 |
-
let gameStatus = "playing";
|
84 |
-
|
85 |
-
// Funzione per fare la guess
|
86 |
-
function makeGuess() {
|
87 |
-
let guess = document.getElementById('guess-input').value.toLowerCase();
|
88 |
-
if (guess.length === 1) {
|
89 |
-
console.log(`User guessed: ${guess}`);
|
90 |
-
// Logica di gioco per indovinare la lettera
|
91 |
-
// Simuliamo il cambiamento del colore della label quando il gioco finisce
|
92 |
-
if (guess === "e") {
|
93 |
-
document.getElementById('word-display').classList.add('game-over');
|
94 |
-
document.getElementById('game-status').innerText = 'Status: Game Over';
|
95 |
-
document.getElementById('game-over-modal').style.display = 'block';
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
// Funzione per riavviare il gioco
|
101 |
-
function restartGame() {
|
102 |
-
document.getElementById('game-status').innerText = 'Status: Playing';
|
103 |
-
document.getElementById('game-over-modal').style.display = 'none';
|
104 |
-
document.getElementById('word-display').classList.remove('game-over');
|
105 |
-
gameStatus = "playing";
|
106 |
-
}
|
107 |
-
|
108 |
-
// Abilita l'interazione tramite tasto invio
|
109 |
-
document.getElementById('guess-input').addEventListener('keypress', function(event) {
|
110 |
-
if (event.key === "Enter") {
|
111 |
-
makeGuess();
|
112 |
-
}
|
113 |
-
});
|
114 |
-
</script>
|
115 |
-
</body>
|
116 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|