<!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <meta name="viewport"…
- Usercode
- Assistant
<script>
const questions = [
{
question: "¿Quién es considerado el padre de la filosofía occidental?",
options: ["Sócrates", "Platón", "Aristóteles", "Tales de Mileto"],
correctAnswer: "Tales de Mileto"
},
{
question: "¿Cuál de las siguientes no es una rama principal de la filosofía?",
options: ["Ética", "Estética", "Epistemología", "Astronomía"],
correctAnswer: "Astronomía"
},
{
question: "¿Quién escribió 'La República'?",
options: ["Aristóteles", "Platón", "Sócrates", "Heráclito"],
correctAnswer: "Platón"
},
{
question: "¿Cuál de estos filósofos es conocido por su frase 'Pienso, luego existo'?",
options: ["René Descartes", "Immanuel Kant", "Friedrich Nietzsche", "John Locke"],
correctAnswer: "René Descartes"
},
{
question: "¿Qué escuela filosófica fundó Zenón de Citio?",
options: ["Epicureísmo", "Estoicismo", "Cinismo", "Escepticismo"],
correctAnswer: "Estoicismo"
},
{
question: "¿Cuál de estos conceptos es central en la filosofía de Friedrich Nietzsche?",
options: ["Imperativo categórico", "Voluntad de poder", "Tabula rasa", "Idea del bien"],
correctAnswer: "Voluntad de poder"
},
{
question: "¿Quién es conocido como el fundador del psicoanálisis?",
options: ["Carl Jung", "Sigmund Freud", "B.F. Skinner", "Wilhelm Wundt"],
correctAnswer: "Sigmund Freud"
},
{
question: "¿Cuál de estos filósofos es asociado con el concepto de 'superhombre'?",
options: ["Karl Marx", "Jean-Paul Sartre", "Friedrich Nietzsche", "Søren Kierkegaard"],
correctAnswer: "Friedrich Nietzsche"
},
{
question: "¿Qué filósofo griego fue maestro de Alejandro Magno?",
options: ["Sócrates", "Platón", "Aristóteles", "Pitágoras"],
correctAnswer: "Aristóteles"
},
{
question: "¿Cuál de estos no es un período de la filosofía antigua?",
options: ["Período presocrático", "Período helenístico", "Período clásico", "Período renacentista"],
correctAnswer: "Período renacentista"
},
{
question: "¿Quién escribió 'El mundo como voluntad y representación'?",
options: ["Arthur Schopenhauer", "Immanuel Kant", "Georg Wilhelm Friedrich Hegel", "Johann Gottlieb Fichte"],
correctAnswer: "Arthur Schopenhauer"
},
{
question: "¿Cuál de estos filósofos es conocido por su teoría del 'imperativo categórico'?",
options: ["John Stuart Mill", "Immanuel Kant", "Jeremy Bentham", "David Hume"],
correctAnswer: "Immanuel Kant"
},
{
question: "¿Quién es considerado el fundador del cinismo en la filosofía antigua?",
options: ["Diógenes de Sinope", "Antístenes", "Crates de Tebas", "Zenón de Citio"],
correctAnswer: "Antístenes"
},
{
question: "¿Cuál de estos conceptos es central en el existencialismo?",
options: ["Determinismo", "Utilitarismo", "Libre albedrío", "Materialismo dialéctico"],
correctAnswer: "Libre albedrío"
},
{
question: "¿Quién escribió 'El ser y la nada'?",
options: ["Albert Camus", "Simone de Beauvoir", "Jean-Paul Sartre", "Maurice Merleau-Ponty"],
correctAnswer: "Jean-Paul Sartre"
}
];
const quotes = [
{ text: "Conócete a ti mismo", author: "Sócrates", image: "https://img.freepik.com/vector-gratis/hermosa-estatua-diosa-griega-estetica-tecnica-mixta_53876-116528.jpg?t=st=1728425293~exp=1728428893~hmac=232dfd118a7fbd6befe4894ecc85ee2e066d499766df9695f8696bcd7b141667&w=740" },
{ text: "Pienso, luego existo", author: "René Descartes", image: "https://img.freepik.com/vector-gratis/ilustracion-acuarela-shakespeare_23-2149300326.jpg?t=st=1728425081~exp=1728428681~hmac=a7d1775f9a9e6dfd10b71ba8370b7b7e34c1e275874a065fabc5ed3001f04343&w=740" },
{ text: "El hombre está condenado a ser libre", author: "Jean-Paul Sartre", image: "https://img.freepik.com/vector-gratis/coleccion-estatuas-griegas-diseno-plano-dibujadas-mano_52683-84292.jpg?t=st=1728425217~exp=1728428817~hmac=7fe919943f19765fcb4e14a496ad6bd409e3300c5be02b65af71ff264cb8eb20&w=740" },
{ text: "La vida no examinada no merece ser vivida", author: "Sócrates", image: "https://img.freepik.com/vector-gratis/etiqueta-engomada-vector-mano-dioses-pintura-famosa-creacion-adan-remezclada-obras-arte-michelangelo-buonarroti_53876-125649.jpg?t=st=1728423836~exp=1728427436~hmac=0befc2e7aab6bcbcffba42e5f34ce5201ea4c7d6a29586bf37071cdd3fede8ce&w=826" },
{ text: "El hombre es la medida de todas las cosas", author: "Protágoras", image: "https://img.freepik.com/vector-gratis/ilustracion-vintage-vector-cabeza-barbuda-remezclada-obra-arte-john-flaxman_53876-114747.jpg?t=st=1728424802~exp=1728428402~hmac=57dd0ca67fc4535385e00f8d8a22ba889b260907743f56af554123d5d0b44369&w=360" },
{ text: "Solo sé que no sé nada", author: "Sócrates", image: "https://img.freepik.com/vector-gratis/adiccion-redes-sociales-vibraciones-verano-publicacion-estetica_53876-117217.jpg?t=st=1728423871~exp=1728427471~hmac=386e8e4b11d0416f08dfa551022ebae3a6353f0cc041ce4fa611c402878e64a6&w=740" },
{ text: "La duda es el principio de la sabiduría", author: "Aristóteles", image: "https://img.freepik.com/vector-gratis/estatua-diosa-griega-notificacion-citas-linea-tecnica-mixta-estetica_53876-116530.jpg?t=st=1728423906~exp=1728427506~hmac=400433b0bf592ab8653df234ef4cf857bb2c185ccc0c446898e56c22f1080274&w=740" },
{ text: "El que tiene un porqué para vivir puede soportar casi cualquier cómo", author: "Friedrich Nietzsche", image: "https://img.freepik.com/vector-gratis/marco-citas-linea-estetica-estatua-dios-griego-azul_53876-117218.jpg?t=st=1728423645~exp=1728427245~hmac=90aa783a61b858bd727eedb27e5f2737bd44aedb0cff4f1e939bf7250017c794&w=740" },
{ text: "La libertad es lo que haces con lo que te han hecho", author: "Jean-Paul Sartre", image: "https://img.freepik.com/vector-gratis/cyber-bullying-medios-mixtos-llorando-estatua-dios-griego-publicacion-estetica_53876-100469.jpg?t=st=1728423774~exp=1728427374~hmac=8726d1dcfd25702c04a0dd8a48d5c2bac6fa5e21f5b487866afb8a16fc4de1ab&w=740" },
{ text: "La filosofía es una batalla contra el embrujo de nuestro entendimiento por medio de nuestro lenguaje", author: "Ludwig Wittgenstein", image: "https://img.freepik.com/vector-gratis/estatua-diosa-griega-selfie-adiccion-redes-sociales-tecnicas-mixtas_53876-116525.jpg?t=st=1728423800~exp=1728427400~hmac=20028f05dea235c9151a6592de1a7130ce860cb7233723eb480d12d00e02d588&w=740" },
{ text: "La felicidad de tu vida depende de la calidad de tus pensamientos.", author: "Marco Aurelio", image: "https://img.freepik.com/vector-gratis/citas-linea-que-coinciden-estatua-dios-griego-publicacion-redes-sociales_53876-114651.jpg?t=st=1728424656~exp=1728428256~hmac=55bf817bff358d7362f62f73be6a2106e0ef618a2e35bea2249c18b42bfd243e&w=740" },
{ text: "El amor es sentir que el ser sagrado late dentro del ser querido", author: "Platón", image: "https://img.freepik.com/vector-gratis/ilustracion-vintage-vector-cabeza-barbuda-remezclada-obra-arte-john-flaxman_53876-114747.jpg?t=st=1728424802~exp=1728428402~hmac=57dd0ca67fc4535385e00f8d8a22ba889b260907743f56af554123d5d0b44369&w=360" },
{ text: "No se nace mujer, se llega a serlo", author: "Simone de Beauvoir", image: "https://img.freepik.com/vector-gratis/fondo-hombre-libros_1343-35.jpg?t=st=1728424898~exp=1728428498~hmac=f88fd59d56d23f85fac8b573392562c2a96d1f3ff0a32419bef2199454f8ad10&w=740" },
{ text: "El corazón tiene razones que la razón ignora", author: "Pascal", image: "https://img.freepik.com/vector-gratis/coleccion-pegatinas-cultura-fanzine-gradiente_23-2149167939.jpg?t=st=1728424937~exp=1728428537~hmac=d6946a66ce61240b1a0c4a2c45953ba9ae1b0202df7c5117e33d96410593bd6d&w=740" },
];
let currentQuestionIndex = 0;
let shuffledQuestions = [];
let userAnswers = [];
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
function startQuiz() {
shuffledQuestions = [...questions];
shuffleArray(shuffledQuestions);
currentQuestionIndex = 0;
userAnswers = [];
showQuestion();
showQuote();
document.getElementById('summary').style.display = 'none';
document.getElementById('restart-quiz').style.display = 'none';
document.getElementById('question-container').style.display = 'block';
document.getElementById('feedback').style.display = 'block';
}
function showQuestion() {
const questionContainer = document.getElementById('question-container');
const currentQuestion = shuffledQuestions[currentQuestionIndex];
let questionHTML = `<h2>${currentQuestion.question}</h2>`;
currentQuestion.options.forEach((option, index) => {
questionHTML += `<div class="option" onclick="selectOption(this, ${index})">${option}</div>`;
});
questionContainer.innerHTML = questionHTML;
document.getElementById('feedback').textContent = '';
document.getElementById('next-question').style.display = 'none';
updateQuestionCounter();
}
function updateQuestionCounter() {
const counterElement = document.getElementById('question-counter');
counterElement.textContent = `Pregunta ${currentQuestionIndex + 1} de ${shuffledQuestions.length}`;
}
function showQuote() {
const quoteElement = document.getElementById('quote');
const authorElement = document.getElementById('author');
const imageElement = document.getElementById('philosopher-image');
const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
quoteElement.textContent = `"${randomQuote.text}"`;
authorElement.textContent = randomQuote.author;
imageElement.src = randomQuote.image; // Set the image source
}
function selectOption(optionElement, index) {
const options = document.getElementsByClassName('option');
for (let option of options) {
option.classList.remove('selected');
option.onclick = null;
}
optionElement.classList.add('selected');
const currentQuestion = shuffledQuestions[currentQuestionIndex];
const selectedAnswer = currentQuestion.options[index];
userAnswers.push(selectedAnswer);
if (selectedAnswer === currentQuestion.correctAnswer) {
optionElement.classList.add('correct');
document.getElementById('feedback').textContent = '¡Correcto!';
} else {
optionElement.classList.add('incorrect');
document.getElementById('feedback').textContent = 'Incorrecto. ';
for (let option of options) {
if (option.textContent === currentQuestion.correctAnswer) {
option.classList.add('correct');
break;
}
}
}
if (currentQuestionIndex < shuffledQuestions.length - 1) {
document.getElementById('next-question').style.display = 'block';
} else {
showSummary();
}
}
function nextQuestion() {
currentQuestionIndex++;
if (currentQuestionIndex < shuffledQuestions.length) {
showQuestion();
showQuote();
} else {
showSummary();
}
}
function showSummary() {
const summaryElement = document.getElementById('summary');
let summaryHTML = '<h2>Resumen de Respuestas</h2>';
let correctCount = 0;
shuffledQuestions.forEach((question, index) => {
const userAnswer = userAnswers[index];
const isCorrect = userAnswer === question.correctAnswer;
if (isCorrect) correctCount++;
summaryHTML += `
<p>
<strong>Pregunta ${index + 1}:</strong> ${question.question}<br>
Tu respuesta: ${userAnswer}<br>
Respuesta correcta: ${question.correctAnswer}<br>
${isCorrect ? '✅ Correcto' : '❌ Incorrecto'}
</p>
`;
});
summaryHTML += `<p>Puntuación final: ${correctCount} de ${shuffledQuestions.length}</p>`;
summaryElement.innerHTML = summaryHTML;
summaryElement.style.display = 'block';
document.getElementById('question-container').style.display = 'none';
document.getElementById('feedback').style.display = 'none';
document.getElementById('next-question').style.display = 'none';
document.getElementById('restart-quiz').style.display = 'block';
document.getElementById('question-counter').style.display = 'none';
}
document.getElementById('next-question').addEventListener('click', nextQuestion);
document.getElementById('restart-quiz').addEventListener('click', startQuiz);
startQuiz();
</script>
MODIFICA el script para que las citas aparezcan el letra cursiva y entre comillas
Para mostrar las citas en letra cursiva y entre comillas en el script, debes asegurarte de que el texto de la cita en sí ya esté entre comillas (si no lo está, puedes añadirlas en el código como parte del texto), y después puedes aplicar el estilo de cursiva mediante CSS o JavaScript.
Dado que las citas ya aparecen entre comillas en tu código, necesitas aplicar el estilo de cursiva usando CSS. Puedes hacerlo agregando una regla CSS para el elemento que contiene la cita. En tu caso, es el elemento con id="quote".
Aquí te muestro cómo modificar el CSS para que las citas se muestren en cursiva:
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
height: 100vh;
}
#quote-container {
width: 30%;
padding: 20px;
background-color: #f0f0f0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#quote {
font-style: italic; /* Esta línea asegura que el texto esté en cursiva */
text-align: center;
margin-bottom: 10px;
}
#author {
font-weight: bold;
}
#philosopher-image {
max-width: 100%;
height: auto;
margin-top: 10px;
}
#quiz-container {
width: 70%;
padding: 20px;
overflow-y: auto;
}
h1 {
text-align: center;
}
#question-container {
margin-bottom: 20px;
}
.option {
margin: 10px 0;
padding: 10px;
border: 1px solid #ddd;
cursor: pointer;
}
.option.selected {
background-color: #e0e0e0;
}
.option.correct {
background-color: #aaffaa;
}
.option.incorrect {
background-color: #ffaaaa;
}
#feedback {
margin-top: 10px;
font-weight: bold;
}
button {
display: block;
width: 100%;
padding: 10px;
margin-top: 10px;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#summary {
margin-top: 20px;
}
#question-counter {
text-align: right;
margin-bottom: 10px;
font-weight: bold;
}
</style>
Con esta modificación, las citas seguirán apareciendo entre comillas como parte de la cadena de texto (ya que los textos de las citas ya contienen comillas), y el estilo de cursiva será aplicado mediante CSS al elemento que las contiene (#quote).
Not yet included in a published release.