Skip to content

Commit 9228d51

Browse files
committed
Small fix on HugoFara#147 and finishes integration of the feature.
1 parent e764e9a commit 9228d51

6 files changed

Lines changed: 42 additions & 14 deletions

File tree

‎docs/CHANGELOG.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ other versions come from the canonical LWT ("official" branch on Git).
55
For git tags, official releases are marked like "v1.0.0", while unofficial
66
ones are marked like "v1.0.0-fork".
77

8-
## [Unreleased]
8+
## [Unreleased]
9+
10+
### Added
11+
12+
* Word reading can be allowed on hover or on click.
13+
Pull request [#147](https://github.com/HugoFara/lwt/pull/147) by
14+
[@ProgramComputer](https://github.com/ProgramComputer).
915

1016
### Fixed
1117

‎docs/info.html‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,12 @@ <h2 id="CHANGELOG" name="CHANGELOG">▶ Changelog - <a href="#">[↑]</a></h2>
21832183
For git tags, official releases are marked like "v1.0.0", while unofficial
21842184
ones are marked like "v1.0.0-fork".</p>
21852185
<h3>[Unreleased]</h3>
2186+
<h4>Added</h4>
2187+
<ul>
2188+
<li>Word reading can be allowed on hover or on click.
2189+
Pull request <a href="https://github.com/HugoFara/lwt/pull/147">#147</a> by
2190+
<a href="https://github.com/ProgramComputer">@ProgramComputer</a>.</li>
2191+
</ul>
21862192
<h4>Fixed</h4>
21872193
<ul>
21882194
<li>The database wizard was broken since 2.9.0.</li>

‎inc/session_utility.php‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,16 +2409,23 @@ function get_annotation_position_selectoptions($v): string
24092409
}
24102410
// -------------------------------------------------------------
24112411

2412-
function get_hts_selectoptions($v): string
2412+
function get_hts_selectoptions($current_setting): string
24132413
{
2414-
if (! isset($v) ) { $v = 1;
2414+
if (!isset($current_setting)) {
2415+
$current_setting = 1;
2416+
}
2417+
$options = array(
2418+
1 => "Never",
2419+
2 => "On Click",
2420+
3 => "On Hover"
2421+
);
2422+
$r = "";
2423+
foreach ($options as $key => $value) {
2424+
$r .= sprintf(
2425+
'<option value="%d"%s>%s</option>',
2426+
$key, get_selected($current_setting, $key), $value
2427+
);
24152428
}
2416-
$r = "<option value=\"1\"" . get_selected($v, 1);
2417-
$r .= ">Never</option>";
2418-
$r .= "<option value=\"2\"" . get_selected($v, 2);
2419-
$r .= ">On Click</option>";
2420-
$r .= "<option value=\"3\"" . get_selected($v, 3);
2421-
$r .= ">On Hover</option>";
24222429
return $r;
24232430
}
24242431

‎js/pgm.js‎

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎settings.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@
111111
1 : 0
112112
)
113113
);
114+
114115
saveSetting(
115116
'set-hts',
116-
$_REQUEST['set-hts']
117-
);
117+
$_REQUEST['set-hts']
118+
);
118119

119120
saveSetting(
120121
'set-archivedtexts-per-page',

‎src/js/jq_pgm.js‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ function word_dblclick_event_do_text_text () {
642642
/**
643643
* Do a word edition window. Usually called when the user clicks on a word.
644644
*
645+
* @since 2.9.10-fork Read word aloud if HTS equals 2.
646+
*
645647
* @returns {bool} false
646648
*/
647649
function word_click_event_do_text_text () {
@@ -693,6 +695,10 @@ function word_click_event_do_text_text () {
693695
$(this).text(), $(this).attr('data_wid'), status, multi_words, RTL, ann
694696
);
695697
}
698+
if (HTS == 2) {
699+
const lg = getLangFromDict(WBLINK3);
700+
readTextAloud($(this).text(), lg);
701+
}
696702
return false;
697703
}
698704

@@ -715,10 +721,10 @@ function mword_click_event_do_text_text () {
715721
$(this).attr('data_wid'), status, $(this).attr('data_code'), ann
716722
);
717723
}
718-
if (HTS == 2) {
724+
if (HTS == 2) {
719725
const lg = getLangFromDict(WBLINK3);
720726
readTextAloud($(this).text(), lg);
721-
}
727+
}
722728
return false;
723729
}
724730

0 commit comments

Comments
 (0)