-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.mjs
More file actions
38 lines (34 loc) · 1.17 KB
/
index.mjs
File metadata and controls
38 lines (34 loc) · 1.17 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
import { createBracket } from 'https://cdn.jsdelivr.net/npm/bracketry@latest/+esm'
import tennis_singles from './data.mjs'
const mobileOptions = {
navButtonsPosition: 'beforeTitles',
visibleRoundsCount: 1,
matchMaxWidth: 360,
leftNavButtonHTML: `<div style="padding: 7px;">< PREV ROUND</div>`,
rightNavButtonHTML: `<div style="padding: 7px;">NEXT ROUND ></div>`,
roundTitlesFontSize: 26,
roundTitlesVerticalPadding: 4,
matchFontSize: 14,
matchHorMargin: 2,
distanceBetweenScorePairs: 10,
disableHighlight: true,
verticalScrollMode: 'mixed',
scrollButtonPadding: '0px'
}
let options = {
getEntryStatusHTML: (es) => {
return `<div style="width: 30px; text-align: center; color: #818181; font-size: 12px;">${es || ''}</div>`
},
getNationalityHTML: p => {
return `<img style="width: 16px; visibility: ${p.nationality ? 'visible' : 'hidden'}"
src="https://flagcdn.com/16x12/${p.nationality?.toLowerCase()}.png">`
}
}
if (window.innerWidth < 700) {
options = { ...options, ...mobileOptions }
}
createBracket(
tennis_singles,
document.querySelector('#bracketry-wrapper'),
options
)