mirror of
https://github.com/alvierahman90/capitals_quiz.git
synced 2024-11-23 17:59:55 +00:00
visual tweaks
This commit is contained in:
parent
36805a64a6
commit
8af47e5abc
36
game.js
36
game.js
@ -220,7 +220,12 @@ function displayEndScreen() {
|
||||
|
||||
clearInterval(gameTimeIntervalId);
|
||||
|
||||
if (guessReverseFlag() || guessFlag()) {
|
||||
incorrectAnswersTable.innerHTML = "<tr> <th> country </th> <th> answer </th> <th> your answer </th> </tr>";
|
||||
correctAnswersTable.innerHTML = "<tr> <th> flag </th> <th> country </th> </tr>";
|
||||
}
|
||||
|
||||
if (guessReverseFlag()) {
|
||||
state.incorrectAnswers.forEach(ans => {
|
||||
var tr = document.createElement('tr');
|
||||
console.log(ans)
|
||||
@ -228,6 +233,34 @@ function displayEndScreen() {
|
||||
tr.appendChild(document.createElement('td'))
|
||||
tr.lastChild.innerHTML = ans.question.countryname
|
||||
|
||||
tr.appendChild(document.createElement('td'))
|
||||
tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
|
||||
|
||||
tr.appendChild(document.createElement('td'))
|
||||
tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.options[ans.userAnswer].code);
|
||||
|
||||
incorrectAnswersTable.appendChild(tr);
|
||||
})
|
||||
if (state.incorrectAnswers.length <= 0)
|
||||
incorrectAnswersTable.innerHTML = "no incorrect answers! go you!";
|
||||
|
||||
state.correctAnswers.forEach(ans => {
|
||||
var tr = document.createElement('tr');
|
||||
tr.appendChild(document.createElement('td'))
|
||||
tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.question.code);
|
||||
tr.appendChild(document.createElement('td'))
|
||||
tr.lastChild.innerHTML = ans.answer.countryname;
|
||||
correctAnswersTable.appendChild(tr);
|
||||
})
|
||||
} else {
|
||||
state.incorrectAnswers.forEach(ans => {
|
||||
var tr = document.createElement('tr');
|
||||
console.log(ans)
|
||||
|
||||
tr.appendChild(document.createElement('td'))
|
||||
if (guessCountry()) tr.lastChild.innerHTML = ans.question.capital
|
||||
else tr.lastChild.innerHTML = ans.question.countryname
|
||||
|
||||
tr.appendChild(document.createElement('td'))
|
||||
if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
|
||||
else tr.lastChild.innerHTML = ans.answer.answer;
|
||||
@ -247,9 +280,10 @@ function displayEndScreen() {
|
||||
tr.lastChild.innerHTML = ans.question.countryname
|
||||
tr.appendChild(document.createElement('td'))
|
||||
if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
|
||||
else tr.lastChild.innerHTML = ans.answer.answer;
|
||||
else tr.lastChild.innerHTML = ans.answer.capital;
|
||||
correctAnswersTable.appendChild(tr);
|
||||
})
|
||||
}
|
||||
if (state.correctAnswers.length <= 0)
|
||||
correctAnswersTable.innerHTML = "no correct answers. better luck next time :')";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user