mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-13 01:57:38 +08:00
added strict space
This commit is contained in:
parent
c0c563b464
commit
6586022006
5 changed files with 43 additions and 1 deletions
|
@ -200,6 +200,13 @@ let commands = {
|
|||
toggleFreedomMode();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleStrictSpace",
|
||||
display: "Toggle strict space",
|
||||
exec: () => {
|
||||
toggleStrictSpace();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleBlindMode",
|
||||
display: "Toggle blind mode",
|
||||
|
|
|
@ -4949,7 +4949,7 @@ $(document).keydown(function (event) {
|
|||
)
|
||||
return;
|
||||
if (event.key === " ") {
|
||||
if (config.difficulty !== "normal") {
|
||||
if (config.difficulty !== "normal" || config.strictSpace) {
|
||||
if (dontInsertSpace) {
|
||||
dontInsertSpace = false;
|
||||
return;
|
||||
|
|
|
@ -125,6 +125,7 @@ settingsGroups.freedomMode = new SettingsGroup(
|
|||
settingsGroups.confidenceMode.updateButton();
|
||||
}
|
||||
);
|
||||
settingsGroups.strictSpace = new SettingsGroup("strictSpace", setStrictSpace);
|
||||
settingsGroups.confidenceMode = new SettingsGroup(
|
||||
"confidenceMode",
|
||||
setConfidenceMode,
|
||||
|
@ -137,6 +138,10 @@ settingsGroups.indicateTypos = new SettingsGroup(
|
|||
"indicateTypos",
|
||||
setIndicateTypos
|
||||
);
|
||||
settingsGroups.hideExtraLetters = new SettingsGroup(
|
||||
"hideExtraLetters",
|
||||
setHideExtraLetters
|
||||
);
|
||||
settingsGroups.blindMode = new SettingsGroup("blindMode", setBlindMode);
|
||||
settingsGroups.quickEnd = new SettingsGroup("quickEnd", setQuickEnd);
|
||||
settingsGroups.enableAds = new SettingsGroup("enableAds", setEnableAds);
|
||||
|
|
|
@ -71,6 +71,7 @@ let defaultConfig = {
|
|||
alwaysShowCPM: false,
|
||||
enableAds: "off",
|
||||
hideExtraLetters: false,
|
||||
strictSpace: false,
|
||||
};
|
||||
|
||||
let cookieConfig = null;
|
||||
|
@ -679,6 +680,20 @@ function toggleColorfulMode() {
|
|||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
//strict space
|
||||
function setStrictSpace(val, nosave) {
|
||||
if (val == undefined) {
|
||||
val = false;
|
||||
}
|
||||
config.strictSpace = val;
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
function toggleStrictSpace() {
|
||||
config.strictSpace = !config.strictSpace;
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function setPageWidth(val, nosave) {
|
||||
if (val == null || val == undefined) {
|
||||
val = "100";
|
||||
|
|
|
@ -1720,6 +1720,21 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section strictSpace">
|
||||
<h1>strict space</h1>
|
||||
<div class="text">
|
||||
Pressing space at the beginning of a word will insert a space
|
||||
character when this mode is 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 stopOnError">
|
||||
<h1>stop on error</h1>
|
||||
<div class="text">
|
||||
|
|
Loading…
Add table
Reference in a new issue