-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsevenWesterosUpdate.html
More file actions
105 lines (91 loc) · 3.67 KB
/
sevenWesterosUpdate.html
File metadata and controls
105 lines (91 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<html>
<body>
<input>
<label id="lblQ"></label><input id="restxt" type="text"><button id="btnRes">A</button><label id="lblR"></label>
</main>
<script type="text/javascript">
var question = document.getElementById('lblQ');
var respond = document.getElementById('lblR');
var restxt = document.getElementById('restxt');
var btnRes = document.getElementById('btnRes');
var questCount = 0;
btnRes.addEventListener('click', function(){
if(kingdomArray[questCount].comparison(restxt.value)) {
respond.innerHTML = kingdomArray[questCount].correctResponse;
} else {
respond.innerHTML = kingdomArray[questCount].wrongResponse;
}
questCount = questCount + 1;
if(questCount > 6) questCount = 0;
question.innerHTML = kingdomArray[questCount].question;
});
function Kingdom(name, question, correctResponse, wrongResponse) {
this.name = name;
this.question = question;
this.correctResponse = correctResponse;
this.wrongResponse = wrongResponse;
this.comparison = function(userAnswer) {
return this.name == userAnswer;
}
}
var triviaAnswer = [
"north", //0
"vale", //1
"riverlands", //2
"westerlands", //3
"stormlands", //4
"reach", //5
"dorne"
]; //6
var trivia = [
"What is the largest kingdom in Westeos?",
"Which mountain kingdom has the castle Eyrie?",
"The warden of this kingdom has a fish as his sigil",
"This prosperous kingdom houses the family that always pays their debts",
"This kingdom is known for its termultous weather and the Baratheon family",
"This kingdom houses the family whos words are 'Growing strong'",
"This southern kingdom is mostly dessert and snakes."];
var triviaCorrectResponse =
["That's correct! Do you have some Stark heritage?", //North
"Correct, clearly you have made the journey up the mountain to the Eyrie", //Vale
"Yes, that's right. Swim on and be unharmed.", //Riverlands
"Yes, you must have the cunning of Lan the clever.", //Westerlands
"That's right! I see the foundation of your knowledge is as strong as Storm's End", //Stormlands
"Yes! Your knowledge grows strong.", //Reach
"Unbowed, Unbent, Unbroken: Your answer is right"]; //Dorne
var triviaWrongResponse = [
"Winter is coming and you have failed.",
"Wrong, you are thrown out of the moon door.",
"No, You decide to attend a wedding at the Frey's...and well you know what can happen at Frey weddings!",
"No, thats wrong. A Lannister always pays their debts",
"No, thats wrong. Much like the former castles of Storm's End you crumple and fall.",
"That answer is like the thorn on a Tyrell rose. Its so wrong it hurts.",
"Thats wrong. You're bit by a dornish viper."
];
var kingdomArray = [];
var j = 0;
while(j < 7) {
kingdomArray.push(new Kingdom(triviaAnswer[j], trivia[j], triviaCorrectResponse[j], triviaWrongResponse[j]));
j++;
}
// for(i = 0; i < 7; i++ ) {
// var userInput = prompt(kingdomArray[i].question).toLowerCase();
// if(kingdomArray[i].comparison(userInput)) {
// alert(kingdomArray[i].correctResponse);
// } else {
// alert(kingdomArray[i].wrongResponse);
// }
// }
question.innerHTML = kingdomArray[questCount].question;
/*
kingdomArray.push(new Kingdom(triviaAnswer[0], trivia[0]));
kingdomArray.push(new Kingdom(triviaAnswer[1], trivia[1]));
kingdomArray.push(new Kingdom(triviaAnswer[2], trivia[2]));
kingdomArray.push(new Kingdom(triviaAnswer[3], trivia[3]));
kingdomArray.push(new Kingdom(triviaAnswer[4], trivia[4]));
kingdomArray.push(new Kingdom(triviaAnswer[5], trivia[5]));
kingdomArray.push(new Kingdom(triviaAnswer[6], trivia[6]));
*/
</script>
</body>
</html>