-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript..js
More file actions
175 lines (133 loc) · 5.25 KB
/
script..js
File metadata and controls
175 lines (133 loc) · 5.25 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
let count = 75;
let slidenum = 0;
let points = 0;
let questionarray = [
// lets see what this div class looks like for button, might have to change this
// here is Q1
`<h2>Javascript goes at the bottom of the HTML_____</h2>
<h6>Question 1</h6>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle corrrect next ">body</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">header</button>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">head</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">footer</button>
</div>`,
// here is Q2
`<h2>What do you put at the end of a javascript file when saving?</h2>
<h6>Question 2</h6>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle corrrect next ">.js</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">.html</button>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">.css</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">.md</button>
</div>`,
// here is Q3
`<h2>In javascript what is needed after a form</h2>
<h6>Question 3</h6>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle corrrect next ">event.prevent</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">getElementByID</button>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">.form</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">.venom joker</button>
</div>`,
// here is Q4
`<h2>How do you start a boiler plate in HTML</h2>
<h6>Question 4</h6>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle corrrect next ">!~Enter</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">@~Enter</button>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">#~Enter</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">$~Enter</button>
</div>`,
// here is Q5
`<h2>Is Javier awesome</h2>
<h6>Question 5</h6>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle corrrect next ">Yes</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">no</button>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">no</button>
<button type="button" class="btn btn-deep-purple btnstyle wrong next ">no</button>
</div>`,
]
let initialarray = [
`<h1>Game Over!</h1>
<div>
<form>
<label for="initials">Initials</label>
<input type="text" id="initials">
<button type="button" class="btn btn-deep-purple btnstyle" id="submit">Submit</button>
</form>
</div>
<hr></hr>
<p>Your score is:</p>`,
`<h1>High Scores</h1>`
]
document.getElementById('start').addEventListener('click', () => {
setInterval(() => {
if (count > 0) {
count--
document.getElementById('timer').innerHTML = `Time: ${count} secs`
}
else {
finalScore = points + count
document.getElementById('carddiv').innerHTML =
`<h1>Time up!</h1>
<div>
<form>
<label for="initials">Initials</label>
<input type="text" id="initials">
<button type="button" class="btn btn-deep-purple btnstyle" id="submit">Submit</button>
</form>
</div>
<hr></hr>
<p>Points: ${points}</p>
<p>Time left: ${count}</p>
<p>Final score: ${finalScore}</p>`
}
}, 1000);
//
document.getElementById('carddiv').innerHTML = questionarray[slidenum]
document.addEventListener('click', event => {
if (event.target.classList.contains('next')) {
if (slidenum < (questionarray.length)) {
slidenum++
console.log(slidenum)
document.getElementById('carddiv').innerHTML = questionarray[slidenum]
if (event.target.classList.contains('wrong')) {
count = count - 15
}
if (event.target.classList.contains('correct')) {
points += 5
}
}
if (slidenum > (questionarray.length - 1) || count <= 0) {
console.log(points, count)
finalScore = points + count
console.log(finalScore)
document.getElementById('carddiv').innerHTML =
`<h1>Game Over!!</h1>
<div>
<form>
<label for="initials">Initials</label>
<input type="text" id="initials">
<button type="button" class="btn btn-deep-purple btnstyle" id="submit">Submit</button>
</form>
</div>
<hr></hr>
<p>Points: ${points}</p>
<p>Time left: ${count}</p>
<p>Final score: ${finalScore}</p>`
}
}
})
})