From fa8149bf165819c84122eb47161639cd80014d76 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 8 Sep 2020 01:32:26 +0100 Subject: [PATCH] changed read ahead to be a funbox --- public/css/style.scss | 7 ------- public/funbox/list.json | 5 +++++ public/funbox/read_ahead.css | 4 ++++ public/index.html | 4 ++-- public/js/commandline.js | 14 +++++++------- public/js/script.js | 32 ++++++++++++++++---------------- public/js/settings.js | 8 ++++---- public/js/userconfig.js | 34 +++++++++++++++++----------------- 8 files changed, 55 insertions(+), 53 deletions(-) create mode 100644 public/funbox/read_ahead.css diff --git a/public/css/style.scss b/public/css/style.scss index 0f9b159ec..1592648bf 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -1407,13 +1407,6 @@ key { } } } - - &.readAheadMode { - .word.active:nth-of-type(n + 2), - .word.active:nth-of-type(n + 2) + .word { - color: var(--bg-color); - } - } } #words.flipped.colorfulMode .word.error, diff --git a/public/funbox/list.json b/public/funbox/list.json index 727ad8d21..664f68051 100644 --- a/public/funbox/list.json +++ b/public/funbox/list.json @@ -73,5 +73,10 @@ "name": "plus_one", "type": "script", "info": "React quickly! Only one future word is visible." + }, + { + "name": "read_ahead", + "type": "style", + "info": "Current and the next word is invisible!" } ] diff --git a/public/funbox/read_ahead.css b/public/funbox/read_ahead.css new file mode 100644 index 000000000..a049ec63e --- /dev/null +++ b/public/funbox/read_ahead.css @@ -0,0 +1,4 @@ +#words .word.active:nth-of-type(n + 2), +#words .word.active:nth-of-type(n + 2) + .word { + color: var(--bg-color); +} diff --git a/public/index.html b/public/index.html index f62760460..e0ab9a940 100644 --- a/public/index.html +++ b/public/index.html @@ -1612,7 +1612,7 @@ -
+

always show words history

diff --git a/public/js/commandline.js b/public/js/commandline.js index c20363a1c..de0a29b8a 100644 --- a/public/js/commandline.js +++ b/public/js/commandline.js @@ -137,13 +137,13 @@ let commands = { toggleBlindMode(); }, }, - { - id: "toggleReadAheadMode", - display: "Toggle read ahead mode", - exec: () => { - toggleReadAheadMode(); - }, - }, + // { + // 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 c8f2fc772..0b7c69f2a 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1798,7 +1798,7 @@ function showResult(difficultyFailed = false) { difficulty: config.difficulty, testDuration: testtime, blindMode: config.blindMode, - readAheadMode: config.readAheadMode, + // readAheadMode: config.readAheadMode, theme: config.theme, tags: activeTags, keySpacing: keypressStats.spacing.array, @@ -2129,9 +2129,9 @@ function showResult(difficultyFailed = false) { if (config.blindMode) { testType += "
blind"; } - if (config.readAheadMode) { - testType += "
read_ahead"; - } + // if (config.readAheadMode) { + // testType += "
read_ahead"; + // } if (activeFunBox !== "none") { testType += "
" + activeFunBox; } @@ -3026,13 +3026,13 @@ function applyColorfulMode(tc) { } } -function applyReadAheadMode(tc) { - if (tc) { - $("#words").addClass("readAheadMode"); - } else { - $("#words").removeClass("readAheadMode"); - } -} +// function applyReadAheadMode(tc) { +// if (tc) { +// $("#words").addClass("readAheadMode"); +// } else { +// $("#words").removeClass("readAheadMode"); +// } +// } function showEditTags(action, id, name) { if (action === "add") { @@ -3116,11 +3116,11 @@ function updateTestModesNotice() { ); } - if (config.readAheadMode) { - $(".pageTest #testModesNotice").append( - `
read ahead
` - ); - } + // if (config.readAheadMode) { + // $(".pageTest #testModesNotice").append( + // `
read ahead
` + // ); + // } if (activeFunBox !== "none") { $(".pageTest #testModesNotice").append( diff --git a/public/js/settings.js b/public/js/settings.js index 046c49530..30322bab2 100644 --- a/public/js/settings.js +++ b/public/js/settings.js @@ -138,10 +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.readAheadMode = new SettingsGroup( +// "readAheadMode", +// setReadAheadMode +// ); settingsGroups.alwaysShowWordsHistory = new SettingsGroup( "alwaysShowWordsHistory", setAlwaysShowWordsHistory diff --git a/public/js/userconfig.js b/public/js/userconfig.js index 784e0e658..8740de949 100644 --- a/public/js/userconfig.js +++ b/public/js/userconfig.js @@ -30,7 +30,7 @@ let defaultConfig = { difficulty: "normal", blindMode: false, quickEnd: false, - readAheadMode: false, + // readAheadMode: false, caretStyle: "default", flipTestColors: false, layout: "default", @@ -151,7 +151,7 @@ function applyConfig(configObj) { setDifficulty(configObj.difficulty, true); setBlindMode(configObj.blindMode, true); setQuickEnd(configObj.quickEnd, true); - setReadAheadMode(configObj.readAheadMode, true); + // setReadAheadMode(configObj.readAheadMode, true); setFlipTestColors(configObj.flipTestColors, true); setColorfulMode(configObj.colorfulMode, true); setConfidenceMode(configObj.confidenceMode, true); @@ -276,22 +276,22 @@ function setBlindMode(blind, nosave) { } //read ahead mode -function toggleReadAheadMode() { - config.readAheadMode = !config.readAheadMode; - applyReadAheadMode(config.readAheadMode); - updateTestModesNotice(); - saveConfigToCookie(); -} +// 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(); -} +// function setReadAheadMode(readAhead, nosave) { +// if (readAhead == undefined) { +// readAhead = false; +// } +// config.readAheadMode = readAhead; +// applyReadAheadMode(readAhead); +// updateTestModesNotice(); +// if (!nosave) saveConfigToCookie(); +// } //stoponerror // function toggleStopOnError() {