From 4cd3c80259a312aa670ab4b882135be4c07a77c9 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 15 Sep 2021 19:45:47 +0100 Subject: [PATCH] showing cpm on leaderboards when cpm mode is enabled --- src/js/elements/leaderboards.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/js/elements/leaderboards.js b/src/js/elements/leaderboards.js index d5caeab5f..0d9e5b516 100644 --- a/src/js/elements/leaderboards.js +++ b/src/js/elements/leaderboards.js @@ -3,6 +3,7 @@ import * as Notifications from "./notifications"; import * as DB from "./db"; import axiosInstance from "./axios-instance"; import * as Misc from "./misc"; +import Config, * as UpdateConfig from "./config"; let currentLeaderboard = "time_15"; @@ -183,10 +184,14 @@ function fillTable(lb, prepend) { entry.rank === 1 ? '' : entry.rank } ${entry.name} - ${entry.wpm.toFixed( - 2 - )}
${entry.acc.toFixed(2)}%
- ${entry.raw.toFixed(2)}
${ + ${(Config.alwaysShowCPM + ? entry.wpm * 5 + : entry.wpm + ).toFixed(2)}
${entry.acc.toFixed(2)}%
+ ${(Config.alwaysShowCPM + ? entry.raw * 5 + : entry.raw + ).toFixed(2)}
${ !entry.consistency || entry.consistency === "-" ? "-" : entry.consistency.toFixed(2) + "%" @@ -389,6 +394,15 @@ export function show() { "disabled" ); } + if (Config.alwaysShowCPM) { + $("#leaderboards table thead tr td:nth-child(3)").html( + 'cpm
accuracy
' + ); + } else { + $("#leaderboards table thead tr td:nth-child(3)").html( + 'wpm
accuracy
' + ); + } $("#leaderboardsWrapper") .stop(true, true) .css("opacity", 0)