`; AttachSearchEvents(); come back; } // Analyze tennis data using column A as an indicator const match = (); const dataRows = data.slice(1); // Ignore header let LastRoundInfo = null; // To keep track of the last round/date displayed // Loop through all rows and use column A to determine matches for (let i = 0; i < dataRows.length; i++) { const currentRow = dataRows(i); // Les lignes vont par paires consécutives : joueur 1 (date en col A) puis joueur 2 (tour en col A) if (currentRow.length > 0 && currentRow(0) && currentRow(0).trim() !== ”) { // This line is the first player in the match const player1Row = currentRow; // Player 2 is always on the next row immediately let player2Row = null; if (i + 1 < dataRows.length) { player2Row = dataRows(i + 1); i++; // Sauter la ligne joueur 2 pour ne pas la retraiter comme un nouveau match }// Le tour est en colonne A du joueur 2 const roundInfo = player2Row && player2Row(0) ? player2Row(0).trim() : ''; // Si on a trouvé les deux joueurs, créer le match if (player2Row && player1Row.length > 7 && player2Row.length > 7) { const player1Name = player1Row(1); // Column B const player2Name = player2Row(1); // Column B // Set the scores (columns D to H) – save the original values const Scores = (); for (let setIndex = 3; setIndex <= 7; setIndex++) { // Colonnes D à H (index 3 à 7) const p1Score = player1Row(setIndex) || ''; const p2Score = player2Row(setIndex) || ''; if (p1Score !== '' || p2Score !== '') { scores.push({ player1: p1Score, player2: p2Score }); } } if (player1Name && player2Name && scores.length > 0) { // Determine whether to display the round header const showRoundHeader = LastRoundInfo !== roundInfo; match.push({ player1: player1Name, player2: player2Name, ratings: ratings, roundInfo: roundInfo, showRoundHeader: showRoundHeader }); // Update the last displayed round if (showRoundHeader) { lastRoundInfo = roundInfo; } } } } } // Generate HTML matches let matchHTML = ”; match.forEach((match, index) => { const player1Logo = findPlayerLogo(match.player1); const player2Logo = findPlayerLogo(match.player2); // Determine the winner of the match according to the rules of tennis const winner = defineWinner(match.scores); const player1Name = formatPlayerName(match.player1); const player2Name = formatPlayerName(match.player2 // When add a round header if (match.showRoundHeader) { matchHTML += “; } // Generate player 1 scores let player1ScoresHTML = ”; if (winner === 1) { player1ScoresHTML += ” } else { player1ScoresHTML += ”; isWinningSet = setWinner === 1; const formattedScore = formatScoreWithSuperscript(setScore.player1);
${formattedScore}
`; }); // Generating game results 2 let player2ScoresHTML = ”; if (winner === 2) { player2ScoresHTML += ”; } Else { player2ScoresHTML += ”; // Free up space for alignment } match.scores.forEach(setScore => { const setWinner = defineSetWinner(setScore.player1, setScore.player2); const isWinningSet = setWinner === 2; const formattedScore = formatScoreWithSuperscript(setScore.player2); player2ScoresHTML += `
${formattedScore}
`; }); matchHTML += ` ${player1Logo ? `` : ”}
${player1Name}
${player1ScoresHTML}
${player2Logo ? `` : ”}
${player2Name}
${player2ScoresHTML}
`; }); // Update the contents of the widgetContainer.querySelector(‘.rw-widget’).innerHTML = `
${matchesHTML}
`; // Add an update indicator const widgetElement =Container.querySelector(‘.rw-widget’); const LastUpdateDiv = document.createElement(‘div’); LastUpdateDiv.className=”rw-widget-last-update”; LastUpdateDiv.innerHTML = `
${formatLastUpdate()} `; widgetElement.appendChild(lastUpdateDiv); // Attach search events AttachSearchEvents(); // Apply the filter if there is a search term if (currentSearchTerm && currentSearchTerm.trim() !== ”) { filterMatches(currentSearchTerm); } } // Global variable for storing the interval let restartInterval = null; // Function for formatting the last update date function formatLastUpdate() { const now = new Date(); return `Last update: ${now.toLocaleTimeString(‘fr-FR’)}`; } // Function for starting automatic reboot function startAutoRefresh() { if (refreshInterval) { clearInterval(refreshInterval); } if (config.autoRefreshMinutes > 0) {refreshInterval = setInterval(() => { console.log(‘Automatically reloading widget…’); initWidget(); }, config.autoRefreshMinutes * 60 * 1000); } } // Main initialization function async function initWidget() { constContainer = document.getElementById(config.widgetId); if (!container) return; // Create a widget structure with a title and searchContainer.innerHTML = “; try { // First load the player logos playerLogos = await loadPlayerLogos(); // Fetch the match data const response = await fetch(config.dataUrl); if (!response.ok) { throw new Error(“Error loading data”); } Const csvText = await response.text(); const parsedData = parseCSV(csvText); // Save data globally allMatches = parsedData; if (parsedData.length === 0) {Container.querySelector(‘.rw-widget’).innerHTML = “; AttachSearchEvents(); come back; } // Show matches renderMatches(parsedData); // Start auto-reload after the first boot if (!refreshInterval) { startAutoRefresh(); } } catch (error) { console.error(“Widget error:”, error); Container.querySelector(‘.rw-widget’).innerHTML = ` `; AttachSearchEvents(); } } // Initialize the widget initWidget(); // The widget will automatically reload every 5 minutes } )()
Find all the Wimbledon women’s draw results with end-of-match updates and live scores from live matches.