triviagmatico 30/09/26 a 13:30

This commit is contained in:
2026-10-01 12:07:47 +02:00
parent e8accf949e
commit 5bf5b7a3bc
15 changed files with 176 additions and 1062 deletions
+1 -1
View File
@@ -276,7 +276,7 @@ $(document).on("click", ".btn-abandonar-sala", function () {
mensaje.text(
"Si abandonas la sala como anfitrión, la partida terminará para todos los jugadores.",
);
botonConfirmar.text("Sí, abandonar");
botonConfirmar.text("Sí, terminar partida");
} else {
titulo.text("¿Abandonar la sala?");
mensaje.text(
+1 -7
View File
@@ -1,15 +1,9 @@
let idUsuarioSesion = null;
$(document).ready(function () {
// Carga la cabecera html
$("#cabecera-container").load("cabecera.html", function () {
// Después de cargar cabecera comprobamos sesión
comprobarSesion();
});
comprobarSesion();
});
// Función auxiliar para escapar texto HTML
function escapeHTML(str) {
return $("<div>")
+5 -5
View File
@@ -36,11 +36,11 @@ function renderizarTablaRanking(jugadores) {
<thead class="table-dark">
<tr>
<th scope="col" style="width: 10%;">#</th>
<th scope="col" class="text-start" style="width: 35%;">Jugador</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-trophy text-warning me-1"></i> Vic</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-xmark text-danger me-1"></i> Der</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-bullseye text-success me-1"></i> Aciertos</th>
<th scope="col" style="width: 10%;"><i class="fa-solid fa-percent text-info me-1"></i> % Vic</th>
<th scope="col" class="text-start" style="width: 30%;"><i class="fa-solid fa-user"></i> <br> Jugador</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-trophy text-warning me-1"></i> <br> Victorias</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-xmark text-danger me-1"></i> <br> Derrotas</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-bullseye text-success me-1"></i> <br> Aciertos</th>
<th scope="col" style="width: 15%;"><i class="fa-solid fa-medal text-info me-1"></i> <br> Efectividad</th>
</tr>
</thead>
<tbody>
+14 -2
View File
@@ -20,7 +20,18 @@ let bloqueado = false; // true mientras se envía una respuesta o se ve el feedb
let numeroAciertos = 0; // número de aciertos del jugador
$(document).ready(function () {
idPartida = parseInt($("body").data("id-partida"), 10);
// Obtenemos el idPartida de la URL
// Ejemplo: juego.php?idPartida=3
const parametros = new URLSearchParams(window.location.search);
idPartida = parseInt(parametros.get("idPartida"), 10);
if (!idPartida || idPartida < 1) {
mostrarError("La partida indicada no es válida.");
return;
}
// Un solo listener para todos los botones de respuesta
$("#respuestas").on("click", ".btn-answer", function () {
@@ -103,6 +114,7 @@ function responder($botonPulsado) {
if (bloqueado) {
return;
}
bloqueado = true;
const pregunta = preguntas[indice];
@@ -216,4 +228,4 @@ function mostrarError(mensaje) {
$("#feedback").html(
'<a href="buscadorSala.php">Volver al buscador de salas</a>',
);
}
}