-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
216 lines (185 loc) · 6.6 KB
/
index.html
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bracket Tournament Creator</title>
<style>
/* Basic styling for the body */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
margin: 20px;
background-color: #666;
color: #ffd700; /* Golden Yellow */
}
/* Styling for the main title */
h1 {
color: #ffd700;
margin-bottom: 20px;
}
/* Styling for labels used in form inputs */
label {
display: block;
margin-top: 10px;
font-size: 16px;
color: #ffd700;
}
/* Styling for form inputs and buttons */
input, button {
margin-top: 5px;
padding: 8px;
font-size: 14px;
}
/* Styling for input width */
input {
width: 200px;
}
/* Styling for buttons with hover effect */
button {
background-color: #ffd700;
color: #666;
border: none;
cursor: pointer;
border-radius: 4px;
}
button:hover {
background-color: #ccc;
color: #ffd700;
}
/* Styling for the bracket structure container */
#bracket {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-top: 20px;
}
/* Styling for each round in the bracket */
.round {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 20px;
position: relative;
}
/* Styling for each match within a round */
.match {
display: flex;
align-items: center;
margin-bottom: 20px;
position: relative;
}
/* Styling for the container of each team in a match */
.container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #ccc;
padding: 10px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 180px;
margin: 0 10px;
}
/* Styling for the input fields for each contestant's name */
.contestant {
width: 150px;
text-align: center;
padding: 8px;
font-size: 12px;
border: none;
border-radius: 6px;
margin: 0 0 5px;
background-color: #fff;
color: #333;
outline: none;
}
/* Styling for the "vs" text between teams in a match */
.vs {
font-size: 16px;
color: #555;
margin: 0 5px;
}
/* Styling for the connecting line between teams in a match */
.line {
height: 2px;
width: 60px;
background-color: #ffd700;
position: absolute;
top: 50%;
left: calc(50% - 60px / 2);
z-index: -1;
}
/* Styling for the "Declare Winner" button */
#declareWinner {
margin-top: 20px;
}
</style>
</head>
<body>
<!-- Main title for the Bracket Tournament Creator -->
<h1>BruhMyFrames's Bracket Tourney Creator</h1>
<!-- Form inputs for tournament information -->
<label for="tournamentName">Tournament Name:</label>
<input type="text" id="tournamentName">
<label for="numPlayersPerTeam">Number of Players per Team:</label>
<input type="number" id="numPlayersPerTeam">
<label for="numTeams">Number of Teams:</label>
<input type="number" id="numTeams">
<!-- Button to create the bracket based on user input -->
<button onclick="createBracket()">Create Bracket</button>
<!-- Container for dynamically generated bracket structure -->
<div id="bracket">
<!-- Bracket structure will be dynamically generated here -->
</div>
<!-- Button to declare the winner of the tournament -->
<button id="declareWinner" onclick="declareWinner()">Declare Winner</button>
<!-- JavaScript code for dynamic bracket creation -->
<script>
function createBracket() {
// Retrieve user input for tournament details
const tournamentName = document.getElementById('tournamentName').value;
const numPlayersPerTeam = parseInt(document.getElementById('numPlayersPerTeam').value);
const numTeams = parseInt(document.getElementById('numTeams').value);
// Calculate the number of rounds based on the number of teams
const rounds = Math.log2(numTeams);
// Initialize HTML structure for the bracket
let bracketHtml = `<h2>${tournamentName}</h2><div id="bracket">`;
// Loop through each round
for (let round = 1; round <= rounds; round++) {
bracketHtml += `<div class="round" id="round${round}">`;
// Loop through each match in the round
for (let match = 1; match <= numTeams / Math.pow(2, round); match++) {
bracketHtml += `
<div class="match" id="match${round}-${match}">
<div class="container" id="match${round}-${match}team1">
${generatePlayerInputs(numPlayersPerTeam)}
</div>
<div class="line"></div>
<div class="container" id="match${round}-${match}team2">
${generatePlayerInputs(numPlayersPerTeam)}
</div>
</div>
`;
}
bracketHtml += `</div>`;
}
bracketHtml += `</div>`;
document.getElementById('bracket').innerHTML = bracketHtml;
}
// Function to generate HTML for player input fields
function generatePlayerInputs(numPlayers) {
let inputHtml = '';
for (let i = 1; i <= numPlayers; i++) {
inputHtml += `<input class="contestant" type="text" placeholder="Player ${i}">`;
}
return inputHtml;
}
// Function to navigate to the winner information page
function declareWinner() {
window.location.href = "winner.html";
}
</script>
</body>
</html>