mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
changed confidence mode to support multiple options
This commit is contained in:
parent
915df051dd
commit
44711dab79
5 changed files with 138 additions and 71 deletions
|
@ -7,7 +7,7 @@
|
|||
<title>Monkey Type</title>
|
||||
<link rel="stylesheet" href="css/fa.css">
|
||||
<link rel="stylesheet" href="css/balloon.css">
|
||||
<link rel="stylesheet" href="css/style.css?v=44">
|
||||
<link rel="stylesheet" href="css/style.css?v=45">
|
||||
<link rel="stylesheet" href="themes/serika_dark.css" id="currentTheme">
|
||||
<link id="favicon" rel="shortcut icon" href="fav.png">
|
||||
<link rel="shortcut icon" href="fav.png">
|
||||
|
@ -812,12 +812,14 @@
|
|||
<div class="button off" tabindex="0" onclick="this.blur();">off</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section maxConfidence">
|
||||
<h1>max confidence</h1>
|
||||
<div class="text">When enabled, you will not be able to go back to previous words to fix mistakes.</div>
|
||||
<div class="section confidenceMode">
|
||||
<h1>confidence mode</h1>
|
||||
<div class="text">When enabled, you will not be able to go back to previous words to fix mistakes. When turned
|
||||
up to the max, you won't be able to backspace at all.</div>
|
||||
<div class="buttons">
|
||||
<div class="button on" tabindex="0" onclick="this.blur();">on</div>
|
||||
<div class="button off" tabindex="0" onclick="this.blur();">off</div>
|
||||
<div class="button" confidenceMode="max" tabindex="0" onclick="this.blur();">max</div>
|
||||
<div class="button" confidenceMode="on" tabindex="0" onclick="this.blur();">on</div>
|
||||
<div class="button" confidenceMode="off" tabindex="0" onclick="this.blur();">off</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section stopOnError">
|
||||
|
@ -1370,17 +1372,17 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script> -->
|
||||
<script src="js/chart.js"></script>
|
||||
<script src="js/chartjs-plugin-trendline.js?v=44"></script>
|
||||
<script src="js/chartjs-plugin-trendline.js?v=45"></script>
|
||||
<script src="js/chartjs-plugin-annotation.js"></script>
|
||||
<script src="js/html2canvas.js"></script>
|
||||
<script src="js/words.js?v=44"></script>
|
||||
<script src="js/layouts.js?v=44"></script>
|
||||
<script src="js/db.js?v=44"></script>
|
||||
<script src="js/userconfig.js?v=44"></script>
|
||||
<script src="js/commandline.js?v=44"></script>
|
||||
<script src="js/leaderboards.js?v=44"></script>
|
||||
<script src="js/settings.js?v=44"></script>
|
||||
<script src="js/account.js?v=44"></script>
|
||||
<script src="js/script.js?v=44"></script>
|
||||
<script src="js/words.js?v=45"></script>
|
||||
<script src="js/layouts.js?v=45"></script>
|
||||
<script src="js/db.js?v=45"></script>
|
||||
<script src="js/userconfig.js?v=45"></script>
|
||||
<script src="js/commandline.js?v=45"></script>
|
||||
<script src="js/leaderboards.js?v=45"></script>
|
||||
<script src="js/settings.js?v=45"></script>
|
||||
<script src="js/account.js?v=45"></script>
|
||||
<script src="js/script.js?v=45"></script>
|
||||
|
||||
</html>
|
|
@ -51,6 +51,15 @@ let commands = {
|
|||
showCommandLine();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeConfidenceMode",
|
||||
display: "Change confidence mode...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsConfidenceMode);
|
||||
showCommandLine();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleSmoothCaret",
|
||||
display: "Toggle smooth caret",
|
||||
|
@ -95,13 +104,6 @@ let commands = {
|
|||
toggleFreedomMode();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleMaxConfidence",
|
||||
display: "Toggle max confidence",
|
||||
exec: () => {
|
||||
toggleMaxConfidence();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "toggleBlindMode",
|
||||
display: "Toggle blind mode",
|
||||
|
@ -511,6 +513,33 @@ let commandsTimeConfig = {
|
|||
],
|
||||
};
|
||||
|
||||
let commandsConfidenceMode = {
|
||||
title: "Change confidence mode...",
|
||||
list: [
|
||||
{
|
||||
id: "changeConfidenceModeOff",
|
||||
display: "off",
|
||||
exec: () => {
|
||||
setConfidenceMode("off");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeConfidenceModeOn",
|
||||
display: "on",
|
||||
exec: () => {
|
||||
setConfidenceMode("on");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeConfidenceModeMax",
|
||||
display: "max",
|
||||
exec: () => {
|
||||
setConfidenceMode("max");
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
let commandsFontSize = {
|
||||
title: "Change font size...",
|
||||
list: [
|
||||
|
|
|
@ -2173,6 +2173,29 @@ function updateTestModesNotice() {
|
|||
);
|
||||
}
|
||||
|
||||
if (config.confidenceMode === "on") {
|
||||
$(".pageTest #testModesNotice").append(
|
||||
`<div><i class="fas fa-backspace"></i>confidence</div>`
|
||||
);
|
||||
}
|
||||
if (config.confidenceMode === "max") {
|
||||
$(".pageTest #testModesNotice").append(
|
||||
`<div><i class="fas fa-backspace"></i>max confidence</div>`
|
||||
);
|
||||
}
|
||||
|
||||
if (config.stopOnError) {
|
||||
$(".pageTest #testModesNotice").append(
|
||||
`<div><i class="fas fa-hand-paper"></i>stop on error</div>`
|
||||
);
|
||||
}
|
||||
|
||||
if (config.layout !== "default") {
|
||||
$(".pageTest #testModesNotice").append(
|
||||
`<div><i class="fas fa-keyboard"></i>${config.layout}</div>`
|
||||
);
|
||||
}
|
||||
|
||||
tagsString = "";
|
||||
// $.each($('.pageSettings .section.tags .tagsList .tag'), (index, tag) => {
|
||||
// if($(tag).children('.active').attr('active') === 'true'){
|
||||
|
@ -2753,7 +2776,8 @@ $(document).keydown((event) => {
|
|||
) {
|
||||
return;
|
||||
} else {
|
||||
if (config.maxConfidence) return;
|
||||
if (config.confidenceMode === "on" || config.confidenceMode === "max")
|
||||
return;
|
||||
if (event["ctrlKey"] || event["altKey"]) {
|
||||
currentInput = "";
|
||||
inputHistory.pop();
|
||||
|
@ -2766,9 +2790,7 @@ $(document).keydown((event) => {
|
|||
compareInput(!config.blindMode);
|
||||
}
|
||||
} else {
|
||||
// if ($($(".word")[currentWordIndex - 1]).hasClass("hidden")) {
|
||||
// return;
|
||||
// }
|
||||
if (config.confidenceMode === "max") return;
|
||||
if (event["ctrlKey"]) {
|
||||
currentInput = "";
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,6 @@ function updateSettingsPage() {
|
|||
setSettingsButton("flipTestColors", config.flipTestColors);
|
||||
setSettingsButton("discordDot", config.showDiscordDot);
|
||||
setSettingsButton("colorfulMode", config.colorfulMode);
|
||||
setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
setSettingsButton("randomTheme", config.randomTheme);
|
||||
setSettingsButton("stopOnError", config.stopOnError);
|
||||
setSettingsButton("showAllLines", config.showAllLines);
|
||||
|
@ -63,6 +62,7 @@ function updateSettingsPage() {
|
|||
setActiveTimerOpacityButton();
|
||||
setActiveThemeTab();
|
||||
setCustomThemeInputs();
|
||||
setActiveConfidenceModeButton();
|
||||
|
||||
updateDiscordSettingsSection();
|
||||
|
||||
|
@ -395,6 +395,20 @@ function updateDiscordSettingsSection() {
|
|||
}
|
||||
}
|
||||
|
||||
function setActiveConfidenceModeButton() {
|
||||
let cm = config.confidenceMode;
|
||||
$(".pageSettings .section.confidenceMode .buttons .button").removeClass(
|
||||
"active"
|
||||
);
|
||||
$(
|
||||
`.pageSettings .section.confidenceMode .buttons .button[confidenceMode='${cm}']`
|
||||
).addClass("active");
|
||||
if (cm !== "off") {
|
||||
config.freedomMode = false;
|
||||
setSettingsButton("freedomMode", config.freedomMode);
|
||||
}
|
||||
}
|
||||
|
||||
//smooth caret
|
||||
$(".pageSettings .section.smoothCaret .buttons .button.on").click((e) => {
|
||||
setSmoothCaret(true);
|
||||
|
@ -453,31 +467,42 @@ $(".pageSettings .section.freedomMode .buttons .button.on").click((e) => {
|
|||
saveConfigToCookie();
|
||||
// showNotification('Freedom mode on', 1000);
|
||||
setSettingsButton("freedomMode", config.freedomMode);
|
||||
setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
config.confidenceMode = "off";
|
||||
setActiveConfidenceModeButton();
|
||||
});
|
||||
$(".pageSettings .section.freedomMode .buttons .button.off").click((e) => {
|
||||
setFreedomMode(false);
|
||||
saveConfigToCookie();
|
||||
// showNotification('Freedom mode off', 1000);
|
||||
setSettingsButton("freedomMode", config.freedomMode);
|
||||
setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
});
|
||||
|
||||
//max confidence
|
||||
$(".pageSettings .section.maxConfidence .buttons .button.on").click((e) => {
|
||||
setMaxConfidence(true);
|
||||
saveConfigToCookie();
|
||||
// showNotification('Max confidence on', 1000);
|
||||
setSettingsButton("freedomMode", config.freedomMode);
|
||||
setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
});
|
||||
$(".pageSettings .section.maxConfidence .buttons .button.off").click((e) => {
|
||||
setMaxConfidence(false);
|
||||
saveConfigToCookie();
|
||||
// showNotification('Max confidence off', 1000);
|
||||
setSettingsButton("freedomMode", config.freedomMode);
|
||||
setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
});
|
||||
// //max confidence
|
||||
// $(".pageSettings .section.maxConfidence .buttons .button.on").click((e) => {
|
||||
// setMaxConfidence(true);
|
||||
// saveConfigToCookie();
|
||||
// // showNotification('Max confidence on', 1000);
|
||||
// setSettingsButton("freedomMode", config.freedomMode);
|
||||
// setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
// });
|
||||
// $(".pageSettings .section.maxConfidence .buttons .button.off").click((e) => {
|
||||
// setMaxConfidence(false);
|
||||
// saveConfigToCookie();
|
||||
// // showNotification('Max confidence off', 1000);
|
||||
// setSettingsButton("freedomMode", config.freedomMode);
|
||||
// setSettingsButton("maxConfidence", config.maxConfidence);
|
||||
// });
|
||||
|
||||
//confidence
|
||||
$(document).on(
|
||||
"click",
|
||||
".pageSettings .section.confidenceMode .button",
|
||||
(e) => {
|
||||
let confidence = $(e.currentTarget).attr("confidenceMode");
|
||||
setConfidenceMode(confidence);
|
||||
setActiveConfidenceModeButton();
|
||||
}
|
||||
);
|
||||
|
||||
//keytips
|
||||
$(".pageSettings .section.keyTips .buttons .button.on").click((e) => {
|
||||
|
|
|
@ -32,7 +32,7 @@ let defaultConfig = {
|
|||
flipTestColors: false,
|
||||
layout: "default",
|
||||
showDiscordDot: true,
|
||||
maxConfidence: false,
|
||||
confidenceMode: "off",
|
||||
timerStyle: "bar",
|
||||
colorfulMode: true,
|
||||
randomTheme: false,
|
||||
|
@ -132,7 +132,7 @@ function applyConfig(configObj) {
|
|||
setFlipTestColors(configObj.flipTestColors, true);
|
||||
setDiscordDot(configObj.hideDiscordDot, true);
|
||||
setColorfulMode(configObj.colorfulMode, true);
|
||||
setMaxConfidence(configObj.maxConfidence, true);
|
||||
setConfidenceMode(configObj.confidenceMode, true);
|
||||
setTimerStyle(configObj.timerStyle, true);
|
||||
setTimerColor(configObj.timerColor, true);
|
||||
setTimerOpacity(configObj.timerOpacity, true);
|
||||
|
@ -239,6 +239,7 @@ function toggleStopOnError() {
|
|||
soe = false;
|
||||
}
|
||||
config.stopOnError = soe;
|
||||
updateTestModesNotice();
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
|
@ -247,6 +248,7 @@ function setStopOnError(soe, nosave) {
|
|||
soe = false;
|
||||
}
|
||||
config.stopOnError = soe;
|
||||
updateTestModesNotice();
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
|
@ -491,43 +493,29 @@ function setFreedomMode(freedom, nosave) {
|
|||
freedom = false;
|
||||
}
|
||||
config.freedomMode = freedom;
|
||||
if (config.freedomMode && config.maxConfidence) {
|
||||
config.maxConfidence = false;
|
||||
if (config.freedomMode && config.confidenceMode !== "off") {
|
||||
config.confidenceMode = "off";
|
||||
}
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
function toggleFreedomMode() {
|
||||
config.freedomMode = !config.freedomMode;
|
||||
if (config.freedomMode && config.maxConfidence) {
|
||||
config.maxConfidence = false;
|
||||
if (config.freedomMode && config.confidenceMode !== "off") {
|
||||
config.confidenceMode = false;
|
||||
}
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
//max confidence
|
||||
function toggleMaxConfidence() {
|
||||
// console.log(config.maxConfidence)
|
||||
mc = !config.maxConfidence;
|
||||
if (mc == undefined) {
|
||||
mc = false;
|
||||
function setConfidenceMode(cm, nosave) {
|
||||
if (cm == undefined) {
|
||||
cm = "off";
|
||||
}
|
||||
config.maxConfidence = mc;
|
||||
if (config.freedomMode && config.maxConfidence) {
|
||||
config.freedomMode = false;
|
||||
}
|
||||
// console.log(config.maxConfidence);
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function setMaxConfidence(mc, nosave) {
|
||||
if (mc == undefined) {
|
||||
mc = false;
|
||||
}
|
||||
config.maxConfidence = mc;
|
||||
if (config.freedomMode && config.maxConfidence) {
|
||||
config.confidenceMode = cm;
|
||||
if (config.freedomMode && config.confidenceMode !== "off") {
|
||||
config.freedomMode = false;
|
||||
}
|
||||
updateTestModesNotice();
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
|
@ -681,6 +669,7 @@ function changeLayout(layout, nosave) {
|
|||
layout = "qwerty";
|
||||
}
|
||||
config.layout = layout;
|
||||
updateTestModesNotice();
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue