-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_view.js
33 lines (33 loc) · 1.3 KB
/
game_view.js
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
export let View = class {
constructor(model) {
this.model = model;
}
restartClickHandler() {
// Change the view and reset the model.
document.getElementById("fact_div").style.display = "none";
document.getElementById("info_div").style.display = "none";
document.getElementById("reset_button").style.display = "none";
this.model.resetData();
var cell = document.getElementById("api");
cell.remove();
document.getElementById("choice_div").style.display = "flex";
document.getElementById("api_buttons").style.display = "flex";
}
showDataView() {
// Change the view.
document.getElementById("choice_div").style.display = "none";
document.getElementById("api_buttons").style.display = "none";
document.getElementById("fact_div").style.display = "flex";
document.getElementById("info_div").style.display = "flex";
document.getElementById("reset_button").style.display = "flex";
}
async insertFactClickHandler(select) {
var cell = document.getElementById("api_div");
var image = new Image(600,600);
image.id = "api"
var url = await this.model.getData(select);
image.src = url;
cell.appendChild(image);
return cell;
}
}