mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 04:51:16 +08:00
added freedom mode
This commit is contained in:
parent
cb5f8cbe00
commit
7f6c9a5267
5 changed files with 43 additions and 4 deletions
|
@ -237,6 +237,11 @@
|
|||
<div class="text">Shows the keybind tips at the bottom of the page.</div>
|
||||
<div class="buttons"><div class="button on" tabindex="0">show</div><div class="button off" tabindex="0">hide</div></div>
|
||||
</div>
|
||||
<div class="section freedomMode">
|
||||
<h1>freedom mode</h1>
|
||||
<div class="text">Allows you to delete any word, even if it was typed correctly.</div>
|
||||
<div class="buttons"><div class="button on" tabindex="0">on</div><div class="button off" tabindex="0">off</div></div>
|
||||
</div>
|
||||
<div class="section fontSize">
|
||||
<h1>font size</h1>
|
||||
<div class="text">Change the font size of the test words</div>
|
||||
|
|
|
@ -42,6 +42,13 @@ let commands = {
|
|||
toggleKeyTips();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "toggleFreedom",
|
||||
display: "Toggle freedom mode",
|
||||
exec: () => {
|
||||
toggleFreedomMode();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeTheme",
|
||||
display: "Change theme...",
|
||||
|
|
|
@ -1019,9 +1019,7 @@ $(document).keydown((event) => {
|
|||
if (!testActive) return;
|
||||
if (currentInput == "" && inputHistory.length > 0) {
|
||||
if (
|
||||
inputHistory[currentWordIndex - 1] ==
|
||||
wordsList[currentWordIndex - 1] ||
|
||||
$($(".word")[currentWordIndex - 1]).hasClass("hidden")
|
||||
(inputHistory[currentWordIndex - 1] == wordsList[currentWordIndex - 1] && !config.freedomMode) || $($(".word")[currentWordIndex - 1]).hasClass("hidden")
|
||||
) {
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,8 @@ function updateSettingsPage(){
|
|||
setSettingsButton('quickTab', config.quickTab);
|
||||
setSettingsButton('liveWpm', config.showLiveWpm);
|
||||
setSettingsButton('keyTips', config.showKeyTips);
|
||||
setSettingsButton('freedomMode', config.freedomMode);
|
||||
|
||||
|
||||
setActiveThemeButton();
|
||||
setActiveLanguageButton();
|
||||
|
@ -92,6 +94,20 @@ $(".pageSettings .section.liveWpm .buttons .button.off").click(e => {
|
|||
setSettingsButton('liveWpm', config.showLiveWpm);
|
||||
})
|
||||
|
||||
//freedom mode
|
||||
$(".pageSettings .section.freedomMode .buttons .button.on").click(e => {
|
||||
setFreedomMode(true);
|
||||
saveConfigToCookie();
|
||||
showNotification('Freedom mode on', 1000);
|
||||
setSettingsButton('freedomMode', config.freedomMode);
|
||||
})
|
||||
$(".pageSettings .section.freedomMode .buttons .button.off").click(e => {
|
||||
setFreedomMode(false);
|
||||
saveConfigToCookie();
|
||||
showNotification('Freedom mode off', 1000);
|
||||
setSettingsButton('freedomMode', config.freedomMode);
|
||||
})
|
||||
|
||||
//keytips
|
||||
$(".pageSettings .section.keyTips .buttons .button.on").click(e => {
|
||||
setKeyTips(true);
|
||||
|
|
|
@ -9,7 +9,8 @@ let config = {
|
|||
time: 30,
|
||||
mode: "words",
|
||||
language: "english",
|
||||
fontSize: 1
|
||||
fontSize: 1,
|
||||
freedomMode: false
|
||||
}
|
||||
|
||||
//cookies
|
||||
|
@ -33,6 +34,7 @@ function loadConfigFromCookie() {
|
|||
changeMode(newConfig.mode);
|
||||
changeLanguage(newConfig.language);
|
||||
changeFontSize(newConfig.fontSize);
|
||||
setFreedomMode(newConfig.freedomMode);
|
||||
config = newConfig;
|
||||
restartTest();
|
||||
}
|
||||
|
@ -134,6 +136,17 @@ function togglePunctuation() {
|
|||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
//freedom
|
||||
function setFreedomMode(freedom) {
|
||||
config.freedomMode = freedom;
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function toggleFreedomMode() {
|
||||
config.freedomMode = !config.freedomMode;
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function previewTheme(name) {
|
||||
$("#currentTheme").attr("href", `themes/${name}.css`);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue