Add descriptions
Add descriptions
This commit is contained in:
parent
aa8b071b3a
commit
5dcc39ce97
@ -4,7 +4,7 @@ include "components/api-out.php";
|
|||||||
|
|
||||||
error_reporting(E_ERROR | E_PARSE);
|
error_reporting(E_ERROR | E_PARSE);
|
||||||
|
|
||||||
function toMd5 ($str) { // Возможность своей ренализации алгоритма md5 при необходимости
|
function toMd5 ($str) { // Возможность своей реализации алгоритма md5 при необходимости
|
||||||
return md5($str);
|
return md5($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +46,14 @@ function selectRuIndex ($text) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
В функции wrong_symbol я решил использовать рекурсию: если нам не передаётся язык, то он определяется автоматически.
|
||||||
|
Результаты алгоритм аавтоподсветки необходимых элементов записываются в базу данных, после чего они могут быть импортированы
|
||||||
|
из базы данных, что в свою очередь экономит рантайм метода.
|
||||||
|
|
||||||
|
Возвращает список индексов в формате json, которые необходимо "подсветить" на уровне клиента.
|
||||||
|
*/
|
||||||
|
|
||||||
function wrong_symbol ($text, $lang) {
|
function wrong_symbol ($text, $lang) {
|
||||||
switch ($lang) {
|
switch ($lang) {
|
||||||
case "ru_RU":
|
case "ru_RU":
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
var textInputed = document.getElementById('textArea').innerHTML;
|
var textInputed = document.getElementById('textArea').innerHTML;
|
||||||
|
|
||||||
function escapeRegExp(string) {
|
function escapeRegExp(string) {
|
||||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(str, find, replace) {
|
function replaceAll(str, find, replace) {
|
||||||
@ -56,7 +56,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formHandler = () => {
|
const formHandler = () => {
|
||||||
let request = new XMLHttpRequest();
|
let request = new XMLHttpRequest();
|
||||||
|
/*
|
||||||
|
Получаем из метода список индексов, которые мы "подсветим".
|
||||||
|
*/
|
||||||
request.open("GET", `/api/wrong_symbols.find.php?text=${textInputed}`, false);
|
request.open("GET", `/api/wrong_symbols.find.php?text=${textInputed}`, false);
|
||||||
request.send();
|
request.send();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user