mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-27 01:06:21 +08:00
converted leaderboards to a module
This commit is contained in:
parent
9cafaad1c9
commit
1cd7a3f6f1
4 changed files with 14 additions and 9 deletions
|
|
@ -94,6 +94,7 @@ const refactoredSrc = [
|
|||
"./src/js/monkey.js",
|
||||
"./src/js/result-filters.js",
|
||||
"./src/js/notification-center.js",
|
||||
"./src/js/leaderboards.js",
|
||||
];
|
||||
|
||||
//legacy files
|
||||
|
|
@ -104,7 +105,6 @@ const globalSrc = [
|
|||
"./src/js/words.js",
|
||||
"./src/js/userconfig.js",
|
||||
"./src/js/commandline.js",
|
||||
"./src/js/leaderboards.js",
|
||||
"./src/js/settings.js",
|
||||
"./src/js/account.js",
|
||||
"./src/js/script.js",
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ import layouts from "./layouts";
|
|||
import * as Monkey from "./monkey";
|
||||
import * as Notifications from "./notification-center";
|
||||
import * as ResultFilters from "./result-filters";
|
||||
import * as Leaderboards from "./leaderboards";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
import * as CloudFunctions from "./cloud-functions";
|
||||
import { showBackgroundLoader, hideBackgroundLoader } from "./dom-util";
|
||||
import * as Notifications from "./notification-center";
|
||||
|
||||
let currentLeaderboard = "time_15";
|
||||
|
||||
function showLeaderboards() {
|
||||
export function show() {
|
||||
if ($("#leaderboardsWrapper").hasClass("hidden")) {
|
||||
$("#leaderboardsWrapper")
|
||||
.stop(true, true)
|
||||
|
|
@ -12,13 +16,13 @@ function showLeaderboards() {
|
|||
},
|
||||
125,
|
||||
() => {
|
||||
updateLeaderboards();
|
||||
update();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function hideLeaderboards() {
|
||||
export function hide() {
|
||||
$("#leaderboardsWrapper")
|
||||
.stop(true, true)
|
||||
.css("opacity", 1)
|
||||
|
|
@ -31,10 +35,10 @@ function hideLeaderboards() {
|
|||
$("#leaderboardsWrapper").addClass("hidden");
|
||||
}
|
||||
);
|
||||
focusWords();
|
||||
// focusWords();
|
||||
}
|
||||
|
||||
function updateLeaderboards() {
|
||||
function update() {
|
||||
$("#leaderboardsWrapper .buttons .button").removeClass("active");
|
||||
$(
|
||||
`#leaderboardsWrapper .buttons .button[board=${currentLeaderboard}]`
|
||||
|
|
@ -266,11 +270,11 @@ function updateLeaderboards() {
|
|||
|
||||
$("#leaderboardsWrapper").click((e) => {
|
||||
if ($(e.target).attr("id") === "leaderboardsWrapper") {
|
||||
hideLeaderboards();
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#leaderboardsWrapper .buttons .button").click((e) => {
|
||||
currentLeaderboard = $(e.target).attr("board");
|
||||
updateLeaderboards();
|
||||
show();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4773,7 +4773,7 @@ $(document).on("click", "#top .config .mode .text-button", (e) => {
|
|||
$(document).on("click", "#top #menu .icon-button", (e) => {
|
||||
if ($(e.currentTarget).hasClass("discord")) return;
|
||||
if ($(e.currentTarget).hasClass("leaderboards")) {
|
||||
showLeaderboards();
|
||||
Leaderboards.show();
|
||||
} else {
|
||||
const href = $(e.currentTarget).attr("href");
|
||||
manualRestart = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue