Loading perguntas.js +4 −4 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ // maxScore: 2, // número máximo de pontos que podem ser obtidos ao responder a pergunta // maxScore: 2, // número máximo de pontos que podem ser obtidos ao responder a pergunta // // const quizArrayTeste = [ const quizArrayOLD = [ { { id: "01.01", id: "01.01", type: "noAnswer", type: "noAnswer", Loading Loading @@ -55,7 +55,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Which is the most widely spoken language in the world?", question: "Which is the most widely spoken language in the world?", options: [{ text:"Spanish", score:0}, { text:"Mandarin", score:1}, { text:"English", score:0}], options: [{text:"Spanish", score:0}, {text:"Mandarin", score:1}, {text:"English", score:0}, {text:"Portuguese", score:0}], correct: "Mandarin", correct: "Mandarin", maxScore: 1, maxScore: 1, }, }, Loading @@ -64,7 +64,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Which is the only continent in the world without a desert?", question: "Which is the only continent in the world without a desert?", options: [{text:"North America", score:0}, { text:"Asia", score:0}, { text:"Europe", score:1}], options: [{text:"North America", score:0}, {text:"Asia", score:0}, {text:"Europe", score:1}, {text:"Africa", score:0}], correct: "Europe", correct: "Europe", maxScore: 1, maxScore: 1, }, }, Loading @@ -73,7 +73,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Who invented Computer?", question: "Who invented Computer?", options: [{ text:"Charles Babbage", score:1}, { text:"Henry Babbage", score:0}, { text:"Charles Luce", score:0}], options: [{ text:"Charles Babbage", score:1}, { text:"Henry Babbage", score:0}, { text:"Charles Luce", score:0}, { text:"Charles Openheimer", score:0}, { text:"Charles De Gaulle", score:0}], correct: "Charles Babbage", correct: "Charles Babbage", maxScore: 1, maxScore: 1, } } Loading script.js +6 −6 Original line number Original line Diff line number Diff line Loading @@ -122,12 +122,12 @@ function quizCreator() { question_DIV.classList.add("question"); question_DIV.classList.add("question"); question_DIV.innerHTML = i.question; question_DIV.innerHTML = i.question; div.appendChild(question_DIV); div.appendChild(question_DIV); //options - #TODO, automatizar as opções de acordo com a quantidade no array //options - get the avaiable options div.innerHTML += ` let options = ""; <button class="option-div" onclick="checker(this)">${i.options[0].text}</button> i.options.forEach( (option) => { <button class="option-div" onclick="checker(this)">${i.options[1].text}</button> options += `<button class="option-div" onclick="checker(this)">${option.text}</button>`; <button class="option-div" onclick="checker(this)">${i.options[2].text}</button> }); `; div.innerHTML += options; quizContainer.appendChild(div); quizContainer.appendChild(div); } } } } Loading Loading
perguntas.js +4 −4 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ // maxScore: 2, // número máximo de pontos que podem ser obtidos ao responder a pergunta // maxScore: 2, // número máximo de pontos que podem ser obtidos ao responder a pergunta // // const quizArrayTeste = [ const quizArrayOLD = [ { { id: "01.01", id: "01.01", type: "noAnswer", type: "noAnswer", Loading Loading @@ -55,7 +55,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Which is the most widely spoken language in the world?", question: "Which is the most widely spoken language in the world?", options: [{ text:"Spanish", score:0}, { text:"Mandarin", score:1}, { text:"English", score:0}], options: [{text:"Spanish", score:0}, {text:"Mandarin", score:1}, {text:"English", score:0}, {text:"Portuguese", score:0}], correct: "Mandarin", correct: "Mandarin", maxScore: 1, maxScore: 1, }, }, Loading @@ -64,7 +64,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Which is the only continent in the world without a desert?", question: "Which is the only continent in the world without a desert?", options: [{text:"North America", score:0}, { text:"Asia", score:0}, { text:"Europe", score:1}], options: [{text:"North America", score:0}, {text:"Asia", score:0}, {text:"Europe", score:1}, {text:"Africa", score:0}], correct: "Europe", correct: "Europe", maxScore: 1, maxScore: 1, }, }, Loading @@ -73,7 +73,7 @@ const quizArrayTeste = [ type: "answer", type: "answer", theme: "Conhecimentos", theme: "Conhecimentos", question: "Who invented Computer?", question: "Who invented Computer?", options: [{ text:"Charles Babbage", score:1}, { text:"Henry Babbage", score:0}, { text:"Charles Luce", score:0}], options: [{ text:"Charles Babbage", score:1}, { text:"Henry Babbage", score:0}, { text:"Charles Luce", score:0}, { text:"Charles Openheimer", score:0}, { text:"Charles De Gaulle", score:0}], correct: "Charles Babbage", correct: "Charles Babbage", maxScore: 1, maxScore: 1, } } Loading
script.js +6 −6 Original line number Original line Diff line number Diff line Loading @@ -122,12 +122,12 @@ function quizCreator() { question_DIV.classList.add("question"); question_DIV.classList.add("question"); question_DIV.innerHTML = i.question; question_DIV.innerHTML = i.question; div.appendChild(question_DIV); div.appendChild(question_DIV); //options - #TODO, automatizar as opções de acordo com a quantidade no array //options - get the avaiable options div.innerHTML += ` let options = ""; <button class="option-div" onclick="checker(this)">${i.options[0].text}</button> i.options.forEach( (option) => { <button class="option-div" onclick="checker(this)">${i.options[1].text}</button> options += `<button class="option-div" onclick="checker(this)">${option.text}</button>`; <button class="option-div" onclick="checker(this)">${i.options[2].text}</button> }); `; div.innerHTML += options; quizContainer.appendChild(div); quizContainer.appendChild(div); } } } } Loading