diff --git a/public/js/commandline.js b/public/js/commandline.js
index 38078da1a..c20363a1c 100644
--- a/public/js/commandline.js
+++ b/public/js/commandline.js
@@ -137,6 +137,13 @@ let commands = {
toggleBlindMode();
},
},
+ {
+ id: "toggleReadAheadMode",
+ display: "Toggle read ahead mode",
+ exec: () => {
+ toggleReadAheadMode();
+ },
+ },
{
id: "toggleQuickEnd",
display: "Toggle quick end",
diff --git a/public/js/script.js b/public/js/script.js
index 664ee3284..541df1741 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -1798,6 +1798,7 @@ function showResult(difficultyFailed = false) {
difficulty: config.difficulty,
testDuration: testtime,
blindMode: config.blindMode,
+ readAheadMode: config.readAheadMode,
theme: config.theme,
tags: activeTags,
keySpacing: keypressStats.spacing.array,
@@ -2128,6 +2129,9 @@ function showResult(difficultyFailed = false) {
if (config.blindMode) {
testType += "
blind";
}
+ if (config.readAheadMode) {
+ testType += "
read_ahead";
+ }
if (activeFunBox !== "none") {
testType += "
" + activeFunBox;
}
@@ -3010,6 +3014,14 @@ function applyColorfulMode(tc) {
}
}
+function applyReadAheadMode(tc) {
+ if (tc) {
+ $("#words").addClass("readAheadMode");
+ } else {
+ $("#words").removeClass("readAheadMode");
+ }
+}
+
function showEditTags(action, id, name) {
if (action === "add") {
$("#tagsWrapper #tagsEdit").attr("action", "add");
@@ -3092,6 +3104,12 @@ function updateTestModesNotice() {
);
}
+ if (config.readAheadMode) {
+ $(".pageTest #testModesNotice").append(
+ `
read ahead
`
+ );
+ }
+
if (activeFunBox !== "none") {
$(".pageTest #testModesNotice").append(
`
${activeFunBox.replace(
diff --git a/public/js/settings.js b/public/js/settings.js
index 21173f582..257ae6159 100644
--- a/public/js/settings.js
+++ b/public/js/settings.js
@@ -138,6 +138,10 @@ settingsGroups.confidenceMode = new SettingsGroup(
);
settingsGroups.blindMode = new SettingsGroup("blindMode", setBlindMode);
settingsGroups.quickEnd = new SettingsGroup("quickEnd", setQuickEnd);
+settingsGroups.readAheadMode = new SettingsGroup(
+ "readAheadMode",
+ setReadAheadMode
+);
settingsGroups.alwaysShowWordsHistory = new SettingsGroup(
"alwaysShowWordsHistory",
setAlwaysShowWordsHistory
diff --git a/public/js/userconfig.js b/public/js/userconfig.js
index d966caebf..ba56b44ab 100644
--- a/public/js/userconfig.js
+++ b/public/js/userconfig.js
@@ -30,6 +30,7 @@ let defaultConfig = {
difficulty: "normal",
blindMode: false,
quickEnd: false,
+ readAheadMode: false,
caretStyle: "default",
flipTestColors: false,
layout: "default",
@@ -150,6 +151,7 @@ function applyConfig(configObj) {
setDifficulty(configObj.difficulty, true);
setBlindMode(configObj.blindMode, true);
setQuickEnd(configObj.quickEnd, true);
+ setReadAheadMode(configObj.readAheadMode, true);
setFlipTestColors(configObj.flipTestColors, true);
setColorfulMode(configObj.colorfulMode, true);
setConfidenceMode(configObj.confidenceMode, true);
@@ -273,6 +275,24 @@ function setBlindMode(blind, nosave) {
if (!nosave) saveConfigToCookie();
}
+//read ahead mode
+function toggleReadAheadMode() {
+ config.readAheadMode = !config.readAheadMode;
+ applyReadAheadMode(config.readAheadMode);
+ updateTestModesNotice();
+ saveConfigToCookie();
+}
+
+function setReadAheadMode(readAhead, nosave) {
+ if (readAhead == undefined) {
+ readAhead = false;
+ }
+ config.readAheadMode = readAhead;
+ applyReadAheadMode(readAhead);
+ updateTestModesNotice();
+ if (!nosave) saveConfigToCookie();
+}
+
//stoponerror
// function toggleStopOnError() {
// soe = !config.stopOnError;