Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MCQ Quiz App
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaston Morales
MCQ Quiz App
Commits
fc7a6665
Commit
fc7a6665
authored
Aug 31, 2023
by
Gaston Morales
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mudanças no layout, tela de fim de tema (parcial)
parent
5b001832
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
20 deletions
+46
-20
bgQuadroFinal.png
images/bgQuadroFinal.png
+0
-0
bgResultadoTema.png
images/bgResultadoTema.png
+0
-0
index.html
index.html
+8
-0
script.js
script.js
+14
-13
style.css
style.css
+24
-7
No files found.
images/bgQuadroFinal.png
0 → 100644
View file @
fc7a6665
47.6 KB
images/bgResultadoTema.png
0 → 100644
View file @
fc7a6665
102 KB
index.html
View file @
fc7a6665
...
@@ -58,6 +58,14 @@
...
@@ -58,6 +58,14 @@
</div>
</div>
<button
id=
"next-button"
>
Próxima
</button>
<button
id=
"next-button"
>
Próxima
</button>
</div>
</div>
<div
class=
"end-theme-screen"
>
<div
class=
"header"
>
Resultado
</div>
<div
class=
"explicacao"
>
</div>
<button
id=
"end-theme-button"
>
Próximo
</button>
</div>
<div
class=
"score-container hide"
>
<div
class=
"score-container hide"
>
<div
id=
"theme-header"
>
Desempenho por Temas
</div>
<div
id=
"theme-header"
>
Desempenho por Temas
</div>
<div
id=
"theme-score"
class=
"score-theme-container"
>
<div
id=
"theme-score"
class=
"score-theme-container"
>
...
...
script.js
View file @
fc7a6665
// Baseado no tutorial em https://codingartistweb.com/2022/06/quiz-app-with-javascript/ acessado em 02/08/2023
// Baseado no tutorial em https://codingartistweb.com/2022/06/quiz-app-with-javascript/ acessado em
displayContainer
02/08/2023
// Adaptado para pt-BR e acrescentadas funcionalidades adicionais por Gastón Morales@Faros Educacional
// Adaptado para pt-BR e acrescentadas funcionalidades adicionais por Gastón Morales@Faros Educacional
//
//
// Configurações
// Configurações
const
time4Question
=
0
// tempo em segundos (+1) para cada pergunta ser respondida, se 0 (zero) não tem tempo
const
time4Question
=
0
;
// tempo em segundos (+1) para cada pergunta ser respondida, se 0 (zero) não tem tempo
const
porTemas
=
true
// perguntas apresentadas agrupadas por tema (true) ou não (false)
const
porTemas
=
true
;
// perguntas apresentadas agrupadas por tema (true) ou não (false)
const
mostraQuadroFinal
=
true
;
// mostra (ou não) a tela final com a tabela de resultados
//References
//References
let
timerOnIcon
=
document
.
getElementById
(
"timer-on-icon"
);
let
timerOnIcon
=
document
.
getElementById
(
"timer-on-icon"
);
...
@@ -31,6 +32,10 @@ let startThemeScreen = document.querySelector(".start-theme-screen");
...
@@ -31,6 +32,10 @@ let startThemeScreen = document.querySelector(".start-theme-screen");
let
startThemeHeader
=
document
.
querySelector
(
".start-theme-screen .header"
);
let
startThemeHeader
=
document
.
querySelector
(
".start-theme-screen .header"
);
let
startThemeContent
=
document
.
querySelector
(
".start-theme-screen .explicacao"
);
let
startThemeContent
=
document
.
querySelector
(
".start-theme-screen .explicacao"
);
let
startThemeButton
=
document
.
getElementById
(
"start-theme-button"
);
let
startThemeButton
=
document
.
getElementById
(
"start-theme-button"
);
let
endThemeScreen
=
document
.
querySelector
(
".end-theme-screen"
);
let
endThemeHeader
=
document
.
querySelector
(
".end-theme-screen .header"
);
let
endThemeContent
=
document
.
querySelector
(
".end-theme-screen .explicacao"
);
let
endThemeButton
=
document
.
getElementById
(
"end-theme-button"
);
let
opcoesHTML
=
document
.
querySelector
(
".opcoes"
);
let
opcoesHTML
=
document
.
querySelector
(
".opcoes"
);
let
questionCount
=
0
;
let
questionCount
=
0
;
let
numberOfQuestionsShowed
=
0
;
let
numberOfQuestionsShowed
=
0
;
...
@@ -58,6 +63,7 @@ nextBtn.addEventListener(
...
@@ -58,6 +63,7 @@ nextBtn.addEventListener(
if
(
(
porTemas
?
themeCount
==
(
selectedThemes
.
length
-
1
)
:
true
)
&&
questionCount
==
quizArray
.
length
)
{
if
(
(
porTemas
?
themeCount
==
(
selectedThemes
.
length
-
1
)
:
true
)
&&
questionCount
==
quizArray
.
length
)
{
//hide question container and display score
//hide question container and display score
displayContainer
.
classList
.
add
(
"hide"
);
displayContainer
.
classList
.
add
(
"hide"
);
bodyContainer
.
classList
.
value
=
'bgFinalResult'
;
scoreContainer
.
classList
.
remove
(
"hide"
);
scoreContainer
.
classList
.
remove
(
"hide"
);
//user score
//user score
userScore
.
innerHTML
=
userScore
.
innerHTML
=
...
@@ -101,12 +107,14 @@ nextBtn.addEventListener(
...
@@ -101,12 +107,14 @@ nextBtn.addEventListener(
table
+=
"</tbody>
\
r
\n
</table>
\
r
\n
"
;
table
+=
"</tbody>
\
r
\n
</table>
\
r
\n
"
;
themeScore
.
innerHTML
=
table
;
themeScore
.
innerHTML
=
table
;
}
else
{
}
else
{
// Vamos para o próximo Tema
if
(
questionCount
==
quizArray
.
length
)
{
if
(
questionCount
==
quizArray
.
length
)
{
themeCount
+=
1
;
themeCount
+=
1
;
displayContainer
.
classList
.
add
(
"hide"
);
displayContainer
.
classList
.
add
(
"hide"
);
themeDisplay
(
themeCount
);
themeDisplay
(
themeCount
);
}
}
else
{
else
{
// Vamos para próxima pergunta
//display questionCount
//display questionCount
countOfQuestion
.
innerHTML
=
countOfQuestion
.
innerHTML
=
questionCount
+
1
+
" de "
+
quizArray
.
length
+
" perguntas"
;
questionCount
+
1
+
" de "
+
quizArray
.
length
+
" perguntas"
;
...
@@ -268,6 +276,8 @@ function themeListCreator() {
...
@@ -268,6 +276,8 @@ function themeListCreator() {
function
runQuiz
()
{
function
runQuiz
()
{
quizContainer
.
innerHTML
=
""
;
quizContainer
.
innerHTML
=
""
;
questionCount
=
0
;
questionCount
=
0
;
bodyContainer
.
classList
.
value
=
'bgQuiz'
;
displayContainer
.
classList
.
remove
(
"hide"
);
quizCreator
();
quizCreator
();
quizDisplay
(
questionCount
);
quizDisplay
(
questionCount
);
}
}
...
@@ -275,7 +285,6 @@ function runQuiz() {
...
@@ -275,7 +285,6 @@ function runQuiz() {
// Processes que select theme screen
// Processes que select theme screen
startThemeButton
.
addEventListener
(
"click"
,
()
=>
{
startThemeButton
.
addEventListener
(
"click"
,
()
=>
{
startThemeScreen
.
classList
.
add
(
"hide"
);
startThemeScreen
.
classList
.
add
(
"hide"
);
displayContainer
.
classList
.
remove
(
"hide"
);
runQuiz
();
runQuiz
();
});
});
...
@@ -345,20 +354,11 @@ function initial() {
...
@@ -345,20 +354,11 @@ function initial() {
});
});
// Se for "por Tema", apresenta a tela de seleção de temas
// para cada tema selecionado, mostra tela introdutória do tema
// , filtra as questões do banco buscando as questões do tema colocando em quizArray
// , limpa quizContainer e zera questionCount
// , chama quizCreator e quizDisplay
// Se não for "por Tema"... segue como está
//
if
(
porTemas
)
{
if
(
porTemas
)
{
// mostra tela seleção de temas e
// mostra tela seleção de temas e
selThemeScreen
.
classList
.
remove
(
"hide"
);
selThemeScreen
.
classList
.
remove
(
"hide"
);
}
}
else
{
else
{
displayContainer
.
classList
.
remove
(
"hide"
);
runQuiz
();
runQuiz
();
}
}
}
}
...
@@ -385,6 +385,7 @@ function startQuiz() {
...
@@ -385,6 +385,7 @@ function startQuiz() {
displayContainer
.
classList
.
add
(
"hide"
);
displayContainer
.
classList
.
add
(
"hide"
);
selThemeScreen
.
classList
.
add
(
"hide"
);
selThemeScreen
.
classList
.
add
(
"hide"
);
startThemeScreen
.
classList
.
add
(
"hide"
);
startThemeScreen
.
classList
.
add
(
"hide"
);
endThemeScreen
.
classList
.
add
(
"hide"
);
scoreContainer
.
classList
.
add
(
"hide"
);
scoreContainer
.
classList
.
add
(
"hide"
);
}
}
...
...
style.css
View file @
fc7a6665
...
@@ -21,10 +21,23 @@ body {
...
@@ -21,10 +21,23 @@ body {
background-image
:
url(images/bgIntro.png)
;
background-image
:
url(images/bgIntro.png)
;
}
}
.bgQuiz
{
background-image
:
url(images/bgQuiz.png)
;
}
.bgThemeResult
{
background-image
:
url(images/bgResultadoTema.png)
;
}
.bgFinalResult
{
background-image
:
url(images/bgQuadroFinal.png)
;
}
/* .start-screen, */
/* .start-screen, */
.intro-screen
,
.intro-screen
,
.select-theme-screen
,
.select-theme-screen
,
.start-theme-screen
{
.start-theme-screen
,
.end-theme-screen
{
background-color
:
#ffffff
;
background-color
:
#ffffff
;
padding
:
3.1em
1.8em
;
padding
:
3.1em
1.8em
;
width
:
80%
;
width
:
80%
;
...
@@ -46,6 +59,13 @@ body {
...
@@ -46,6 +59,13 @@ body {
font-weight
:
600
;
font-weight
:
600
;
}
}
.end-theme-screen
.header
{
color
:
#ffffff
;
font-size
:
4em
;
font-weight
:
600
;
text-align
:
center
;
}
.explicacao
{
.explicacao
{
height
:
80%
;
height
:
80%
;
overflow
:
auto
;
overflow
:
auto
;
...
@@ -88,24 +108,21 @@ button {
...
@@ -88,24 +108,21 @@ button {
font-size
:
1em
;
font-size
:
1em
;
margin-top
:
1.5em
;
margin-top
:
1.5em
;
padding
:
0.7em
1.8em
;
padding
:
0.7em
1.8em
;
border-radius
:
0.3em
;
border
:
#ffffff
1px
solid
;
border-radius
:
1em
;
}
}
#start-button
,
#start-button
,
#intro-button
,
#intro-button
,
#select-theme-button
,
#select-theme-button
,
#start-theme-button
,
#start-theme-button
,
#end-theme-button
,
#next-button
{
#next-button
{
background-color
:
#0454A1
;
background-color
:
#0454A1
;
color
:
#ffffff
;
color
:
#ffffff
;
float
:
right
;
float
:
right
;
}
}
#next-button
{
border
:
#ffffff
1px
solid
;
border-radius
:
1em
;
}
#start-button
{
#start-button
{
position
:
absolute
;
position
:
absolute
;
transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment