Commit ebfa0d3d authored by Gaston Morales's avatar Gaston Morales

Permite configuração tempo por pergunta (sim/não)

parent cbf45a07
......@@ -14,6 +14,9 @@
</head>
<body>
<div class="start-screen">
<h4>
Tela inicial - blá blá blá inicial
</h4>
<button id="start-button">Iniciar</button>
</div>
<div id="display-container">
......
......@@ -19,6 +19,7 @@
// type: "noAnswer", // tipo pergunta: answer -> tem resposta certa
// // noAnswer -> não tem resposta certa
// theme: "Gestão Financeira", // tema da pergunta
// themeIndex: 1 // Index do tema na lista de temas [0...total de temas-1]
// question: "Separa o dinheiro pessoal do dinheiro da empresa?", // pergunta
// options: [{ text:"Separo completamente.", score: 2}, // opções de resposta (Array):
// // text: texto da resposta
......
// Configurções
const time4Question = 16
// Baseado no tutorial em https://codingartistweb.com/2022/06/quiz-app-with-javascript/ acessado em 02/08/2023
// Adaptado para pt-BR e acrescentadas fncionalidades adicionais por Gastón Morales@Faros Educacional
//
// Configurações
const time4Question = 0 // tempo em segundos (+1) para cada pergunta ser respondida, se 0 (zero) não tem tempo
const porTemas = false // perguntas apresentadas agrupadas por tema (true) ou não (false)
//References
let timeDiv = document.querySelector(".timer-div");
let timeLeft = document.querySelector(".time-left");
let quizContainer = document.getElementById("container");
let nextBtn = document.getElementById("next-button");
......@@ -70,10 +76,12 @@ nextBtn.addEventListener(
questionCount + 1 + " de " + quizArray.length + " perguntas";
//display quiz
quizDisplay(questionCount);
if ( time4Question > 0 ) {
count = time4Question;
clearInterval(countdown);
timerDisplay();
}
}
})
);
......@@ -216,9 +224,15 @@ function initial() {
quizContainer.innerHTML = "";
questionCount = 0;
scoreCount = 0;
// if time to answer question is enabled
if ( time4Question > 0 ) {
count = time4Question;
clearInterval(countdown);
timerDisplay();
}
else {
timeDiv.classList.add("hide");
}
themeList = [];
themeListCreator();
quizCreator();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment