Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Highlight to speech #147

Merged
merged 7 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified INSTALL.sh
100644 → 100755
ProgramComputer marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
1 change: 1 addition & 0 deletions do_text_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ function do_text_text_content($textid, $only_body=true): void
'TID' => $textid,
'ADDFILTER' => makeStatusClassFilter((int)$visit_status),
'JQ_TOOLTIP' => getSettingWithDefault('set-tooltip-mode') == 2 ? 1 : 0,
'HTS' => getSettingWithDefault('set-hts'),
// Add new globals
'ANNOTATIONS_MODE' => $mode_trans,
'POS' => $pos
Expand Down
3 changes: 3 additions & 0 deletions inc/kernel_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ function get_setting_data()
'set-tts' => array(
"dft" => '1', "num" => 0
),
'set-hts' => array(
"dft" => '1', "num" => 0
),
'set-term-sentence-count' => array(
"dft" => '1', "num" => 0
),
Expand Down
14 changes: 14 additions & 0 deletions inc/session_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,20 @@ function get_annotation_position_selectoptions($v): string
$r .= ">Above</option>";
return $r;
}
// -------------------------------------------------------------

function get_hts_selectoptions($v): string
{
if (! isset($v) ) { $v = 1;
}
$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
5 changes: 3 additions & 2 deletions js/pgm.js

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

22 changes: 21 additions & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
1 : 0
)
);
saveSetting(
'set-hts',
$_REQUEST['set-hts']
);

saveSetting(
'set-archivedtexts-per-page',
Expand Down Expand Up @@ -564,7 +568,7 @@
</tr>
<!-- ******************************************************* -->
<tr>
<th class="th1 center">Text to Speech</th>
<th class="th1 center" rowspan="2">Text to Speech</th>
<td class="td1 center">Save Audio Files to Disk</td>
<td class="td1 center">
<input type="checkbox" name="set-tts" value="1"
Expand All @@ -576,6 +580,22 @@
</td>
</tr>
<!-- ******************************************************* -->
<tr>
<td class="td1 center">Read word aloud</td>
<td class="td1 center">
<select name="set-hts" class="notempty respinput">
<?php
echo get_hts_selectoptions(
getSettingWithDefault('set-hts')
);
?>
</select>
</td>
<td class="td1 center">
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td>
</tr>
<!-- ******************************************************* -->
<tr>
<th class="th1 center" rowspan="7">Text, Term,<br />Newsfeed &amp;<br />Tag Tables</th>
<td class="td1 center">Texts per Page</td>
Expand Down
9 changes: 9 additions & 0 deletions src/js/jq_pgm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RTL = 0;
ANN_ARRAY = {};
DELIMITER = '';
JQ_TOOLTIP = 0;
HTS = 0;

/**************************************************************
LWT jQuery functions
Expand Down Expand Up @@ -699,6 +700,10 @@ function mword_click_event_do_text_text () {
$(this).attr('data_wid'), status, $(this).attr('data_code'), ann
);
}
if (HTS == 2) {
const lg = getLangFromDict(WBLINK3);
readTextAloud($(this).text(), lg);
}
return false;
}

Expand Down Expand Up @@ -860,6 +865,10 @@ function word_hover_over () {
if (JQ_TOOLTIP) {
$(this).trigger('mouseover');
}
if (HTS == 3) {
const lg = getLangFromDict(WBLINK3);
readTextAloud($(this).text(), lg);
}
}
}

Expand Down
Loading