diff --git a/public/css/style.scss b/public/css/style.scss index facf64249..10150347d 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -254,6 +254,13 @@ a:hover { thead { color: var(--sub-color); font-size: .75rem; + + td { + background: var(--bg-color); + position: -webkit-sticky; + position: sticky; + top: 0; + } } tbody { @@ -263,6 +270,17 @@ a:hover { background: rgba(0, 0, 0, .1); } } + + tfoot { + td { + position: -webkit-sticky; + position: sticky; + bottom: 0; + background: var(--bg-color); + color: var(--main-color); + z-index: 4; + } + } } } diff --git a/public/index.html b/public/index.html index 668f80bf2..4bb48edcd 100644 --- a/public/index.html +++ b/public/index.html @@ -269,6 +269,17 @@ -
- + + + - + You + - + - + - + - + -
- + + @@ -474,6 +485,17 @@ -
- + + + - + You + - + - + - + - + -
- + + diff --git a/public/js/leaderboards.js b/public/js/leaderboards.js index f8e54af89..cab773ae3 100644 --- a/public/js/leaderboards.js +++ b/public/js/leaderboards.js @@ -125,7 +125,20 @@ function updateLeaderboards() { if (dailyData.board !== undefined) { dailyData.board.forEach((entry, index) => { let meClassString = ""; - if (entry.currentUser) meClassString = ' class="me"'; + if (entry.currentUser) { + meClassString = ' class="me"'; + $("#leaderboardsWrapper table.daily tfoot").html(` + + ${index + 1} + You + ${entry.wpm} + ${entry.raw} + ${entry.acc}% + ${entry.mode} ${entry.mode2} + ${moment(entry.timestamp).format("DD MMM YYYY
HH:mm")} + + `); + } $("#leaderboardsWrapper table.daily tbody").append(` ${ @@ -164,7 +177,20 @@ function updateLeaderboards() { if (globalData.board !== undefined) { globalData.board.forEach((entry, index) => { let meClassString = ""; - if (entry.currentUser) meClassString = ' class="me"'; + if (entry.currentUser) { + meClassString = ' class="me"'; + $("#leaderboardsWrapper table.global tfoot").html(` + + ${index + 1} + You + ${entry.wpm} + ${entry.raw} + ${entry.acc}% + ${entry.mode} ${entry.mode2} + ${moment(entry.timestamp).format("DD MMM YYYY
HH:mm")} + + `); + } $("#leaderboardsWrapper table.global tbody").append(` ${