diff --git a/src/js/input-controller.js b/src/js/input-controller.js index 27562c508..b854e017a 100644 --- a/src/js/input-controller.js +++ b/src/js/input-controller.js @@ -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 === "") { diff --git a/src/js/test/test-logic.js b/src/js/test/test-logic.js index b2b7cd9a4..c2d481f3c 100644 --- a/src/js/test/test-logic.js +++ b/src/js/test/test-logic.js @@ -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; diff --git a/src/js/test/wikipedia.js b/src/js/test/wikipedia.js index 28c3ece9f..04d031c22 100644 --- a/src/js/test/wikipedia.js +++ b/src/js/test/wikipedia.js @@ -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>

+/g, " "); + sectionText = $("

").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); }); diff --git a/static/quotes/russian.json b/static/quotes/russian.json index 9e049b26c..0fa97380f 100644 --- a/static/quotes/russian.json +++ b/static/quotes/russian.json @@ -820,8 +820,8 @@ { "id": 136, "source": "Лу Эрленд - У", - "text": "Занятно, оказывается, принимаются решения! Только что ты не знал, что делать, и вдруг, в следующую секунду, знаешь! Что-то такое происодит с тобой в одну секунду. Ты прокручиваешь в голове бесчисленные варианты и вдруг думаешь: на то-то и то-то я не буду обращать внимания, приоритетным для меня является то-то и то-то, и поэтому я принимаю такое-то и такое-то решение. Потрясающий процесс! Мозг всё расставил по полочкам. Отсеивает негодные варианты, пока не остаётся один-единственный. Сигналы забегали туда-сюда - и готово. Очень тонкий инструмент.", - "length": 551 + "text": "Занятно, оказывается, принимаются решения! Только что ты не знал, что делать, и вдруг, в следующую секунду, знаешь! Что-то такое происходит с тобой в одну секунду. Ты прокручиваешь в голове бесчисленные варианты и вдруг думаешь: на то-то и то-то я не буду обращать внимания, приоритетным для меня является то-то и то-то, и поэтому я принимаю такое-то и такое-то решение. Потрясающий процесс! Мозг всё расставил по полочкам. Отсеивает негодные варианты, пока не остаётся один-единственный. Сигналы забегали туда-сюда - и готово. Очень тонкий инструмент.", + "length": 552 }, { "id": 137,