Skip to content

Commit 24eb7b1

Browse files
Merge branch 'dev' into subtitles
2 parents c4a8d49 + bd77045 commit 24eb7b1

15 files changed

Lines changed: 439 additions & 185 deletions

‎api.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function word_test_ajax($get_req): array
246246
$get_req['test_key'], $get_req['selection']
247247
);
248248
return get_word_test_ajax(
249-
$test_sql, filter_var($get_req['word_mode'], FILTER_VALIDATE_BOOLEAN),
249+
$test_sql,filter_var($get_req['word_mode'], FILTER_VALIDATE_BOOLEAN),
250250
$get_req['lg_id'],
251251
$get_req['word_regex'], $get_req['type']
252252
);

‎delete_word.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function delete_word(wid) {
8787
const context = window.parent.document;
8888
const elem = $('.word' + wid, context);
8989
let title = "";
90-
if (!window.parent.document.getElementById('frame-l').LWT_DATA.settings.jQuery_tooltip) {
90+
if (!window.parent.document.LWT_DATA.settings.jQuery_tooltip) {
9191
const ann = elem.attr('data_ann');
9292
title = make_tooltip(
9393
<?php echo prepare_textdata_js(get_term($wid)); ?>,

‎do_test_test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ function do_test_test_interaction_globals($wb1, $wb2, $wb3)
749749
if (LANG && LANG != LWT_DATA.language.translator_link) {
750750
$("html").attr('lang', LANG);
751751
}
752-
OPENED = 0;
752+
LWT_DATA.test.answer_opened = false;
753753
</script>
754754
<?php
755755
}

‎do_text_text.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@ function do_text_text_javascript($var_array): void
654654
}
655655
LANG = getLangFromDict(LWT_DATA.language.translator_link);
656656
LWT_DATA.text.reading_position = -1;
657-
OPENED = 0;
657+
// Note from 2.10.0: is the next line necessary on text?
658+
LWT_DATA.test.answer_opened = false;
658659
// Change the language of the current frame
659660
if (LANG && LANG != LWT_DATA.language.translator_link) {
660661
$("html").attr('lang', LANG);

‎docs/CHANGELOG.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ ones are marked like "v1.0.0-fork".
3636
See [#160](https://github.com/HugoFara/lwt/issues/160).
3737
It adds `README.md` and `UNLICENSE.md`.
3838
* Adds `docs/info.html` and `docs/index.html` from [#146](https://github.com/HugoFara/lwt/pull/146).
39+
* Multi-word creation was reviewed to use a simpler code.
40+
* On word review, status + 1 can be set only after word display. Before, you could
41+
press key up at any time to increase term status, but keydown was effective only
42+
after solution display ([#159](https://github.com/HugoFara/lwt/issues/159)).
3943

4044
### Fixed
4145

@@ -48,6 +52,23 @@ Solves [#129](https://github.com/HugoFara/lwt/issues/129), thanks to the help of
4852
* Text reading position was not working consistently when adding several known words.
4953
* Japanese was always requiring MeCab for TTS, even if it was not used
5054
([#155](https://github.com/HugoFara/lwt/pull/155)).
55+
* Multi-words:
56+
* Tooltip was not properly saved ([#170](https://github.com/HugoFara/lwt/pull/170)).
57+
* Translation may be escaped two times ([#170](https://github.com/HugoFara/lwt/pull/170)).
58+
* Fixes [#170](https://github.com/HugoFara/lwt/pull/170): on creation,
59+
multi-word was always displayed before the text it encompasses,
60+
without removing this text.
61+
* Tootltip title was not properly saved, normally without incidence on user display.
62+
* Fixes [#69](https://github.com/HugoFara/lwt/issues/69): having the same
63+
multi-word on multiple texts was displaying it at many positions on creation.
64+
* Japanese:
65+
* Parsing Japanese texts with MeCab was creating warnings when the text was not
66+
finishing by a punctation mark.
67+
* Multi-words were not saved with MeCab parsing on Japanese.
68+
* On word review (test):
69+
* the space keyboard shortcut may have been inoperating.
70+
* On `api.php`, tests were always set to "multi-word" due to a missing variable
71+
type conversion. Pull request [#175](https://github.com/HugoFara/lwt/pull/175).
5172

5273
### Deprecated
5374

‎docs/info.html‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,10 @@ <h4>Changed</h4>
22252225
<li>Adds <code>docs/info.html</code> and <code>docs/index.html</code> from <a href="https://github.com/HugoFara/lwt/pull/146">#146</a>.</li>
22262226
</ul>
22272227
</li>
2228+
<li>Multi-word creation was reviewed to use a simpler code.</li>
2229+
<li>On word review, status + 1 can be set only after word display. Before, you could
2230+
press key up at any time to increase term status, but keydown was effective only
2231+
after solution display (<a href="https://github.com/HugoFara/lwt/issues/159">#159</a>).</li>
22282232
</ul>
22292233
<h4>Fixed</h4>
22302234
<ul>
@@ -2237,6 +2241,32 @@ <h4>Fixed</h4>
22372241
<li>Text reading position was not working consistently when adding several known words.</li>
22382242
<li>Japanese was always requiring MeCab for TTS, even if it was not used
22392243
(<a href="https://github.com/HugoFara/lwt/pull/155">#155</a>).</li>
2244+
<li>Multi-words:
2245+
<ul>
2246+
<li>Tooltip was not properly saved (<a href="https://github.com/HugoFara/lwt/pull/170">#170</a>).</li>
2247+
<li>Translation may be escaped two times (<a href="https://github.com/HugoFara/lwt/pull/170">#170</a>).</li>
2248+
<li>Fixes <a href="https://github.com/HugoFara/lwt/pull/170">#170</a>: on creation,
2249+
multi-word was always displayed before the text it encompasses,
2250+
without removing this text.</li>
2251+
<li>Tootltip title was not properly saved, normally without incidence on user display.</li>
2252+
<li>Fixes <a href="https://github.com/HugoFara/lwt/issues/69">#69</a>: having the same
2253+
multi-word on multiple texts was displaying it at many positions on creation.</li>
2254+
</ul>
2255+
</li>
2256+
<li>Japanese:
2257+
<ul>
2258+
<li>Parsing Japanese texts with MeCab was creating warnings when the text was not
2259+
finishing by a punctation mark.</li>
2260+
<li>Multi-words were not saved with MeCab parsing on Japanese.</li>
2261+
</ul>
2262+
</li>
2263+
<li>On word review (test):
2264+
<ul>
2265+
<li>the space keyboard shortcut may have been inoperating.</li>
2266+
<li>On <code>api.php</code>, tests were always set to "multi-word" due to a missing variable
2267+
type conversion. Pull request <a href="https://github.com/HugoFara/lwt/pull/175">#175</a>.</li>
2268+
</ul>
2269+
</li>
22402270
</ul>
22412271
<h4>Deprecated</h4>
22422272
<ul>

‎edit_mword.php‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@
3131
*/
3232
function export_term_js_dict($term): string
3333
{
34+
$translation = $term->translation . getWordTagList($term->id, ' ', 1, 0);
3435
$raw_answer = json_encode(
3536
array(
3637
"woid" => $term->id,
37-
"text" => $term->text,
38+
"text" => $term->text,
3839
"romanization" => $term->roman,
39-
"translation" => prepare_textdata_js(
40-
$term->translation . getWordTagList($term->id, ' ', 1, 0)
41-
),
40+
"translation" => $translation,
4241
"status" => $term->status
4342
)
4443
);
@@ -213,17 +212,16 @@ function edit_mword_do_update($term, $newstatus)
213212
$term->status = (int) $_REQUEST["WoStatus"];
214213
?>
215214
<script type="text/javascript">
216-
//<![CDATA[
217215
function update_mword(mword, oldstatus) {
218216
const context = window.parent.document;
219217
let title = '';
220218
if (window.parent.LWT_DATA.settings.jQuery_tooltip)
221219
title = make_tooltip(
222-
mword.text, mword.trans, mword.roman, mword.status
220+
mword.text, mword.translation, mword.romanization, mword.status
223221
);
224222
$('.word' + mword.woid, context)
225-
.attr('data_trans', mword.trans)
226-
.attr('data_rom', mword.roman)
223+
.attr('data_trans', mword.translation)
224+
.attr('data_rom', mword.romanization)
227225
.attr('title', title)
228226
.removeClass('status' + oldstatus)
229227
.addClass('status' + mword.status)
@@ -234,7 +232,6 @@ function update_mword(mword, oldstatus) {
234232
<?php echo export_term_js_dict($term); ?>,
235233
<?php echo (int) $_REQUEST['WoOldStatus']; ?>
236234
);
237-
//]]>
238235
</script>
239236
<?php
240237
return $message;

‎edit_word.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function change_term_display($wid, $translation, $hex): void
138138
?>;
139139
const roman = <?php echo prepare_textdata_js($_REQUEST["WoRomanization"]); ?>;
140140
let title;
141-
if (window.parent.document.getElementById('frame-l').LWT_DATA.settings.jQuery_tooltip) {
141+
if (window.parent.LWT_DATA.settings.jQuery_tooltip) {
142142
title = '';
143143
} else {
144144
title = make_tooltip(

‎inc/database_connect.php‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,9 @@ function parse_japanese_text($text, $id): ?array
814814
$count = 0;
815815
$row = array(0, 0, 0, "", 0);
816816
foreach (explode(PHP_EOL, $mecabed) as $line) {
817+
if (trim($line) == "") {
818+
continue;
819+
}
817820
list($term, $node_type, $third) = explode(mb_chr(9), $line);
818821
if ($term_type == 2 || $term == 'EOP' && $third == '7') {
819822
$sid += 1;
@@ -1048,6 +1051,9 @@ function ($matches) use ($noSentenceEnd) {
10481051
$count = 0;
10491052
$row = array(0, 0, 0, "", 0);
10501053
foreach (explode("\n", $text) as $line) {
1054+
if (trim($line) == "") {
1055+
continue;
1056+
}
10511057
list($word_count, $term) = explode("\t", $line);
10521058
$row[0] = $sid; // TiSeID
10531059
$row[1] = $count + 1; // TiCount
@@ -1901,9 +1907,8 @@ function check_update_db($debug, $tbpref, $dbname): void
19011907
$queries = SQLParser(__DIR__ . "/../db/schema/baseline.sql");
19021908
foreach ($queries as $query) {
19031909
$prefixed_query = prefixSQLQuery($query, $tbpref);
1904-
runsql($prefixed_query, "");
1905-
// Increment for new tables only
1906-
$count++;
1910+
// Increment count for new tables only
1911+
$count += runsql($prefixed_query, "");
19071912
}
19081913

19091914
if (!in_array("{$tbpref}textitems2", $tables)) {
@@ -1934,8 +1939,8 @@ function check_update_db($debug, $tbpref, $dbname): void
19341939
runsql(
19351940
"ALTER TABLE `{$tbpref}sentences` ADD SeFirstPos smallint(5) NOT NULL",
19361941
'',
1937-
false
1938-
);//move to update_database()?
1942+
false
1943+
);
19391944

19401945
if ($count > 0) {
19411946
// Rebuild Text Cache if cache tables new

0 commit comments

Comments
 (0)