mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-03 04:19:06 +08:00
parent
2dba957adc
commit
e1027ddc70
3 changed files with 33 additions and 5 deletions
|
@ -1305,11 +1305,6 @@ export function setMonkey(monkey: boolean, nosave?: boolean): boolean {
|
|||
if (!isConfigValueValid("monkey", monkey, ["boolean"])) return false;
|
||||
|
||||
config.monkey = monkey;
|
||||
if (config.monkey) {
|
||||
$("#monkey").removeClass("hidden");
|
||||
} else {
|
||||
$("#monkey").addClass("hidden");
|
||||
}
|
||||
saveToLocalStorage("monkey", nosave);
|
||||
ConfigEvent.dispatch("monkey", config.monkey);
|
||||
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
import { mapRange } from "../misc";
|
||||
import Config from "../config";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as TestActive from "../states/test-active";
|
||||
|
||||
ConfigEvent.subscribe((eventKey) => {
|
||||
if (eventKey === "monkey" && TestActive.get()) {
|
||||
if (Config.monkey) {
|
||||
$("#monkey").removeClass("hidden");
|
||||
} else {
|
||||
$("#monkey").addClass("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let left = false;
|
||||
let right = false;
|
||||
|
@ -79,3 +91,19 @@ export function stop(): void {
|
|||
}
|
||||
update();
|
||||
}
|
||||
|
||||
export function show(): void {
|
||||
if (!Config.monkey) return;
|
||||
$("#monkey")
|
||||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 125);
|
||||
}
|
||||
|
||||
export function hide(): void {
|
||||
$("#monkey")
|
||||
.css("opacity", 1)
|
||||
.animate({ opacity: 1 }, 125, () => {
|
||||
$("#monkey").addClass("hidden");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import * as PageTransition from "../states/page-transition";
|
|||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as TimerEvent from "../observables/timer-event";
|
||||
import * as Last10Average from "../elements/last-10-average";
|
||||
import * as Monkey from "./monkey";
|
||||
import NodeObjectHash from "node-object-hash";
|
||||
|
||||
const objecthash = NodeObjectHash().hash;
|
||||
|
@ -260,6 +261,7 @@ export function startTest(): boolean {
|
|||
LiveBurst.show();
|
||||
TimerProgress.update();
|
||||
TestTimer.clear();
|
||||
Monkey.show();
|
||||
|
||||
if (Config.funbox === "memory") {
|
||||
Funbox.resetMemoryTimer();
|
||||
|
@ -377,6 +379,8 @@ export function restart(
|
|||
Replay.pauseReplay();
|
||||
TestInput.setBailout(false);
|
||||
PaceCaret.reset();
|
||||
Monkey.hide();
|
||||
|
||||
if (Config.showAvg) Last10Average.update();
|
||||
$("#showWordHistoryButton").removeClass("loaded");
|
||||
$("#restartTestButton").blur();
|
||||
|
@ -1359,6 +1363,7 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
OutOfFocus.hide();
|
||||
TestTimer.clear();
|
||||
Funbox.clear();
|
||||
Monkey.hide();
|
||||
|
||||
//need one more calculation for the last word if test auto ended
|
||||
if (TestInput.burstHistory.length !== TestInput.input.getHistory().length) {
|
||||
|
|
Loading…
Reference in a new issue