-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathteams-8.html
135 lines (122 loc) · 4.75 KB
/
teams-8.html
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
<!DOCTYPE html>
<html>
<head>
<title>Tournament Brackets</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="dist/img/icons/favicon.ico" rel="icon" type="image/x-icon"/>
<link rel="apple-touch-icon" sizes="180x180" href="dist/img/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="dist/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="dist/img/icons/favicon-16x16.png">
<link rel="manifest" href="dist/img/icons/site.webmanifest">
<link rel="mask-icon" href="dist/img/icons/safari-pinned-tab.svg" color="#494949">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="msapplication-TileImage" content="dist/img/icons/mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="dist/js/vendor.js"></script>
<link rel="stylesheet" href="dist/css/app.css">
<script type="text/javascript">
$(function () {
var demos = ['doubleElimination']
$.each(demos, function (i, d) {
var demo = $('div#' + d)
$('<div class="demo animated fadeIn slow"></div>').appendTo(demo)
})
})
</script>
</head>
<body class="render">
<nav class="navbar-fixed-top">
<h2 class="animated fadeInDown">Brackets<span class="event">- 8 teams, 3 rounds</span></h2>
<div class="docs-link animated fadeInRight"><a href="http://www.aropupu.fi/bracket/" target="_blank">jQuery Docs</a></div>
<h5 class="nav"><a href="index.html" target="_self">32 teams</a><a href="teams-16.html" target="_self">16 teams</a><a class="active" href="teams-8.html" target="_self">8 teams</a><a href="no-scores.html" target="_self">no scores</a><a href="double.html" target="_self">Double</a><a
target="_blank" href="data-8.json">json</a><a href="javascript:window.print()">Print</a></h5>
</nav>
<div class="turnament-bracket">
<div id="doubleElimination" class="graph-block"></div>
</div>
<script type="text/javascript">
function saveFn(data, userData) {
var json = jQuery.toJSON(data)
$('#saveOutput').text(JSON.stringify(data, null, 2))
}
function edit_fn(container, data, place, time, doneCb) {
var input = $('<input type="text">')
input.val(data ? data.flag + ':' + data.name : '')
container.html(input)
input.focus()
input.blur(function () {
var inputValue = input.val()
if (inputValue.length === 0) {
doneCb(null); // Drop the team and replace with BYE
} else {
var flagAndName = inputValue.split(':') // Expects correct input
doneCb({flag: flagAndName[0], name: flagAndName[1]})
}
})
}
function render_fn(container, data, score, state) {
switch (state) {
case "empty-bye":
container.append("No team")
return;
case "empty-tbd":
container.append("Upcoming")
return;
case "entry-no-score":
case "entry-default-win":
case "entry-complete":
container.append('<img src="dist/img/flags/' + data.flag + '.png" /> ').append(data.name).append();
return;
}
}
$(function () {
$.getJSON("data-8.json", function (data) {
window.br = $('div#doubleElimination .demo').bracket({
dir: 'lr',
teamWidth: 474,
scoreWidth: 20,
matchMargin: 60,
roundMargin: 32,
centerConnectors: true,
init: data,
// save: function () {
// }, /* without save() labels are disabled */
decorator: {
edit: edit_fn,
render: render_fn
}
});
var r, m, matches;
var rounds = $('.round');
console.log('matches', matches);
for (r = 0; r < rounds.length; r++) {
matches = rounds.eq(r).find('.match');
console.log('matches', matches);
if (data.results[r]) {
for (m = 0; m < matches.length; m++) {
matches.eq(m).find('.teamContainer').prepend('<div class="match-label"><div class="match-location">' + data.results[r][m][2] + '</div><div class="match-date">' + data.results[r][m][3] + '</div><div class="match-id">' + data.results[r][m][4] + '</div></div>');
}
}
}
// add class for specific rounds number print
if ($('.round').length === 7) {
$("body").addClass("seven-rounds");
}
if ($('.round').length === 6) {
$("body").addClass("six-rounds");
}
if ($('.round').length === 5) {
$("body").addClass("five-rounds");
}
if ($('.round').length === 4) {
$("body").addClass("four-rounds");
}
if ($('.round').length === 3) {
$("body").addClass("three-rounds");
}
});
})
</script>
</body>
</html>