-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
220 lines (165 loc) · 6.29 KB
/
home.php
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
217
218
219
220
<!doctype html>
<html
<head>
<!--- Responsive Platform --->
<meta name="viewport" content="width=device-width, initial-scale=1.0"&gt>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<!--- Favicon --->
<link rel="apple-touch-icon" sizes="180x180" href="./images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./images/favicon-16x16.png">
<link rel="manifest" href="./images/site.webmanifest">
<meta name="msapplication-TileColor" content="#fade95">
<meta name="theme-color" content="#fade95">
<!--- Check JavaScript --->
<noscript>
<meta http-equiv="refresh" content="0;URL='./javascript_disabled.html'" />
</noscript>
<!--- CSS Style --->
<link rel="stylesheet" type="text/css" href="home.css">
<title>Ghost Archery Simulator</title>
</head>
<main>
<body>
<a href="./about.html"><button>ℹ️ Acerca de...</button></a>
<br>
<!--- Web Page Banner --->
<img src="./images/archery.png" width="100%" height=auto>
<br>
<!--- URL Variables for PHP --->
<script>
function validateInput(){
// Get the values of the two input fields
var max_points = document.getElementById("max_points").value;
var min_points = document.getElementById("min_points").value;
var location = document.querySelector('input[name="simulation_location"]:checked').value;
var type = document.querySelector('input[name="simulation_type"]:checked').value;
var modality = document.querySelector('input[name="modality"]:checked').value;
// Check if the two fields are empty
if (max_points === "" || min_points === "") {
alert("Por favor complete todas las opciones obligatorias");
return;
}
// Check the value of the points fields
//Qualifiers
//Compound
if (type === "qualifiers") {
if (max_points > 31 || min_points < 0 || min_points >= max_points) {
alert("Los puntos introduciodos son incompatibles");
return;
}
}
//Competition
if (type === "competition" && location === "indoor") {
if (max_points > 31 || min_points < 0 || min_points >= max_points) {
alert("Los puntos introduciodos no son validos");
return;
}
}
if (type === "competition" && location === "outdoor") {
if (max_points > 61 || min_points < 0 || min_points >= max_points) {
alert("Los puntos introduciodos son incompatibles");
return;
}
}
// Check if the two fields contain only numbers
if (!/^[0-9]+$/.test(max_points) || !/^[0-9]+$/.test(min_points)) {
alert("Por favor introduzca solo numeros en el area de puntos");
return;
}
//Build the URL
try{
var competition_split = document.querySelector('input[name="competition_split"]:checked').value;
// Build the URL to pass the arguments to the PHP page with competition_split
var url = "simulator.php?max_points=" + max_points + "&min_points=" + min_points + "&type=" + type + "&location=" + location + "&modality=" + modality + "&competition_split=" + competition_split;
}catch (error) {
// Build the URL to pass the arguments to the PHP page without competition_split
var url = "simulator.php?max_points=" + max_points + "&min_points=" + min_points + "&type=" + type + "&location=" + location + "&modality=" + modality;
}
// Redirect to the PHP page
window.location.href = url;
}
</script>
<center>
<button id="startSimulationBtn" onclick="validateInput()" class="shadow__btn">Empezar Simulación</button>
</center>
<!--- Simulation Settings --->
<h2>Ajustes del Simulador</h2>
<a class="required-text">* Las opciones indicadas con un asterisco rojo son obligatorias</a>
<br>
<!--- Max and Min points --->
<h4>Puntos<h4>
<div class="aling-container">
<a class="required-text">*</a>
<div class="coolinput">
<label for="input" class="text">Max:</label>
<input type="text" placeholder="Puntos Máximos" id="max_points" class="input">
</div>
<a class="required-text">*</a>
<div class="coolinput">
<label for="input" class="text">Min:</label>
<input type="text" placeholder="Puntos Minimos" id="min_points" class="input">
</div>
</div> <b>Los puntos máximos son por entrada</b>
<!--- Simulation modality --->
<h4>Modalidad<h4>
<div class="aling-container">
<a class="required-text">*</a>
<div class="radio-inputs">
<label class="radio">
<input type="radio" name="modality" checked="" value="compound">
<span class="name">Compuesto</span>
</label>
<label class="radio">
<input type="radio" name="modality" checked="" value="other">
<span class="name">Olimpico, Tradicional, LongBow o Desnudo</span>
</label>
</div>
</div>
<!--- Simulation type --->
<h4>Tipo<h4>
<div class="aling-container">
<a class="required-text">*</a>
<div class="radio-inputs">
<label class="radio">
<input type="radio" name="simulation_type" checked="" value="qualifiers">
<span class="name">Eliminatorias</span>
</label>
<label class="radio">
<input type="radio" name="simulation_type" checked="" value="competition">
<span class="name">Competición</span>
</label>
</div>
</div>
<!--- Simulation location --->
<h4>Localización<h4>
<div class="aling-container">
<a class="required-text">*</a>
<div class="radio-inputs">
<label class="radio">
<input type="radio" name="simulation_location" checked="" value="indoor">
<span class="name">Interior</span>
</label>
<label class="radio">
<input type="radio" name="simulation_location" value="outdoor">
<span class="name">Exterior</span>
</label>
</div>
</div>
<h4>Avanzado<h4>
<a class="required-text">Funciones no disponibles actualmente</a>
<br>
Media Comeptición (Esta función te permite realizar un solo round de la competición)
<label class="container">
<input type="checkbox" name="competition_split" value="true">
<div class="checkmark"></div>
</label>
<br>
</body>
<footer>
<center><a href="https://piscinadeentropia.es">Creado por: Isaac Hernán Martí </a></center>
<center><a href="https://github.com/Isaaker/Ghost_Simulator_ES/blob/main/LICENSE.txt">© CC BY-NC-ND 4.0 </a></center>
</footer>
</main>
</html>