mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 07:46:15 +08:00
Merge branch 'master' into newads
This commit is contained in:
commit
071e825c49
|
@ -10,7 +10,7 @@ import * as TestLogic from "../test/test-logic";
|
|||
import * as Loader from "../elements/loader";
|
||||
import * as PageTransition from "../states/page-transition";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as LoadingPage from "../pages/loading";
|
||||
import * as LoginPage from "../pages/login";
|
||||
import * as ResultFilters from "../account/result-filters";
|
||||
|
@ -218,7 +218,7 @@ export async function getDataAndInit(): Promise<boolean> {
|
|||
AccountButton.loading(false);
|
||||
}
|
||||
if (Config.paceCaret === "pb" || Config.paceCaret === "average") {
|
||||
if (!TestActive.get()) {
|
||||
if (!TestState.isActive) {
|
||||
PaceCaret.init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as Misc from "../utils/misc";
|
|||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as BannerEvent from "../observables/banner-event";
|
||||
import Config from "../config";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as EG from "./eg-ad-controller";
|
||||
import * as PW from "./pw-ad-controller";
|
||||
|
||||
|
@ -36,7 +36,7 @@ export function init(): void {
|
|||
}
|
||||
|
||||
setInterval(() => {
|
||||
if (TestActive.get()) {
|
||||
if (TestState.isActive) {
|
||||
return;
|
||||
}
|
||||
if (choice === "eg") {
|
||||
|
|
|
@ -20,7 +20,7 @@ import * as Replay from "../test/replay";
|
|||
import * as MonkeyPower from "../elements/monkey-power";
|
||||
import * as WeakSpot from "../test/weak-spot";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as CompositionState from "../states/composition";
|
||||
import * as TestInput from "../test/test-input";
|
||||
import * as TestWords from "../test/test-words";
|
||||
|
@ -100,7 +100,7 @@ function updateUI(): void {
|
|||
}
|
||||
|
||||
function backspaceToPrevious(): void {
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
|
||||
if (
|
||||
TestInput.input.history.length === 0 ||
|
||||
|
@ -141,7 +141,7 @@ function backspaceToPrevious(): void {
|
|||
}
|
||||
|
||||
function handleSpace(): void {
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
|
||||
if (TestInput.input.current === "") return;
|
||||
|
||||
|
@ -441,7 +441,7 @@ function handleChar(
|
|||
}
|
||||
|
||||
//start the test
|
||||
if (!TestActive.get() && !TestLogic.startTest()) {
|
||||
if (!TestState.isActive && !TestLogic.startTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
let testActive = false;
|
||||
|
||||
export function get(): boolean {
|
||||
return testActive;
|
||||
}
|
||||
|
||||
export function set(active: boolean): void {
|
||||
testActive = active;
|
||||
}
|
|
@ -2,7 +2,7 @@ import * as Misc from "../utils/misc";
|
|||
import Config from "../config";
|
||||
import * as TestInput from "./test-input";
|
||||
import * as SlowTimer from "../states/slow-timer";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
|
||||
export let caretAnimating = true;
|
||||
const caret = $("#caret");
|
||||
|
@ -134,7 +134,7 @@ export async function updatePosition(): Promise<void> {
|
|||
if (
|
||||
newTop >= middlePos &&
|
||||
contentHeight > browserHeight &&
|
||||
TestActive.get()
|
||||
TestState.isActive
|
||||
) {
|
||||
const newscrolltop = newTop - middlePos / 2;
|
||||
window.scrollTo({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Config from "../config";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
export function update(acc: number): void {
|
||||
|
@ -14,7 +14,7 @@ export function update(acc: number): void {
|
|||
|
||||
export function show(): void {
|
||||
if (!Config.showLiveAcc) return;
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
if (Config.timerStyle === "mini") {
|
||||
if (!$("#miniTimerAndLiveWpm .acc").hasClass("hidden")) return;
|
||||
$("#miniTimerAndLiveWpm .acc")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Config from "../config";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
export async function update(burst: number): Promise<void> {
|
||||
|
@ -12,7 +12,7 @@ export async function update(burst: number): Promise<void> {
|
|||
|
||||
export function show(): void {
|
||||
if (!Config.showLiveBurst) return;
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
if (Config.timerStyle === "mini") {
|
||||
if (!$("#miniTimerAndLiveWpm .burst").hasClass("hidden")) return;
|
||||
$("#miniTimerAndLiveWpm .burst")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Config from "../config";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
const liveWpmElement = document.querySelector("#liveWpm") as Element;
|
||||
|
@ -8,11 +8,6 @@ const miniLiveWpmElement = document.querySelector(
|
|||
) as Element;
|
||||
|
||||
export function update(wpm: number, raw: number): void {
|
||||
// if (!TestActive.get() || !Config.showLiveWpm) {
|
||||
// hideLiveWpm();
|
||||
// } else {
|
||||
// showLiveWpm();
|
||||
// }
|
||||
let number = wpm;
|
||||
if (Config.blindMode) {
|
||||
number = raw;
|
||||
|
@ -26,7 +21,7 @@ export function update(wpm: number, raw: number): void {
|
|||
|
||||
export function show(): void {
|
||||
if (!Config.showLiveWpm) return;
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
if (Config.timerStyle === "mini") {
|
||||
if (!$("#miniTimerAndLiveWpm .wpm").hasClass("hidden")) return;
|
||||
$("#miniTimerAndLiveWpm .wpm")
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { mapRange } from "../utils/misc";
|
||||
import Config from "../config";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "../test/test-state";
|
||||
|
||||
ConfigEvent.subscribe((eventKey) => {
|
||||
if (eventKey === "monkey" && TestActive.get()) {
|
||||
if (eventKey === "monkey" && TestState.isActive) {
|
||||
if (Config.monkey) {
|
||||
$("#monkey").removeClass("hidden");
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,6 @@ import Config from "../config";
|
|||
import * as DB from "../db";
|
||||
import * as SlowTimer from "../states/slow-timer";
|
||||
import * as Misc from "../utils/misc";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "./test-state";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
|
@ -113,7 +112,7 @@ export async function init(): Promise<void> {
|
|||
}
|
||||
|
||||
export function update(expectedStepEnd: number): void {
|
||||
if (settings === null || !TestActive.get() || TestUI.resultVisible) {
|
||||
if (settings === null || !TestState.isActive || TestUI.resultVisible) {
|
||||
return;
|
||||
}
|
||||
// if ($("#paceCaret").hasClass("hidden")) {
|
||||
|
|
|
@ -38,7 +38,6 @@ import * as LazyMode from "./lazy-mode";
|
|||
import * as Result from "./result";
|
||||
import * as MonkeyPower from "../elements/monkey-power";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestInput from "./test-input";
|
||||
import * as TestWords from "./test-words";
|
||||
import * as TestState from "./test-state";
|
||||
|
@ -320,7 +319,7 @@ export function startTest(): boolean {
|
|||
AnalyticsController.log("testStartedNoLogin");
|
||||
}
|
||||
|
||||
TestActive.set(true);
|
||||
TestState.setActive(true);
|
||||
Replay.startReplayRecording();
|
||||
Replay.replayGetWordsList(TestWords.words.list);
|
||||
TestInput.resetKeypressTimings();
|
||||
|
@ -417,7 +416,7 @@ export function restart(options = {} as RestartOptions): void {
|
|||
// }
|
||||
}
|
||||
}
|
||||
if (TestActive.get()) {
|
||||
if (TestState.isActive) {
|
||||
if (
|
||||
Config.repeatQuotes === "typing" &&
|
||||
Config.mode === "quote" &&
|
||||
|
@ -486,7 +485,7 @@ export function restart(options = {} as RestartOptions): void {
|
|||
TestInput.corrected.reset();
|
||||
ShiftTracker.reset();
|
||||
Caret.hide();
|
||||
TestActive.set(false);
|
||||
TestState.setActive(false);
|
||||
Replay.stopReplayRecording();
|
||||
LiveWpm.hide();
|
||||
LiveAcc.hide();
|
||||
|
@ -584,7 +583,7 @@ export function restart(options = {} as RestartOptions): void {
|
|||
} else {
|
||||
TestState.setRepeated(true);
|
||||
TestState.setPaceRepeat(repeatWithPace);
|
||||
TestActive.set(false);
|
||||
TestState.setActive(false);
|
||||
Replay.stopReplayRecording();
|
||||
TestWords.words.resetCurrentIndex();
|
||||
TestInput.input.reset();
|
||||
|
@ -821,7 +820,7 @@ async function getNextWord(
|
|||
|
||||
let rememberLazyMode: boolean;
|
||||
export async function init(): Promise<void> {
|
||||
TestActive.set(false);
|
||||
TestState.setActive(false);
|
||||
MonkeyPower.reset();
|
||||
Replay.stopReplayRecording();
|
||||
TestWords.words.reset();
|
||||
|
@ -1482,7 +1481,7 @@ function buildCompletedEvent(difficultyFailed: boolean): CompletedEvent {
|
|||
}
|
||||
|
||||
export async function finish(difficultyFailed = false): Promise<void> {
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
if (TestInput.input.current.length != 0) {
|
||||
TestInput.input.pushHistory();
|
||||
TestInput.corrected.pushHistory();
|
||||
|
@ -1494,7 +1493,7 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
TestUI.setResultCalculating(true);
|
||||
TestUI.setResultVisible(true);
|
||||
TestStats.setEnd(performance.now());
|
||||
TestActive.set(false);
|
||||
TestState.setActive(false);
|
||||
Replay.stopReplayRecording();
|
||||
Focus.set(false);
|
||||
Caret.hide();
|
||||
|
@ -1899,7 +1898,7 @@ $(".pageTest").on("click", "#restartTestButton", () => {
|
|||
ManualRestart.set();
|
||||
if (TestUI.resultCalculating) return;
|
||||
if (
|
||||
TestActive.get() &&
|
||||
TestState.isActive &&
|
||||
Config.repeatQuotes === "typing" &&
|
||||
Config.mode === "quote"
|
||||
) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export let isRepeated = false;
|
||||
export let isPaceRepeat = false;
|
||||
export let isActive = false;
|
||||
export let activeChallenge: null | MonkeyTypes.Challenge = null;
|
||||
export let savingEnabled = true;
|
||||
|
||||
|
@ -11,6 +12,10 @@ export function setPaceRepeat(tf: boolean): void {
|
|||
isPaceRepeat = tf;
|
||||
}
|
||||
|
||||
export function setActive(tf: boolean): void {
|
||||
isActive = tf;
|
||||
}
|
||||
|
||||
export function setActiveChallenge(val: null | MonkeyTypes.Challenge): void {
|
||||
activeChallenge = val;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import * as Misc from "../utils/misc";
|
|||
import * as Notifications from "../elements/notifications";
|
||||
import * as Caret from "./caret";
|
||||
import * as SlowTimer from "../states/slow-timer";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "./test-state";
|
||||
import * as Time from "../states/time";
|
||||
import * as TimerEvent from "../observables/timer-event";
|
||||
|
||||
|
@ -236,7 +236,7 @@ export async function start(): Promise<void> {
|
|||
timer = setTimeout(function () {
|
||||
// time++;
|
||||
|
||||
if (!TestActive.get()) {
|
||||
if (!TestState.isActive) {
|
||||
if (timer !== null) clearTimeout(timer);
|
||||
SlowTimer.clear();
|
||||
slowTimerCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as TestWords from "./test-words";
|
|||
import * as TestInput from "./test-input";
|
||||
import * as Time from "../states/time";
|
||||
import * as SlowTimer from "../states/slow-timer";
|
||||
import * as TestActive from "../states/test-active";
|
||||
import * as TestState from "./test-state";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
export function show(): void {
|
||||
|
@ -201,7 +201,7 @@ export function update(): void {
|
|||
}
|
||||
|
||||
export function updateStyle(): void {
|
||||
if (!TestActive.get()) return;
|
||||
if (!TestState.isActive) return;
|
||||
hide();
|
||||
update();
|
||||
setTimeout(() => {
|
||||
|
@ -211,7 +211,7 @@ export function updateStyle(): void {
|
|||
|
||||
ConfigEvent.subscribe((eventKey, eventValue) => {
|
||||
if (eventKey === "showTimerProgress") {
|
||||
if (eventValue === true && TestActive.get()) {
|
||||
if (eventValue === true && TestState.isActive) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
|
|
|
@ -2,7 +2,7 @@ import Config from "./config";
|
|||
import * as Caret from "./test/caret";
|
||||
import * as Notifications from "./elements/notifications";
|
||||
import * as CustomText from "./test/custom-text";
|
||||
import * as TestActive from "./states/test-active";
|
||||
import * as TestState from "./test/test-state";
|
||||
import * as ConfigEvent from "./observables/config-event";
|
||||
import { debounce, throttle } from "throttle-debounce";
|
||||
import * as TestUI from "./test/test-ui";
|
||||
|
@ -75,7 +75,7 @@ window.addEventListener("beforeunload", (event) => {
|
|||
) {
|
||||
//ignore
|
||||
} else {
|
||||
if (TestActive.get()) {
|
||||
if (TestState.isActive) {
|
||||
event.preventDefault();
|
||||
// Chrome requires returnValue to be set.
|
||||
event.returnValue = "";
|
||||
|
|
|
@ -1341,5 +1341,27 @@
|
|||
"row4": ["ဖဇ", "ထဌ", "ခဃ", "လဠ", "ဘယ", "ညဉ", "ာဦ", ",၊", ".။", "/?"],
|
||||
"row5": [" "]
|
||||
}
|
||||
},
|
||||
"gallium": {
|
||||
"keymapShowTopRow": false,
|
||||
"type": "ansi",
|
||||
"keys": {
|
||||
"row1": ["`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+"],
|
||||
"row2": ["bB", "lL", "dD", "cC", "vV", "zZ", "yY", "oO", "uU", ",<", "[{", "]}", "\\|"],
|
||||
"row3": ["nN", "rR", "tT", "sS", "gG", "pP", "hH", "aA", "eE", "iI", "/?"],
|
||||
"row4": ["qQ", "xX", "mM", "wW", "jJ", "kK", "fF", "'\"", ";:", ",)"],
|
||||
"row5": [" "]
|
||||
}
|
||||
},
|
||||
"gallium_angle": {
|
||||
"keymapShowTopRow": false,
|
||||
"type": "ansi",
|
||||
"keys": {
|
||||
"row1": ["`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+"],
|
||||
"row2": ["bB", "lL", "dD", "cC", "jJ", "zZ", "yY", "oO", "uU", ",<", "[{", "]}", "\\|"],
|
||||
"row3": ["nN", "rR", "tT", "sS", "vV", "pP", "hH", "aA", "eE", "iI", "/?"],
|
||||
"row4": ["xX", "mM", "wW", "gG", "qQ", "kK", "fF", "'\"", ";:", ",)"],
|
||||
"row5": [" "]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,9 +136,9 @@
|
|||
availability of Monkeytype services, please send your disclosure via
|
||||
<span style="display: inline-flex">
|
||||
<a href="mailto:contact@monkeytype.com" rel="noopener">email</a>
|
||||
,
|
||||
.
|
||||
</span>
|
||||
. For non-security related platform bugs, follow the bug submission
|
||||
For non-security related platform bugs, follow the bug submission
|
||||
<span style="display: inline-flex">
|
||||
<a
|
||||
href="https://github.com/monkeytypegame/monkeytype#bug-report-or-feature-request"
|
||||
|
|
Loading…
Reference in a new issue