Loading perguntas.js +4 −4 Original line number 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 // const quizArrayTeste = [ const quizArrayOLD = [ { id: "01.01", type: "noAnswer", Loading Loading @@ -55,7 +55,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, }, Loading @@ -64,7 +64,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, }, Loading @@ -73,7 +73,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, } Loading script.js +6 −6 Original line number Diff line number Diff line Loading @@ -122,12 +122,12 @@ function quizCreator() { question_DIV.classList.add("question"); question_DIV.innerHTML = i.question; div.appendChild(question_DIV); //options - #TODO, automatizar as opções de acordo com a quantidade no array div.innerHTML += ` <button class="option-div" onclick="checker(this)">${i.options[0].text}</button> <button class="option-div" onclick="checker(this)">${i.options[1].text}</button> <button class="option-div" onclick="checker(this)">${i.options[2].text}</button> `; //options - get the avaiable options let options = ""; i.options.forEach( (option) => { options += `<button class="option-div" onclick="checker(this)">${option.text}</button>`; }); div.innerHTML += options; quizContainer.appendChild(div); } } Loading Loading
perguntas.js +4 −4 Original line number 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 // const quizArrayTeste = [ const quizArrayOLD = [ { id: "01.01", type: "noAnswer", Loading Loading @@ -55,7 +55,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, }, Loading @@ -64,7 +64,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, }, Loading @@ -73,7 +73,7 @@ const quizArrayTeste = [ type: "answer", theme: "Conhecimentos", 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", maxScore: 1, } Loading
script.js +6 −6 Original line number Diff line number Diff line Loading @@ -122,12 +122,12 @@ function quizCreator() { question_DIV.classList.add("question"); question_DIV.innerHTML = i.question; div.appendChild(question_DIV); //options - #TODO, automatizar as opções de acordo com a quantidade no array div.innerHTML += ` <button class="option-div" onclick="checker(this)">${i.options[0].text}</button> <button class="option-div" onclick="checker(this)">${i.options[1].text}</button> <button class="option-div" onclick="checker(this)">${i.options[2].text}</button> `; //options - get the avaiable options let options = ""; i.options.forEach( (option) => { options += `<button class="option-div" onclick="checker(this)">${option.text}</button>`; }); div.innerHTML += options; quizContainer.appendChild(div); } } Loading