-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·114 lines (96 loc) · 3.41 KB
/
script.js
File metadata and controls
executable file
·114 lines (96 loc) · 3.41 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
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
/* -Botones que me indican la configuracion de la competicion
-Agregar participantes o eliminarlos sin problema respetando un minimo de 4.
-Hacer algoritmo para que tome numeros pares de jugadores en el sistema de copa/liga y deje llaves/fechas libres.
-Averiguar sobre como funciona la generacion de numeros random en Javascript.
-Generar un estilo simple de como se veria la llave/fecha en HTML con CSS y copiarlo para el resto de llaves.
-Mostrar resultados acordes al tamaño en pantalla.
-No sacar los ajustes de la pagina, asi se pueden cambiar en cualquier momento sin tener que recargar la pagina.
*/
var numeros_descartados = [];
function agregarParticipante() {
var fila_participante = document.getElementsByClassName("fila_participante");
var numeroDeParticipantes = fila_participante.length;
var tablerow = fila_participante[numeroDeParticipantes - 1].cloneNode(true);
const tabla = document.getElementById("tabla_participantes");
tabla.appendChild(tablerow);
var boton = tablerow.getElementsByClassName("botonEliminar");
console.log(boton);
boton[0].disabled = false;
reorganizarNumsPost();
}
function eliminarParticipante(toRemove) {
toRemove.remove();
reorganizarNumsPost();
}
function reorganizarNumsPost() {
var numero = document.getElementsByClassName("jugador-numero");
for (i = 0; i < numero.length; i++) {
numero[i].textContent = i + 1;
}
}
function Generar() {
const ArrayParticipantes = [];
var participante = document.getElementsByClassName("inputParticipante");
for (i = 0; i < participante.length; i++) {
ArrayParticipantes.push(participante[i].value);
}
//console.log(ArrayParticipantes);
var Fechas = [];
//alert("Generado");
GenerarArrayParticipantes();
GenerarCruces();
ImprimirFechas();
var botonExportar = document.getElementById("botonExportar");
botonExportar.disabled = false;
}
function NumerosAleatorios() {
var x = document.getElementsByClassName("inputParticipante");
for (i = 0; i < x.length; i++) {
var num = getRndInteger(1, x.length);
//log every number into console
//console.log(num);
}
}
function GenerarCruces() {}
function ImprimirFecha(ArrayFechas) {
for (i = 0; i < ArrayFechas.length; i++) {}
var cruce_partido = document.createElement("p");
cruce_partido.innerHTML = "este es un textodeprueba";
const fixture = document.getElementById("fixture");
fixture.appendChild(cruce_partido);
}
function DiseñarFixture() {}
function ExportarCSV() {}
function ExportarPNG() {}
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function DiscardRandomNumbers(min, max, banned_numbers = null) {
banned_numbers = [];
var output = Math.floor(Math.random() * (max - min + 1)) + min;
console.log(output);
if (banned_numbers.includes(output)) {
DiscardRandomNumbers(min, max, banned_numbers);
} else {
banned_numbers.push(output);
}
return output;
}
function ShuffleNumbers(min, max, banned_numbers = []) {
var output = Math.floor(Math.random() * (max - min + 1)) + min;
console.log(output);
if (banned_numbers.includes(output) && true) {
//reemplazar el "true"
ShuffleNumbers(min, max, banned_numbers);
} else {
banned_numbers.push(output);
console.log(banned_numbers);
return output;
}
}
function NumDescartado(array1) {
return array1.pop();
}
function Shuffle(array1, output_array = []) {
getRndInteger(0, array1.length);
}