|
|
|
@ -428,24 +428,64 @@ function renderBracket(options) { |
|
|
|
bracket.appendChild(roundDiv); |
|
|
|
bracket.appendChild(roundDiv); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function adjustSpacerHeight() { |
|
|
|
if (isBroadcast == false || isBroadcast == undefined) { |
|
|
|
// Find the tallest match position to determine total height needed
|
|
|
|
setTimeout(() => { |
|
|
|
let maxHeight = 0; |
|
|
|
const roundDivs = document.querySelectorAll(".butterfly-round"); |
|
|
|
Object.values(matchPositions).forEach((round) => { |
|
|
|
|
|
|
|
Object.values(round).forEach((position) => { |
|
|
|
// First, find the maximum bottom position across all rounds
|
|
|
|
if (position > maxHeight) { |
|
|
|
let globalMaxBottom = 0; |
|
|
|
maxHeight = position; |
|
|
|
|
|
|
|
|
|
|
|
roundDivs.forEach((roundDiv) => { |
|
|
|
|
|
|
|
const matches = roundDiv.querySelectorAll(".butterfly-match"); |
|
|
|
|
|
|
|
matches.forEach((match) => { |
|
|
|
|
|
|
|
const bottom = match.offsetTop + match.offsetHeight; |
|
|
|
|
|
|
|
if (bottom > globalMaxBottom) { |
|
|
|
|
|
|
|
globalMaxBottom = bottom; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Add extra space for the match height itself
|
|
|
|
// Now create and position footers for all rounds at the same y-position
|
|
|
|
const spacerHeight = maxHeight + matchHeight / 2 + 40; // 100px extra padding
|
|
|
|
roundDivs.forEach((roundDiv, index) => { |
|
|
|
document.getElementById("bracket-spacer").style.height = |
|
|
|
// Get the match templates from this round to extract data
|
|
|
|
`${spacerHeight}px`; |
|
|
|
const roundMatches = rounds[index] || []; |
|
|
|
|
|
|
|
if (roundMatches.length > 0) { |
|
|
|
|
|
|
|
const firstMatchTemplate = roundMatches[0].closest(".match-template"); |
|
|
|
|
|
|
|
const roundId = firstMatchTemplate.dataset.roundId; |
|
|
|
|
|
|
|
const realRoundIndex = firstMatchTemplate.dataset.roundIndex; |
|
|
|
|
|
|
|
if (realRoundIndex > 1) { |
|
|
|
|
|
|
|
// Create footer div
|
|
|
|
|
|
|
|
const footerDiv = document.createElement("div"); |
|
|
|
|
|
|
|
footerDiv.className = "round-footer"; |
|
|
|
|
|
|
|
footerDiv.style.width = `${responsiveMatchWidth}px`; |
|
|
|
|
|
|
|
footerDiv.style.paddingBottom = "40px"; |
|
|
|
|
|
|
|
footerDiv.style.textAlign = "center"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create footer content
|
|
|
|
|
|
|
|
let linkSpan = document.createElement("a"); |
|
|
|
|
|
|
|
linkSpan.className = "small styled-link"; |
|
|
|
|
|
|
|
linkSpan.textContent = "accès au tableau de classement"; |
|
|
|
|
|
|
|
if (roundId) { |
|
|
|
|
|
|
|
linkSpan.href = `/tournament/${tournamentId}/round/${roundId}/bracket/`; |
|
|
|
|
|
|
|
linkSpan.style.cursor = "pointer"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isBroadcast == false) { |
|
|
|
footerDiv.appendChild(linkSpan); |
|
|
|
adjustSpacerHeight(); |
|
|
|
|
|
|
|
|
|
|
|
// Create a container that will sit at the same position for all rounds
|
|
|
|
|
|
|
|
const footerContainer = document.createElement("div"); |
|
|
|
|
|
|
|
footerContainer.style.position = "absolute"; |
|
|
|
|
|
|
|
footerContainer.style.top = `${globalMaxBottom}px`; // Same position for all footers
|
|
|
|
|
|
|
|
footerContainer.style.width = "100%"; |
|
|
|
|
|
|
|
footerContainer.appendChild(footerDiv); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add to the round div
|
|
|
|
|
|
|
|
const matchesContainer = |
|
|
|
|
|
|
|
roundDiv.querySelector(".matches-container"); |
|
|
|
|
|
|
|
matchesContainer.appendChild(footerContainer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, 100); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|