-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
195 lines (176 loc) · 8.54 KB
/
Copy pathindex.html
File metadata and controls
195 lines (176 loc) · 8.54 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
<!DOCTYPE html>
<html lang="ca">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GEOCACHING ESBORRIACS</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
text-align: center;
background-color: #fff;
color: black;
}
header {
background-color: #f2c94c;
color: black;
padding: 1em;
}
section {
padding: 20px;
}
button {
margin-top: 20px;
padding: 10px 20px;
background-color: #f2c94c;
color: black;
border: none;
cursor: pointer;
}
button:hover {
background-color: #e0b246;
}
.hidden {
display: none;
}
#missatge-error {
color: red;
font-weight: bold;
margin-top: 10px;
}
</style>
</head>
<body>
<header>
<h1>GEOCACHING ESBORRIACS</h1>
</header>
<main>
<!-- Normes inicials -->
<section id="normes">
<h2>Normes del joc:</h2>
<ul style="text-align: left; display: inline-block;">
<li> Feu les proves en ordre.</li>
<li> Només podeu demanar ajuda una vegada.</li>
<li> Heu de fer-vos una foto a cada plaça i enviar-la al grup, per rebre la prova</li>
<li> El primer en acabar tindrà una sorpresa final!</li>
</ul>
<button id="començar">Començar</button>
</section>
<!-- Selecció de grup -->
<section id="seleccio-grup" class="hidden">
<h2>Selecciona el teu grup:</h2>
<select id="grup">
<option value="grup1">Grup 1</option>
<option value="grup2">Grup 2</option>
<option value="grup3">Grup 3</option>
<option value="grup4">Grup 4</option>
</select>
<button id="iniciar-grup">Iniciar</button>
</section>
<!-- Prova -->
<section id="prova" class="hidden">
<h2 id="titol-prova" style="background-color: #f2c94c; color: black; padding: 10px;"></h2>
<p id="objectiu-prova"></p>
<p id="subplaces" class="hidden" style="font-weight: bold; color: #333;"></p>
<input type="password" id="contrasenya" placeholder="Contrasenya">
<label>
<input type="checkbox" id="toggle-password"> Mostra contrasenya
</label>
<button id="validar">Validar</button>
<p id="missatge-error" class="hidden">Contrasenya incorrecta. Torna a provar!</p>
</section>
<!-- Pista -->
<section id="pista" class="hidden">
<h2>Pista:</h2>
<p id="text-pista"></p>
<button id="seguent-prova">Següent prova</button>
</section>
</main>
<script>
const proves = [
{ titol: "Prova 1", objectiu: "Reconstruiu una frase o missatge relacionat amb l’esplai.", contrasenya: "ESBORRIACS",
pistes: {
grup1: "Segueix on les teixidores van donar vida als fils d’història.",
grup2: "Sóc una figura senzilla, amb dues línies que es creuen, al món porto molts significats, Qui sóc?",
grup3: "La següent pista es troba als primers locals de Trepa",
grup4: "Plaça del Gas"
}
},
{ titol: "Prova 2", objectiu: "Desxifreu la direcció i nombre de passos per trobar la següent ubicació.", contrasenya: "8", pista: "Sóc una figura senzilla, amb dues línies que es creuen, al món porto molts significats, Qui sóc?" },
{ titol: "Prova 3", objectiu: "Prova col·laborativa de coneixements de Trepa.", contrasenya: "1978/4/Clar del Bosc", pista: "La següent pista es troba als primers locals de Trepa." },
{ titol: "Prova 4", objectiu: "Desxifreu el codi per trobar la pista següent.", contrasenya: "Plaça del Gas", pista: "Aneu a la Plaça del Gas." },
{ titol: "Prova 5", objectiu: "Jeroglífic sobre l’esplai.", contrasenya: "gegants", pista: "Segueix els passos dels gegants a la festa major i descobreix el proper repte." },
{ titol: "Prova 6", objectiu: "Trobar una paraula clau per a la contrasenya.", contrasenya: "valors", pista: "Trobeu els dos arbres germans." },
{ titol: "Prova 7", objectiu: "Busqueu i identifiqueu l’objecte físicament a la plaça.", contrasenya: "pi", pista: "Segueix on les teixidores van donar vida als fils d’història." },
{ titol: "Plaça de les Dones Teixidores (Separats)", subplaces: "Plaça Taulí i Lluís Subirana" },
{ titol: "Carrer Alemanya (Separats)", subplaces: "Plaça Clara Campoamor i Club Natació" },
{ titol: "Ajuntament (Separats)", subplaces: "Plaça Pedregar i Plaça Vallès" }
];
const ordreGrups = {
grup1: [0, 1, 2, 3, 4, 5, 6],
grup2: [0, 2, 3, 4, 5, 6, 1],
grup3: [0, 3, 4, 5, 6, 1, 2],
grup4: [0, 4, 5, 6, 1, 2, 3]
};
let grupActual = null;
let indexProva = 0;
document.getElementById("començar").addEventListener("click", () => {
document.getElementById("normes").classList.add("hidden");
document.getElementById("seleccio-grup").classList.remove("hidden");
});
document.getElementById("iniciar-grup").addEventListener("click", () => {
grupActual = document.getElementById("grup").value;
document.getElementById("seleccio-grup").classList.add("hidden");
mostrarProva();
});
document.getElementById("validar").addEventListener("click", () => {
const inputContrasenya = document.getElementById("contrasenya").value;
const prova = proves[ordreGrups[grupActual][indexProva]];
if (inputContrasenya === prova.contrasenya) {
document.getElementById("prova").classList.add("hidden");
document.getElementById("pista").classList.remove("hidden");
document.getElementById("text-pista").textContent = prova.pistes?.[grupActual] || prova.pista;
if (indexProva === ordreGrups[grupActual].length - 1) {
document.getElementById("text-pista").textContent = "Has completat totes les proves! Vés cap als locals de Trepa!";
}
} else {
const errorMessage = document.getElementById("missatge-error");
errorMessage.classList.remove("hidden");
setTimeout(() => errorMessage.classList.add("hidden"), 2000);
}
});
document.getElementById("seguent-prova").addEventListener("click", () => {
indexProva++;
if (indexProva < ordreGrups[grupActual].length) {
mostrarProva();
} else {
alert("Has completat totes les proves! Vés cap als locals de Trepa!");
location.reload();
}
});
document.getElementById("toggle-password").addEventListener("change", () => {
const passwordField = document.getElementById("contrasenya");
passwordField.type = passwordField.type === "password" ? "text" : "password";
});
function mostrarProva() {
const prova = proves[ordreGrups[grupActual][indexProva]];
document.getElementById("pista").classList.add("hidden");
document.getElementById("prova").classList.remove("hidden");
document.getElementById("titol-prova").textContent = prova.titol;
document.getElementById("objectiu-prova").textContent = prova.objectiu;
const subplaces = prova.subplaces || "";
const subplacesElement = document.getElementById("subplaces");
if (subplaces) {
subplacesElement.textContent = `Subplaces: ${subplaces}`;
subplacesElement.classList.remove("hidden");
} else {
subplacesElement.classList.add("hidden");
}
document.getElementById("contrasenya").value = "";
document.getElementById("missatge-error").classList.add("hidden");
}
</script>
</body>
</html>