uniScore/public/js/front_client.js

59 lines
1.3 KiB
JavaScript

'use strict';
let iosocket = io.connect();
// setup all my handlers
iosocket.on('clientrefresh', () => {
location.reload();
});
iosocket.on('stateChange', () => {
location.reload();
});
// get my state
let context = 'main';
iosocket.emit('loadState',context);
function createTeam(member1, member2){
}
var singleElimination = {
"teams": [ // Matchups
["Team 1", "Team 2"], // First match
["Team 3", "Team 4"] // Second match
],
"results": [ // List of brackets (single elimination, so only one bracket)
[ // List of rounds in bracket
[ // First round in this bracket
[1, 2], // Team 1 vs Team 2
[3, 4] // Team 3 vs Team 4
],
[ // Second (final) round in single elimination bracket
[5, 6], // Match for first place
[7, 8] // Match for 3rd place
]
]
]
}
var minimalData = {
teams : [
["Team 1", "Team 2"], /* first matchup */
["Team 3", "Team 4"] /* second matchup */
],
results : [
[[1,2]], /* first round */
[[4,6]] /* second round */
]
}
$( document ).ready(function() {
console.log('done')
$('#team-container').bracket({
init: minimalData /* data to initialize the bracket with */ })
});