Download index.html from Leandroprofessor/teste-de-programa-o: direct link, hf CLI and curl.
- Browser
- Download file 29.2 kB
-
https://huggingface.co/spaces/Leandroprofessor/teste-de-programa-o/resolve/main/index.html
- Command line
-
hf download hf://spaces/Leandroprofessor/teste-de-programa-o/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Leandroprofessor/teste-de-programa-o/resolve/main/index.html
29.2 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Quiz Interativo - 50 Perguntas</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .progress-bar { | |
| transition: width 0.5s ease-in-out; | |
| } | |
| .question-card { | |
| transform: translateX(0); | |
| transition: transform 0.5s ease-in-out; | |
| } | |
| .question-card.hidden { | |
| transform: translateX(-100%); | |
| opacity: 0; | |
| position: absolute; | |
| } | |
| .option:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| } | |
| .option.selected { | |
| background-color: #3b82f6; | |
| color: white; | |
| border-color: #3b82f6; | |
| } | |
| .option.correct { | |
| background-color: #10b981; | |
| color: white; | |
| border-color: #10b981; | |
| } | |
| .option.incorrect { | |
| background-color: #ef4444; | |
| color: white; | |
| border-color: #ef4444; | |
| } | |
| .confetti { | |
| position: fixed; | |
| width: 10px; | |
| height: 10px; | |
| background-color: #f00; | |
| border-radius: 50%; | |
| animation: fall 5s linear forwards; | |
| } | |
| @keyframes fall { | |
| to { | |
| transform: translateY(100vh) rotate(360deg); | |
| opacity: 0; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen font-sans"> | |
| <div class="container mx-auto px-4 py-8 max-w-4xl"> | |
| <!-- Header --> | |
| <header class="text-center mb-8"> | |
| <h1 class="text-4xl font-bold text-indigo-700 mb-2">Quiz Interativo</h1> | |
| <p class="text-gray-600">Teste seus conhecimentos com 50 perguntas desafiadoras!</p> | |
| </header> | |
| <!-- Start Screen --> | |
| <div id="start-screen" class="bg-white rounded-xl shadow-lg p-8 text-center"> | |
| <div class="mb-6"> | |
| <i class="fas fa-brain text-6xl text-indigo-500 mb-4"></i> | |
| <h2 class="text-2xl font-bold text-gray-800 mb-2">Bem-vindo ao Quiz!</h2> | |
| <p class="text-gray-600 mb-6">Responda 50 perguntas de diferentes categorias e descubra o quanto você sabe.</p> | |
| </div> | |
| <div class="mb-6"> | |
| <label for="username" class="block text-gray-700 mb-2">Seu nome (opcional):</label> | |
| <input type="text" id="username" class="w-full max-w-xs px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"> | |
| </div> | |
| <button id="start-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-3 px-8 rounded-lg transition duration-300 transform hover:scale-105"> | |
| Começar Quiz <i class="fas fa-play ml-2"></i> | |
| </button> | |
| </div> | |
| <!-- Quiz Container --> | |
| <div id="quiz-container" class="hidden bg-white rounded-xl shadow-lg overflow-hidden"> | |
| <!-- Quiz Header --> | |
| <div class="bg-indigo-600 text-white p-4 flex justify-between items-center"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-question-circle text-xl mr-2"></i> | |
| <span id="question-counter" class="font-bold">Pergunta 1/50</span> | |
| </div> | |
| <div class="flex items-center"> | |
| <i class="fas fa-clock mr-2"></i> | |
| <span id="timer">00:00</span> | |
| </div> | |
| </div> | |
| <!-- Progress Bar --> | |
| <div class="h-2 bg-gray-200"> | |
| <div id="progress-bar" class="progress-bar h-full bg-indigo-500" style="width: 0%"></div> | |
| </div> | |
| <!-- Question Area --> | |
| <div id="question-area" class="p-6 relative min-h-64"> | |
| <!-- Questions will be inserted here by JavaScript --> | |
| </div> | |
| <!-- Quiz Footer --> | |
| <div class="bg-gray-50 p-4 flex justify-between"> | |
| <button id="prev-btn" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded-lg transition disabled:opacity-50" disabled> | |
| <i class="fas fa-arrow-left mr-2"></i> Anterior | |
| </button> | |
| <button id="next-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded-lg transition"> | |
| Próxima <i class="fas fa-arrow-right ml-2"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Results Screen --> | |
| <div id="results-screen" class="hidden bg-white rounded-xl shadow-lg p-8 text-center"> | |
| <div class="mb-6"> | |
| <i class="fas fa-trophy text-6xl text-yellow-500 mb-4"></i> | |
| <h2 class="text-3xl font-bold text-gray-800 mb-2">Quiz Concluído!</h2> | |
| <p id="results-message" class="text-xl text-gray-600 mb-6">Você acertou <span class="font-bold text-indigo-600">X</span> de 50 perguntas.</p> | |
| </div> | |
| <div class="bg-gray-100 rounded-lg p-4 mb-6"> | |
| <div class="flex justify-between mb-2"> | |
| <span>Tempo total:</span> | |
| <span id="total-time" class="font-bold">00:00</span> | |
| </div> | |
| <div class="flex justify-between mb-2"> | |
| <span>Porcentagem de acertos:</span> | |
| <span id="percentage" class="font-bold">0%</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span>Pontuação:</span> | |
| <span id="score" class="font-bold">0/50</span> | |
| </div> | |
| </div> | |
| <div class="flex justify-center space-x-4"> | |
| <button id="restart-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-6 rounded-lg transition"> | |
| <i class="fas fa-redo mr-2"></i> Refazer | |
| </button> | |
| <button id="share-btn" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-6 rounded-lg transition"> | |
| <i class="fas fa-share-alt mr-2"></i> Compartilhar | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Quiz questions | |
| const questions = [ | |
| { | |
| question: "Qual é o maior planeta do sistema solar?", | |
| options: ["Terra", "Marte", "Júpiter", "Saturno"], | |
| answer: 2, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Quem pintou a Mona Lisa?", | |
| options: ["Vincent van Gogh", "Pablo Picasso", "Leonardo da Vinci", "Michelangelo"], | |
| answer: 2, | |
| category: "Arte" | |
| }, | |
| { | |
| question: "Qual é o elemento químico com símbolo 'O'?", | |
| options: ["Ouro", "Oxigênio", "Ósmio", "Oganésson"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Em que ano o homem pisou na Lua pela primeira vez?", | |
| options: ["1965", "1969", "1972", "1958"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o maior oceano do mundo?", | |
| options: ["Atlântico", "Índico", "Ártico", "Pacífico"], | |
| answer: 3, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quem escreveu 'Dom Quixote'?", | |
| options: ["Miguel de Cervantes", "Gabriel García Márquez", "Pablo Neruda", "Fernando Pessoa"], | |
| answer: 0, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é a capital do Canadá?", | |
| options: ["Toronto", "Vancouver", "Ottawa", "Montreal"], | |
| answer: 2, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quantos continentes existem?", | |
| options: ["5", "6", "7", "8"], | |
| answer: 2, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Qual é o animal terrestre mais rápido?", | |
| options: ["Leão", "Guepardo", "Antílope", "Leopardo"], | |
| answer: 1, | |
| category: "Natureza" | |
| }, | |
| { | |
| question: "Quem foi o primeiro presidente do Brasil?", | |
| options: ["Getúlio Vargas", "Deodoro da Fonseca", "Prudente de Morais", "Floriano Peixoto"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o livro mais vendido do mundo depois da Bíblia?", | |
| options: ["Dom Quixote", "Um Conto de Duas Cidades", "O Pequeno Príncipe", "O Senhor dos Anéis"], | |
| answer: 0, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é a língua mais falada no mundo?", | |
| options: ["Inglês", "Mandarim", "Espanhol", "Hindi"], | |
| answer: 1, | |
| category: "Cultura" | |
| }, | |
| { | |
| question: "Quantos ossos tem o corpo humano adulto?", | |
| options: ["206", "300", "150", "187"], | |
| answer: 0, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o menor país do mundo?", | |
| options: ["Mônaco", "Vaticano", "San Marino", "Liechtenstein"], | |
| answer: 1, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quem descobriu a penicilina?", | |
| options: ["Marie Curie", "Alexander Fleming", "Louis Pasteur", "Robert Koch"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o rio mais longo do mundo?", | |
| options: ["Amazonas", "Nilo", "Yangtzé", "Mississipi"], | |
| answer: 0, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Em que ano começou a Segunda Guerra Mundial?", | |
| options: ["1939", "1941", "1935", "1945"], | |
| answer: 0, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é a montanha mais alta do mundo?", | |
| options: ["K2", "Monte Everest", "Aconcágua", "Kilimanjaro"], | |
| answer: 1, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quem foi o autor de '1984'?", | |
| options: ["Aldous Huxley", "George Orwell", "Ray Bradbury", "J.R.R. Tolkien"], | |
| answer: 1, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é a moeda oficial do Japão?", | |
| options: ["Won", "Yen", "Yuan", "Dólar"], | |
| answer: 1, | |
| category: "Cultura" | |
| }, | |
| { | |
| question: "Quantas cores tem o arco-íris?", | |
| options: ["5", "6", "7", "8"], | |
| answer: 2, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o maior deserto do mundo?", | |
| options: ["Deserto do Saara", "Deserto de Gobi", "Deserto da Arábia", "Antártida"], | |
| answer: 3, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quem foi o primeiro homem a viajar no espaço?", | |
| options: ["Neil Armstrong", "Yuri Gagarin", "John Glenn", "Alan Shepard"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o símbolo químico do ouro?", | |
| options: ["Ag", "Au", "Og", "Gd"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Em que país nasceu o futebolista Lionel Messi?", | |
| options: ["Brasil", "Espanha", "Portugal", "Argentina"], | |
| answer: 3, | |
| category: "Esportes" | |
| }, | |
| { | |
| question: "Qual é a capital da Austrália?", | |
| options: ["Sydney", "Melbourne", "Canberra", "Brisbane"], | |
| answer: 2, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quantos anos durou a Guerra dos Cem Anos?", | |
| options: ["100", "116", "97", "110"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o maior órgão do corpo humano?", | |
| options: ["Coração", "Fígado", "Pele", "Cérebro"], | |
| answer: 2, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Quem escreveu 'Romeu e Julieta'?", | |
| options: ["Charles Dickens", "William Shakespeare", "Jane Austen", "Mark Twain"], | |
| answer: 1, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é o país mais populoso do mundo?", | |
| options: ["Índia", "Estados Unidos", "China", "Indonésia"], | |
| answer: 2, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Qual destes não é um sistema operacional?", | |
| options: ["Windows", "Linux", "MacOS", "Google"], | |
| answer: 3, | |
| category: "Tecnologia" | |
| }, | |
| { | |
| question: "Qual é a capital da Islândia?", | |
| options: ["Oslo", "Reykjavik", "Helsinque", "Estocolmo"], | |
| answer: 1, | |
| category: "Geografia" | |
| }, | |
| { | |
| question: "Quantas peças tem um xadrez tradicional?", | |
| options: ["16", "24", "32", "40"], | |
| answer: 2, | |
| category: "Jogos" | |
| }, | |
| { | |
| question: "Qual é o nome do processo de transformação de lagarta em borboleta?", | |
| options: ["Fotossíntese", "Metamorfose", "Osmose", "Fertilização"], | |
| answer: 1, | |
| category: "Natureza" | |
| }, | |
| { | |
| question: "Qual destes é um instrumento de percussão?", | |
| options: ["Violino", "Trompete", "Bateria", "Harpa"], | |
| answer: 2, | |
| category: "Música" | |
| }, | |
| { | |
| question: "Em que ano o Brasil foi descoberto?", | |
| options: ["1492", "1500", "1520", "1450"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o nome do maior osso do corpo humano?", | |
| options: ["Úmero", "Fêmur", "Tíbia", "Crânio"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual destes não é um planeta do sistema solar?", | |
| options: ["Vênus", "Urano", "Plutão", "Marte"], | |
| answer: 2, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Quem foi o criador da teoria da relatividade?", | |
| options: ["Isaac Newton", "Albert Einstein", "Galileu Galilei", "Stephen Hawking"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o nome do processo de divisão celular?", | |
| options: ["Fotossíntese", "Mitose", "Respiração", "Digestão"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o nome do famoso quadro de Edvard Munch que representa uma pessoa gritando?", | |
| options: ["O Grito", "A Noite Estrelada", "Guernica", "A Persistência da Memória"], | |
| answer: 0, | |
| category: "Arte" | |
| }, | |
| { | |
| question: "Qual é o metal mais condutor de eletricidade?", | |
| options: ["Ouro", "Prata", "Cobre", "Alumínio"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Quantas cordas tem um violão tradicional?", | |
| options: ["4", "5", "6", "7"], | |
| answer: 2, | |
| category: "Música" | |
| }, | |
| { | |
| question: "Qual é o nome do autor de 'O Pequeno Príncipe'?", | |
| options: ["Jules Verne", "Antoine de Saint-Exupéry", "Victor Hugo", "Charles Perrault"], | |
| answer: 1, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é o país de origem da vodka?", | |
| options: ["Polônia", "Rússia", "Suécia", "Finlândia"], | |
| answer: 1, | |
| category: "Cultura" | |
| }, | |
| { | |
| question: "Qual é o nome do processo de formação de palavras novas?", | |
| options: ["Conjugação", "Derivação", "Flexão", "Concordância"], | |
| answer: 1, | |
| category: "Linguística" | |
| }, | |
| { | |
| question: "Qual é o nome do maior felino do mundo?", | |
| options: ["Leão", "Tigre", "Onça-pintada", "Leopardo"], | |
| answer: 1, | |
| category: "Natureza" | |
| }, | |
| { | |
| question: "Qual é o nome do inventor da lâmpada elétrica?", | |
| options: ["Nikola Tesla", "Thomas Edison", "Alexander Graham Bell", "Guglielmo Marconi"], | |
| answer: 1, | |
| category: "História" | |
| }, | |
| { | |
| question: "Qual é o nome do maior osso do crânio humano?", | |
| options: ["Mandíbula", "Frontal", "Parietal", "Occipital"], | |
| answer: 0, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o nome do processo de formação de gametas?", | |
| options: ["Mitose", "Meiose", "Fertilização", "Osmose"], | |
| answer: 1, | |
| category: "Ciência" | |
| }, | |
| { | |
| question: "Qual é o nome do autor de 'Crime e Castigo'?", | |
| options: ["Leo Tolstoy", "Fyodor Dostoevsky", "Anton Chekhov", "Vladimir Nabokov"], | |
| answer: 1, | |
| category: "Literatura" | |
| }, | |
| { | |
| question: "Qual é o nome do maior lago de água doce do mundo?", | |
| options: ["Lago Vitória", "Lago Superior", "Lago Baikal", "Lago Tanganica"], | |
| answer: 1, | |
| category: "Geografia" | |
| } | |
| ]; | |
| // DOM Elements | |
| const startScreen = document.getElementById('start-screen'); | |
| const quizContainer = document.getElementById('quiz-container'); | |
| const resultsScreen = document.getElementById('results-screen'); | |
| const questionArea = document.getElementById('question-area'); | |
| const questionCounter = document.getElementById('question-counter'); | |
| const progressBar = document.getElementById('progress-bar'); | |
| const prevBtn = document.getElementById('prev-btn'); | |
| const nextBtn = document.getElementById('next-btn'); | |
| const startBtn = document.getElementById('start-btn'); | |
| const restartBtn = document.getElementById('restart-btn'); | |
| const shareBtn = document.getElementById('share-btn'); | |
| const resultsMessage = document.getElementById('results-message'); | |
| const totalTime = document.getElementById('total-time'); | |
| const percentage = document.getElementById('percentage'); | |
| const score = document.getElementById('score'); | |
| const timer = document.getElementById('timer'); | |
| const usernameInput = document.getElementById('username'); | |
| // Quiz Variables | |
| let currentQuestion = 0; | |
| let userAnswers = Array(questions.length).fill(null); | |
| let startTime; | |
| let timerInterval; | |
| let correctAnswers = 0; | |
| // Start Quiz | |
| startBtn.addEventListener('click', () => { | |
| startScreen.classList.add('hidden'); | |
| quizContainer.classList.remove('hidden'); | |
| startTime = new Date(); | |
| startTimer(); | |
| showQuestion(currentQuestion); | |
| }); | |
| // Restart Quiz | |
| restartBtn.addEventListener('click', () => { | |
| resultsScreen.classList.add('hidden'); | |
| startScreen.classList.remove('hidden'); | |
| currentQuestion = 0; | |
| userAnswers = Array(questions.length).fill(null); | |
| correctAnswers = 0; | |
| clearInterval(timerInterval); | |
| }); | |
| // Share Results | |
| shareBtn.addEventListener('click', () => { | |
| const username = usernameInput.value || 'Anônimo'; | |
| const scoreText = `${correctAnswers}/50`; | |
| const percentageText = `${Math.round((correctAnswers / questions.length) * 100)}%`; | |
| const timeText = document.getElementById('total-time').textContent; | |
| if (navigator.share) { | |
| navigator.share({ | |
| title: 'Meu resultado no Quiz', | |
| text: `${username} acertou ${scoreText} (${percentageText}) no Quiz em ${timeText}!`, | |
| url: window.location.href | |
| }).catch(err => { | |
| console.log('Erro ao compartilhar:', err); | |
| fallbackShare(); | |
| }); | |
| } else { | |
| fallbackShare(); | |
| } | |
| }); | |
| function fallbackShare() { | |
| const shareText = `Eu acertei ${correctAnswers} de 50 perguntas no Quiz!`; | |
| alert('Copie este texto para compartilhar:\n\n' + shareText); | |
| } | |
| // Timer Function | |
| function startTimer() { | |
| timerInterval = setInterval(() => { | |
| const now = new Date(); | |
| const elapsed = new Date(now - startTime); | |
| const minutes = elapsed.getMinutes().toString().padStart(2, '0'); | |
| const seconds = elapsed.getSeconds().toString().padStart(2, '0'); | |
| timer.textContent = `${minutes}:${seconds}`; | |
| }, 1000); | |
| } | |
| // Show Question | |
| function showQuestion(index) { | |
| // Update progress | |
| const progress = ((index + 1) / questions.length) * 100; | |
| progressBar.style.width = `${progress}%`; | |
| questionCounter.textContent = `Pergunta ${index + 1}/${questions.length}`; | |
| // Update navigation buttons | |
| prevBtn.disabled = index === 0; | |
| nextBtn.textContent = index === questions.length - 1 ? 'Finalizar' : 'Próxima'; | |
| // Clear previous question | |
| questionArea.innerHTML = ''; | |
| // Create question card | |
| const questionCard = document.createElement('div'); | |
| questionCard.className = 'question-card'; | |
| // Add category | |
| const categoryDiv = document.createElement('div'); | |
| categoryDiv.className = 'text-sm font-semibold text-indigo-600 mb-2'; | |
| categoryDiv.textContent = questions[index].category; | |
| questionCard.appendChild(categoryDiv); | |
| // Add question | |
| const questionDiv = document.createElement('div'); | |
| questionDiv.className = 'text-xl font-bold text-gray-800 mb-6'; | |
| questionDiv.textContent = questions[index].question; | |
| questionCard.appendChild(questionDiv); | |
| // Add options | |
| const optionsDiv = document.createElement('div'); | |
| optionsDiv.className = 'space-y-3'; | |
| questions[index].options.forEach((option, i) => { | |
| const optionDiv = document.createElement('div'); | |
| optionDiv.className = `option p-4 border rounded-lg cursor-pointer transition ${userAnswers[index] === i ? 'selected' : ''}`; | |
| optionDiv.textContent = option; | |
| optionDiv.dataset.index = i; | |
| optionDiv.addEventListener('click', () => { | |
| // Remove selected class from all options | |
| document.querySelectorAll('.option').forEach(opt => { | |
| opt.classList.remove('selected'); | |
| }); | |
| // Add selected class to clicked option | |
| optionDiv.classList.add('selected'); | |
| // Store user answer | |
| userAnswers[index] = i; | |
| // Enable next button if not already enabled | |
| if (nextBtn.disabled) { | |
| nextBtn.disabled = false; | |
| } | |
| }); | |
| optionsDiv.appendChild(optionDiv); | |
| }); | |
| questionCard.appendChild(optionsDiv); | |
| questionArea.appendChild(questionCard); | |
| } | |
| // Navigation | |
| nextBtn.addEventListener('click', () => { | |
| if (currentQuestion < questions.length - 1) { | |
| currentQuestion++; | |
| showQuestion(currentQuestion); | |
| } else { | |
| finishQuiz(); | |
| } | |
| }); | |
| prevBtn.addEventListener('click', () => { | |
| if (currentQuestion > 0) { | |
| currentQuestion--; | |
| showQuestion(currentQuestion); | |
| } | |
| }); | |
| // Finish Quiz | |
| function finishQuiz() { | |
| clearInterval(timerInterval); | |
| // Calculate results | |
| const endTime = new Date(); | |
| const elapsed = new Date(endTime - startTime); | |
| const minutes = elapsed.getMinutes().toString().padStart(2, '0'); | |
| const seconds = elapsed.getSeconds().toString().padStart(2, '0'); | |
| correctAnswers = 0; | |
| for (let i = 0; i < questions.length; i++) { | |
| if (userAnswers[i] === questions[i].answer) { | |
| correctAnswers++; | |
| } | |
| } | |
| const percentageCorrect = Math.round((correctAnswers / questions.length) * 100); | |
| // Display results | |
| quizContainer.classList.add('hidden'); | |
| resultsScreen.classList.remove('hidden'); | |
| const username = usernameInput.value || 'Você'; | |
| resultsMessage.innerHTML = `${username} acertou <span class="font-bold text-indigo-600">${correctAnswers}</span> de 50 perguntas.`; | |
| totalTime.textContent = `${minutes}:${seconds}`; | |
| percentage.textContent = `${percentageCorrect}%`; | |
| score.textContent = `${correctAnswers}/50`; | |
| // Add confetti for good scores | |
| if (percentageCorrect >= 70) { | |
| createConfetti(); | |
| } | |
| } | |
| // Confetti effect | |
| function createConfetti() { | |
| const colors = ['#f00', '#0f0', '#00f', '#ff0', '#f0f', '#0ff']; | |
| for (let i = 0; i < 100; i++) { | |
| const confetti = document.createElement('div'); | |
| confetti.className = 'confetti'; | |
| confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)]; | |
| confetti.style.left = `${Math.random() * 100}vw`; | |
| confetti.style.animationDuration = `${3 + Math.random() * 4}s`; | |
| confetti.style.transform = `scale(${0.5 + Math.random()})`; | |
| document.body.appendChild(confetti); | |
| // Remove confetti after animation | |
| setTimeout(() => { | |
| confetti.remove(); | |
| }, 5000); | |
| } | |
| } | |
| // Initialize | |
| showQuestion(currentQuestion); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Leandroprofessor/teste-de-programa-o" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |