mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-13 07:23:39 +08:00
Merge pull request #1440 from Estebene/repeat-mode
Added repeat mode to settings
This commit is contained in:
commit
4ade3f5c64
7 changed files with 81 additions and 9 deletions
|
@ -626,6 +626,7 @@ let commandsPaceCaret = {
|
|||
],
|
||||
};
|
||||
|
||||
|
||||
let commandsMinWpm = {
|
||||
title: "Change min wpm mode...",
|
||||
list: [
|
||||
|
@ -1662,6 +1663,13 @@ export let defaultCommands = {
|
|||
Commandline.show();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleRepeatedPace",
|
||||
display: "Toggle repeated pace",
|
||||
exec: () => {
|
||||
UpdateConfig.toggleRepeatedPace();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeTimerStyle",
|
||||
display: "Change timer/progress style...",
|
||||
|
|
|
@ -99,6 +99,7 @@ let defaultConfig = {
|
|||
showOutOfFocusWarning: true,
|
||||
paceCaret: "off",
|
||||
paceCaretCustomSpeed: 100,
|
||||
repeatedPace: true,
|
||||
pageWidth: "100",
|
||||
chartAccuracy: true,
|
||||
chartStyle: "line",
|
||||
|
@ -502,6 +503,24 @@ export function setPaceCaretCustomSpeed(val, nosave) {
|
|||
if (!nosave) saveToLocalStorage();
|
||||
}
|
||||
|
||||
//repeated pace
|
||||
export function toggleRepeatedPace() {
|
||||
let pace = !config.repeatedPace;
|
||||
if (pace == undefined) {
|
||||
pace = true;
|
||||
}
|
||||
config.repeatedPace = pace;
|
||||
saveToLocalStorage();
|
||||
}
|
||||
|
||||
export function setRepeatedPace(pace, nosave) {
|
||||
if (pace == undefined) {
|
||||
pace = true;
|
||||
}
|
||||
config.repeatedPace = pace;
|
||||
if (!nosave) saveToLocalStorage();
|
||||
}
|
||||
|
||||
//min wpm
|
||||
export function setMinWpm(minwpm, nosave) {
|
||||
if (minwpm == undefined) {
|
||||
|
@ -1516,6 +1535,7 @@ export function apply(configObj) {
|
|||
setShowOutOfFocusWarning(configObj.showOutOfFocusWarning, true);
|
||||
setPaceCaret(configObj.paceCaret, true);
|
||||
setPaceCaretCustomSpeed(configObj.paceCaretCustomSpeed, true);
|
||||
setRepeatedPace(configObj.repeatedPace, true);
|
||||
setPageWidth(configObj.pageWidth, true);
|
||||
setChartAccuracy(configObj.chartAccuracy, true);
|
||||
setChartStyle(configObj.chartStyle, true);
|
||||
|
|
|
@ -193,6 +193,10 @@ async function initGroups() {
|
|||
}
|
||||
}
|
||||
);
|
||||
groups.repeatedPace = new SettingsGroup(
|
||||
"repeatedPace",
|
||||
UpdateConfig.setRepeatedPace
|
||||
);
|
||||
groups.minWpm = new SettingsGroup("minWpm", UpdateConfig.setMinWpm, () => {
|
||||
if (Config.minWpm === "custom") {
|
||||
$(".pageSettings .section.minWpm input.customMinWpmSpeed").removeClass(
|
||||
|
|
|
@ -6,7 +6,8 @@ import * as DB from "./db";
|
|||
export let settings = null;
|
||||
|
||||
function resetCaretPosition() {
|
||||
if (Config.paceCaret === "off" && !TestLogic.isPaceRepeat) return;
|
||||
if (Config.paceCaret === "off" && !TestLogic.isPaceRepeat)
|
||||
return;
|
||||
if (!$("#paceCaret").hasClass("hidden")) {
|
||||
$("#paceCaret").addClass("hidden");
|
||||
}
|
||||
|
|
|
@ -342,7 +342,11 @@ export function startTest() {
|
|||
}
|
||||
|
||||
try {
|
||||
if (Config.paceCaret !== "off" || isPaceRepeat) PaceCaret.start();
|
||||
if (
|
||||
Config.paceCaret !== "off" ||
|
||||
(Config.repeatedPace && isPaceRepeat)
|
||||
)
|
||||
PaceCaret.start();
|
||||
} catch (e) {}
|
||||
//use a recursive self-adjusting timer to avoid time drift
|
||||
TestStats.setStart(performance.now());
|
||||
|
|
|
@ -195,8 +195,8 @@ export function screenshot() {
|
|||
if (firebase.auth().currentUser == null)
|
||||
$(".pageTest .loginTip").removeClass("hidden");
|
||||
}
|
||||
|
||||
if (!$("#resultReplay").hasClass('hidden')) {
|
||||
|
||||
if (!$("#resultReplay").hasClass("hidden")) {
|
||||
revealReplay = true;
|
||||
Replay.pauseReplay();
|
||||
}
|
||||
|
@ -491,7 +491,10 @@ export function updateModesNotice() {
|
|||
);
|
||||
}
|
||||
|
||||
if (Config.paceCaret !== "off" || TestLogic.isPaceRepeat) {
|
||||
if (
|
||||
Config.paceCaret !== "off" ||
|
||||
(Config.repeatedPace && TestLogic.isPaceRepeat)
|
||||
) {
|
||||
let speed = "";
|
||||
try {
|
||||
speed = ` (${Math.round(PaceCaret.settings.wpm)} wpm)`;
|
||||
|
@ -502,7 +505,7 @@ export function updateModesNotice() {
|
|||
? "average"
|
||||
: Config.paceCaret === "pb"
|
||||
? "pb"
|
||||
: Config.paceCaret == "off"
|
||||
: Config.paceCaret == "repeat"
|
||||
? "repeated"
|
||||
: "custom"
|
||||
} pace${speed}</div>`
|
||||
|
|
|
@ -2648,7 +2648,9 @@
|
|||
<div class="section paceCaret" section="">
|
||||
<h1>pace caret</h1>
|
||||
<div class="text">
|
||||
Displays a second caret that moves at constant speed.
|
||||
Displays a second caret that moves at constant speed. The
|
||||
repeat option enables a pace caret when a test is repeated
|
||||
that will have the wpm of the previous test.
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div
|
||||
|
@ -2675,6 +2677,14 @@
|
|||
>
|
||||
pb
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
paceCaret="repeat"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
repeat
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
paceCaret="custom"
|
||||
|
@ -2693,12 +2703,34 @@
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section repeatedPace" section="">
|
||||
<h1>repeated pace</h1>
|
||||
<div class="text">
|
||||
When repeating a test, a pace caret will automatically be enabled for one test set to match the speed of your previous test. It does not override the pace caret settings if it's already enabled.
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div class="button off" tabindex="0" onclick="this.blur();">
|
||||
off
|
||||
</div>
|
||||
<div class="button on" tabindex="0" onclick="this.blur();">
|
||||
on
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section paceCaretStyle" section="">
|
||||
<h1>pace caret style</h1>
|
||||
<div class="text">
|
||||
Change the style of the pace caret during the test.
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div
|
||||
class="button"
|
||||
paceCaretStyle="off"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
off
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
paceCaretStyle="default"
|
||||
|
@ -3740,12 +3772,12 @@
|
|||
</div>
|
||||
<div class="button signIn">
|
||||
<i class="fas fa-sign-in-alt"></i>
|
||||
Sign in with email
|
||||
Sign In
|
||||
</div>
|
||||
<div style="font-size: 0.75rem; text-align: center">or</div>
|
||||
<div class="button signInWithGoogle">
|
||||
<i class="fab fa-google"></i>
|
||||
Sign in with Google
|
||||
Google Sign In
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue