Skip to content

Commit

Permalink
Small fix on #147 and finishes integration of the feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoFara committed Dec 30, 2023
1 parent e764e9a commit 9228d51
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
8 changes: 7 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ other versions come from the canonical LWT ("official" branch on Git).
For git tags, official releases are marked like "v1.0.0", while unofficial
ones are marked like "v1.0.0-fork".

## [Unreleased]
## [Unreleased]

### Added

* Word reading can be allowed on hover or on click.
Pull request [#147](https://github.com/HugoFara/lwt/pull/147) by
[@ProgramComputer](https://github.com/ProgramComputer).

### Fixed

Expand Down
6 changes: 6 additions & 0 deletions docs/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2183,6 +2183,12 @@ <h2 id="CHANGELOG" name="CHANGELOG">▶ Changelog - <a href="#">[↑]</a></h2>
For git tags, official releases are marked like "v1.0.0", while unofficial
ones are marked like "v1.0.0-fork".</p>
<h3>[Unreleased]</h3>
<h4>Added</h4>
<ul>
<li>Word reading can be allowed on hover or on click.
Pull request <a href="https://github.com/HugoFara/lwt/pull/147">#147</a> by
<a href="https://github.com/ProgramComputer">@ProgramComputer</a>.</li>
</ul>
<h4>Fixed</h4>
<ul>
<li>The database wizard was broken since 2.9.0.</li>
Expand Down
23 changes: 15 additions & 8 deletions inc/session_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -2409,16 +2409,23 @@ function get_annotation_position_selectoptions($v): string
}
// -------------------------------------------------------------

function get_hts_selectoptions($v): string
function get_hts_selectoptions($current_setting): string
{
if (! isset($v) ) { $v = 1;
if (!isset($current_setting)) {
$current_setting = 1;
}
$options = array(
1 => "Never",
2 => "On Click",
3 => "On Hover"
);
$r = "";
foreach ($options as $key => $value) {
$r .= sprintf(
'<option value="%d"%s>%s</option>',
$key, get_selected($current_setting, $key), $value
);
}
$r = "<option value=\"1\"" . get_selected($v, 1);
$r .= ">Never</option>";
$r .= "<option value=\"2\"" . get_selected($v, 2);
$r .= ">On Click</option>";
$r .= "<option value=\"3\"" . get_selected($v, 3);
$r .= ">On Hover</option>";
return $r;
}

Expand Down
4 changes: 3 additions & 1 deletion js/pgm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@
1 : 0
)
);

saveSetting(
'set-hts',
$_REQUEST['set-hts']
);
$_REQUEST['set-hts']
);

saveSetting(
'set-archivedtexts-per-page',
Expand Down
10 changes: 8 additions & 2 deletions src/js/jq_pgm.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ function word_dblclick_event_do_text_text () {
/**
* Do a word edition window. Usually called when the user clicks on a word.
*
* @since 2.9.10-fork Read word aloud if HTS equals 2.
*
* @returns {bool} false
*/
function word_click_event_do_text_text () {
Expand Down Expand Up @@ -693,6 +695,10 @@ function word_click_event_do_text_text () {
$(this).text(), $(this).attr('data_wid'), status, multi_words, RTL, ann
);
}
if (HTS == 2) {
const lg = getLangFromDict(WBLINK3);
readTextAloud($(this).text(), lg);
}
return false;
}

Expand All @@ -715,10 +721,10 @@ function mword_click_event_do_text_text () {
$(this).attr('data_wid'), status, $(this).attr('data_code'), ann
);
}
if (HTS == 2) {
if (HTS == 2) {
const lg = getLangFromDict(WBLINK3);
readTextAloud($(this).text(), lg);
}
}
return false;
}

Expand Down

0 comments on commit 9228d51

Please sign in to comment.