-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
70 lines (55 loc) · 1.8 KB
/
app.js
File metadata and controls
70 lines (55 loc) · 1.8 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
const items = document.querySelectorAll('.dropdown-menu .group-item');
const dropdown = document.getElementById("dropdown-menu");
const nameInput = document.getElementById("name-input");
const teamButton = document.getElementById("team-button");
const groupTeams = document.getElementById("table-group");
const clearMatchBtn = document.getElementById("clear-last-users");
const ui = new UI();
eventListeners();
function eventListeners() {
teamButton.addEventListener("click", getData);
clearMatchBtn.addEventListener("click", getAllClear);
}
function getData(e) {
console.log(nameInput.value)
Request.prototype.getMatches(nameInput.value, (matchs) => {
console.log(matchs.team1.name, matchs.score1, matchs.team2.name, matchs.score2)
console.log(matchs)
ui.groupMatch(matchs);
});
if (nameInput.value == "") {
alert("Takım kısmını doldurunuz")
}
nameInput.value = "";
}
function getAllClear(e) {
ui.clearMatch();
}
items.forEach(item => {
item.addEventListener('click', function () {
const selectedText = this.textContent;
document.getElementById('dropdownButton').textContent = selectedText;
});
});
dropdown.addEventListener('change', function () {
if (dropdown.value === "") {
groupTeams.style.display = "none";
} else {
groupTeams.style.display = "block";
}
})
let select = document.getElementById("dropdown-menu");
select.addEventListener("change", (event) => {
let value = event.target.value;
if (value) {
console.log("istek at");
Request.prototype.getGroups(value, (data) => {
ui.showGroupInfo(data);
});
Request.prototype.getMatches();
// istek at
} else {
console.log("boşalt");
// boşalt
}
})