-
Notifications
You must be signed in to change notification settings - Fork 0
/
text_handler.js
48 lines (41 loc) · 1.67 KB
/
text_handler.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
sorry for the mess. this script handles changing text
based on user input, showing text after user selects their
team, and handles all of the table changes :p
*/
// change for 'Deine gewähltes Team ist'
document.getElementById('selectTeam')
.addEventListener('change', function () {
'use scrict';
// first change the 'your selected team' text to match
// what team they picked. after that show the text that
// allows them to pick their team
let sel = document.getElementById('selectTeam');
let value = sel.options[sel.selectedIndex].text;
let text = 'Deine gewähltes Team ist: ' + value;
document.getElementById('selectedT').textContent = text;
// show the 'your selected game' text
document.getElementById('selectGameText').classList.remove('hidden'); // text
document.getElementById('selectedG').classList.remove('hidden'); // info text
});
// change for 'Dein gewähltes Spiel ist'
document.getElementById('selectGame')
.addEventListener('change', function () {
'use scrict';
// Order:
// First: Update 'selected game is' text
// Second: Update the table by calling updateTable() in get_data
let sel = document.getElementById('selectGame');
let value = sel.options[sel.selectedIndex].text;
let text = 'Dein gewähltes Spiel ist: ' + value;
document.getElementById('selectedG').textContent = text;
// update the table
let table = document.getElementById('dataTable');
table.classList.add('hidden');
let tableText = document.getElementById('tableText');
tableText.classList.add('hidden');
let selectTeam = document.getElementById('selectTeam');
let team = selectTeam.options[selectTeam.selectedIndex].text;
let game = parseInt(value);
updateTable(team, game);
});