mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 07:46:15 +08:00
added the ability to change custom pace caret speed from the command line
added the ability to change custom word amout and time from the command line
This commit is contained in:
parent
33570c6bf4
commit
c261802d0a
|
@ -585,7 +585,7 @@ a:hover {
|
|||
background: var(--bg-color);
|
||||
border-radius: var(--roundness);
|
||||
|
||||
textarea {
|
||||
input {
|
||||
background: var(--bg-color);
|
||||
padding: 1rem;
|
||||
color: var(--main-color);
|
||||
|
@ -595,8 +595,6 @@ a:hover {
|
|||
font-family: var(--font);
|
||||
width: 100%;
|
||||
border-radius: var(--roundness);
|
||||
resize: vertical;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.shiftEnter {
|
||||
|
|
|
@ -741,8 +741,7 @@
|
|||
<div class="suggestions"></div>
|
||||
</div>
|
||||
<div id="commandInput" class="hidden">
|
||||
<textarea type="text" class="input" placeholder="input"></textarea>
|
||||
<div class="shiftEnter">Shift + Enter to send</div>
|
||||
<input type="text" class="input" placeholder="input"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div id="timerWrapper">
|
||||
|
|
|
@ -600,11 +600,21 @@ let commandsPaceCaret = {
|
|||
},
|
||||
{
|
||||
id: "setPaceCaretCustom",
|
||||
display: "custom",
|
||||
exec: () => {
|
||||
display: "custom...",
|
||||
input: true,
|
||||
exec: (input) => {
|
||||
$(".pageSettings .section.paceCaret input.customPaceCaretSpeed").val(input);
|
||||
setPaceCaret("custom");
|
||||
},
|
||||
},
|
||||
// {
|
||||
// id: "setPaceCaretCustomSpeed",
|
||||
// display: "Set custom speed...",
|
||||
// input: true,
|
||||
// exec: (input) => {
|
||||
// console.log(input);
|
||||
// },
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -781,6 +791,15 @@ let commandsWordCount = {
|
|||
restartTest();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeWordCountCustom",
|
||||
display: "custom...",
|
||||
input: true,
|
||||
exec: (input) => {
|
||||
changeWordCount(input);
|
||||
restartTest();
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
let commandsMode = {
|
||||
|
@ -855,6 +874,15 @@ let commandsTimeConfig = {
|
|||
restartTest();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeTimeConfigCustom",
|
||||
display: "custom...",
|
||||
input: true,
|
||||
exec: (input) => {
|
||||
changeTimeConfig(input);
|
||||
restartTest();
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -1176,12 +1204,12 @@ $(document).ready((e) => {
|
|||
});
|
||||
});
|
||||
|
||||
$("#commandInput textarea").keydown((e) => {
|
||||
if (e.keyCode == 13 && e.shiftKey) {
|
||||
$("#commandInput input").keydown((e) => {
|
||||
if (e.keyCode == 13) {
|
||||
//enter
|
||||
e.preventDefault();
|
||||
let command = $("#commandInput textarea").attr("command");
|
||||
let value = $("#commandInput textarea").val();
|
||||
let command = $("#commandInput input").attr("command");
|
||||
let value = $("#commandInput input").val();
|
||||
let list = currentCommands[currentCommands.length - 1];
|
||||
$.each(list.list, (i, obj) => {
|
||||
if (obj.id == command) {
|
||||
|
@ -1338,6 +1366,7 @@ function hideCommandLine() {
|
|||
100,
|
||||
() => {
|
||||
$("#commandLineWrapper").addClass("hidden");
|
||||
focusWords();
|
||||
}
|
||||
);
|
||||
focusWords();
|
||||
|
@ -1368,11 +1397,11 @@ function showCommandInput(command, placeholder) {
|
|||
$("#commandLineWrapper").removeClass("hidden");
|
||||
$("#commandLine").addClass("hidden");
|
||||
$("#commandInput").removeClass("hidden");
|
||||
$("#commandInput textarea").attr("placeholder", placeholder);
|
||||
$("#commandInput textarea").val("");
|
||||
$("#commandInput textarea").focus();
|
||||
$("#commandInput textarea").attr("command", "");
|
||||
$("#commandInput textarea").attr("command", command);
|
||||
$("#commandInput input").attr("placeholder", placeholder);
|
||||
$("#commandInput input").val("");
|
||||
$("#commandInput input").focus();
|
||||
$("#commandInput input").attr("command", "");
|
||||
$("#commandInput input").attr("command", command);
|
||||
}
|
||||
|
||||
function updateSuggestedCommands() {
|
||||
|
|
|
@ -582,6 +582,10 @@ function toggleKeyTips() {
|
|||
|
||||
//mode
|
||||
function changeTimeConfig(time, nosave) {
|
||||
if (time !== null && !isNaN(time) && time > 0) {
|
||||
} else {
|
||||
time = 15;
|
||||
}
|
||||
time = parseInt(time);
|
||||
changeMode("time", nosave);
|
||||
config.time = time;
|
||||
|
@ -596,6 +600,10 @@ function changeTimeConfig(time, nosave) {
|
|||
}
|
||||
|
||||
function changeWordCount(wordCount, nosave) {
|
||||
if (wordCount !== null && !isNaN(wordCount) && wordCount > 0) {
|
||||
} else {
|
||||
wordCount = 10;
|
||||
}
|
||||
wordCount = parseInt(wordCount);
|
||||
changeMode("words", nosave);
|
||||
config.words = wordCount;
|
||||
|
|
Loading…
Reference in a new issue