This commit is contained in:
Miodec 2021-12-20 16:42:01 +01:00
commit fdd2bc1a42
4 changed files with 16 additions and 5 deletions

View file

@ -428,7 +428,7 @@ function handleChar(char, charIndex) {
}
}
if (!correctShiftUsed) return;
if (!correctShiftUsed && Config.difficulty != "master") return;
//update current corrected version. if its empty then add the current char. if its not then replace the last character with the currently pressed one / add it
if (TestLogic.corrected.current === "") {

View file

@ -20,6 +20,7 @@ import * as TimerProgress from "./timer-progress";
import * as ChartController from "./chart-controller";
import * as UI from "./ui";
import * as QuoteSearchPopup from "./quote-search-popup";
import * as QuoteSubmitPopup from "./quote-submit-popup";
import * as PbCrown from "./pb-crown";
import * as TestTimer from "./test-timer";
import * as OutOfFocus from "./out-of-focus";
@ -970,11 +971,14 @@ export async function init() {
let quotes = await Misc.getQuotes(Config.language.replace(/_\d*k$/g, ""));
if (quotes.length === 0) {
TestUI.setTestRestarting(false);
Notifications.add(
`No ${Config.language.replace(/_\d*k$/g, "")} quotes found`,
0
);
TestUI.setTestRestarting(false);
if (firebase.auth().currentUser) {
QuoteSubmitPopup.show(false);
}
UpdateConfig.setMode("words");
restart();
return;

View file

@ -30,7 +30,7 @@ export async function getSection() {
rej(randomPostReq.status);
}
const sectionURL = `https://en.wikipedia.org/w/api.php?action=query&format=json&pageids=${pageid}&prop=extracts&exintro=true&explaintext=true&origin=*`;
const sectionURL = `https://en.wikipedia.org/w/api.php?action=query&format=json&pageids=${pageid}&prop=extracts&exintro=true&origin=*`;
var sectionReq = new XMLHttpRequest();
sectionReq.onload = () => {
@ -42,10 +42,17 @@ export async function getSection() {
let words = [];
// Remove non-ascii characters, double whitespaces and finally trailing whitespaces.
sectionText = sectionText.replace(/<\/p><p>+/g, " ");
sectionText = $("<div/>").html(sectionText).text();
sectionText = sectionText.replace(/[\u{0080}-\u{10FFFF}]/gu, "");
sectionText = sectionText.replace(/\s+/g, " ");
sectionText = sectionText.trim();
// // Add spaces
// sectionText = sectionText.replace(/[a-zA-Z0-9]{3,}\.[a-zA-Z]/g, (x) =>
// x.replace(/\./, ". ")
// );
sectionText.split(" ").forEach((word) => {
words.push(word);
});

View file

@ -820,8 +820,8 @@
{
"id": 136,
"source": "Лу Эрленд - У",
"text": "Занятно, оказывается, принимаются решения! Только что ты не знал, что делать, и вдруг, в следующую секунду, знаешь! Что-то такое происодит с тобой в одну секунду. Ты прокручиваешь в голове бесчисленные варианты и вдруг думаешь: на то-то и то-то я не буду обращать внимания, приоритетным для меня является то-то и то-то, и поэтому я принимаю такое-то и такое-то решение. Потрясающий процесс! Мозг всё расставил по полочкам. Отсеивает негодные варианты, пока не остаётся один-единственный. Сигналы забегали туда-сюда - и готово. Очень тонкий инструмент.",
"length": 551
"text": "Занятно, оказывается, принимаются решения! Только что ты не знал, что делать, и вдруг, в следующую секунду, знаешь! Что-то такое происходит с тобой в одну секунду. Ты прокручиваешь в голове бесчисленные варианты и вдруг думаешь: на то-то и то-то я не буду обращать внимания, приоритетным для меня является то-то и то-то, и поэтому я принимаю такое-то и такое-то решение. Потрясающий процесс! Мозг всё расставил по полочкам. Отсеивает негодные варианты, пока не остаётся один-единственный. Сигналы забегали туда-сюда - и готово. Очень тонкий инструмент.",
"length": 552
},
{
"id": 137,