(function () { "use strict"; var loadingDiv = document.getElementById("scoreboard-loading"); var recentSection = document.getElementById("recent-games-section"); var recentTbody = document.querySelector("#recent-games-table tbody"); var popularSection = document.getElementById("popular-section"); var popularRow = document.getElementById("popular-row"); var leaderboardsSection = document.getElementById("leaderboards-section"); var leaderboardsContainer = document.getElementById("leaderboards-container"); var emptyDiv = document.getElementById("scoreboard-empty"); function formatTime(seconds) { var mins = Math.floor(seconds / 60); var secs = Math.floor(seconds % 60); return mins + ":" + (secs < 10 ? "0" : "") + secs; } function formatDate(iso) { return new Date(iso).toLocaleDateString(); } function titleCase(str) { return str.charAt(0).toUpperCase() + str.slice(1); } function escapeHtml(str) { var div = document.createElement("div"); div.textContent = str; return div.innerHTML; } // Recent games from localStorage function getRecentGames() { try { return JSON.parse(localStorage.getItem("ws-recent-games") || "[]"); } catch (e) { return []; } } function renderRecentGames(games) { recentTbody.innerHTML = ""; games.forEach(function (g) { var tr = document.createElement("tr"); tr.innerHTML = "
' + c.completed_games + ' games completed
' + ' Play' + '| # | Player | Time | ' + 'Board | Words | Date | ' + '
|---|
Failed to load scoreboard data.
'; } } loadScoreboard(); })();