mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
showing lb memory
This commit is contained in:
parent
abaa559727
commit
83d422b1df
1 changed files with 36 additions and 0 deletions
|
|
@ -101,6 +101,8 @@ function update() {
|
|||
clearTable(60);
|
||||
updateFooter(15);
|
||||
updateFooter(60);
|
||||
checkLbMemory(15);
|
||||
checkLbMemory(60);
|
||||
fillTable(15);
|
||||
fillTable(60);
|
||||
$("#leaderboardsWrapper .leftTableWrapper").removeClass("invisible");
|
||||
|
|
@ -315,6 +317,40 @@ export function show() {
|
|||
}
|
||||
}
|
||||
|
||||
function checkLbMemory(lb) {
|
||||
let side;
|
||||
if (lb === 15) {
|
||||
side = "left";
|
||||
} else {
|
||||
side = "right";
|
||||
}
|
||||
|
||||
let memory = DB.getSnapshot()?.lbMemory?.time?.[lb]?.english;
|
||||
|
||||
if (memory && currentRank[lb]) {
|
||||
let difference = memory - currentRank[lb].rank;
|
||||
if (difference > 0) {
|
||||
DB.updateLbMemory("time", lb, "english", currentRank[lb].rank, true);
|
||||
$($(`#leaderboardsWrapper table.${side} tfoot tr td`)[1]).append(
|
||||
` (<i class="fas fa-fw fa-angle-up"></i>${Math.abs(
|
||||
difference
|
||||
)} since you last checked)`
|
||||
);
|
||||
} else if (difference < 0) {
|
||||
DB.updateLbMemory("time", lb, "english", currentRank[lb].rank, true);
|
||||
$($(`#leaderboardsWrapper table.${side} tfoot tr td`)[1]).append(
|
||||
` (<i class="fas fa-fw fa-angle-down"></i>${Math.abs(
|
||||
difference
|
||||
)} since you last checked)`
|
||||
);
|
||||
} else {
|
||||
$($(`#leaderboardsWrapper table.${side} tfoot tr td`)[1]).append(
|
||||
` (= since you last checked)`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showLoader(lb) {
|
||||
if (lb === 15) {
|
||||
$(`#leaderboardsWrapper .leftTableLoader`).removeClass("hidden");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue