first simple bracket

This commit is contained in:
Lukas Bachschwell 2017-03-16 10:41:51 +01:00
parent 8eea0119b1
commit 6233ae0927
3 changed files with 47 additions and 4 deletions

View File

@ -1,4 +1,3 @@
// @flow
'use strict';
// This is the backend client js
let iosocket: object = io.connect();
@ -9,7 +8,7 @@ iosocket.on('clientrefresh', () => {
});
iosocket.on('stateChange', () => {
location.reload();
});

View File

@ -20,3 +20,39 @@ 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 */ })
});

View File

@ -3,9 +3,12 @@
<head>
<meta charset="utf-8">
<title>Spielstand</title>
<link rel='stylesheet' href='/css/style.css' />
<link rel='stylesheet' href='/css/bootstrap.min.css' />
<link rel='stylesheet' type="text/css" href='/css/style.css' />
<link rel='stylesheet' type="text/css" href='/css/bootstrap.min.css' />
<link rel="stylesheet" type="text/css" href="/css/jquery.bracket.min.css" />
<script type='text/javascript' src='/js/jquery-3.1.1.min.js'></script>
<script type='text/javascript' src='/js/jquery.bracket.min.js'></script>
<script type='text/javascript' src='/js/bootstrap.min.js'></script>
<script type='text/javascript' src='/socket.io/socket.io.js'></script>
@ -13,6 +16,11 @@
</head>
<body>
<h1>Aktueller Spielstand</h1>
<div id="team-container">
</div>
<div class="team-box">
<h3>Team1</h3>
<div class="playername1">