feat: allow n Teams
This commit is contained in:
19
script.js
19
script.js
@@ -2,9 +2,12 @@
|
||||
|
||||
function randomizeTeams() {
|
||||
let teamCount = 2;
|
||||
if(document.getElementById("threeTeams").checked == true){
|
||||
if(document.getElementById("threeTeams").checked){
|
||||
teamCount = 3;
|
||||
}
|
||||
if(document.getElementById("nTeams").checked){
|
||||
teamCount = document.getElementById("nTeamsTextField").value;
|
||||
}
|
||||
const outputField = document.getElementById("teamOutput");
|
||||
let textinput = document.getElementById("playerNames").value;
|
||||
let names = textinput.split('\n').map(function(str){return str.trim();});
|
||||
@@ -43,4 +46,16 @@ function* iter(list){
|
||||
yield list[index % list.length];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function textchangelistener(){
|
||||
let elem = document.getElementById("nTeamsTextField");
|
||||
if(this.checked && this.id == "nTeams"){
|
||||
elem.style.display = "block";
|
||||
}
|
||||
else {
|
||||
elem.style.display = "none";
|
||||
}
|
||||
}
|
||||
buttons = document.querySelectorAll("input[type='radio']");
|
||||
buttons.forEach((x) => x.addEventListener("change", textchangelistener));
|
||||
Reference in New Issue
Block a user