Lunes 27 de julio de 2026
TEST DE ACTUALIDAD de noticiasdealmeria.com
🔄 Regenerar preguntas
Cargando preguntas...
// Math.random() - 0.5).slice(0, 10);
return mezcladas.map(item => {
const titulo = item.querySelector("title")?.textContent.trim() || "";
const enlace = item.querySelector("link")?.textContent.trim() || "#";
return {
pregunta: `¿${titulo}?`,
correcta: "sí",
enlace
};
});
}
function pintarQuiz(preguntas) {
const div = document.getElementById("quiz-contenido");
let html = "";
preguntas.forEach((p, i) => {
html += `
`;
});
div.innerHTML = html;
}
function validar(indice, respuestaUsuario) {
const correcta = window.preguntas[indice].correcta;
const resultado = document.getElementById(`resultado-${indice}`);
if (respuestaUsuario === correcta) {
resultado.textContent = "✔️ Correcto";
resultado.style.color = "green";
} else {
resultado.textContent = "❌ Incorrecto";
resultado.style.color = "red";
}
}
async function iniciar() {
document.getElementById("quiz-contenido").innerHTML = "Cargando preguntas...";
const xml = await cargarRSS();
if (!xml) {
document.getElementById("quiz-contenido").innerHTML =
"No se pudo cargar el RSS.";
return;
}
const items = Array.from(xml.querySelectorAll("item"));
window.preguntas = generarPreguntas(items);
pintarQuiz(window.preguntas);
}
iniciar();
// ]]>