Skip to content

Commit

Permalink
Fixes #138: changing audio speed was partially broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoFara committed Dec 27, 2023
1 parent ca0e899 commit 6775029
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 29 deletions.
14 changes: 10 additions & 4 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ ones are marked like "v1.0.0-fork".

### Fixed

* Fixes [#113](https://github.com/HugoFara/lwt/issues/113): changing a language name was making text-to-speech unusable and may prompt a warning.
* Since 2.9.0, tests may be unable to run due to a missing key in an AJAX request ("type"). This is fixed.
* Fixes [#113](https://github.com/HugoFara/lwt/issues/113): changing a language name
was making text-to-speech unusable and may prompt a warning.
* Since 2.9.0, tests may be unable to run due to a missing key in an AJAX request ("type").
* Since 2.9.0, audio position was not saved properly.
* On `upload_words.php`, "update only empty fields" was broken.
* Translation were not set by default properly when editing terms translations table.
* The field MeCab was set for japanese even when not asked for.
Signalled on PR [#155](https://github.com/HugoFara/lwt/pull/155), thanks to [@ProgramComputer](https://github.com/ProgramComputer).
* Since 2.8.1, japanese word romanization was not displayed any more. Thanks to 아르노 for signalling the bug on Discord!
Signalled on PR [#155](https://github.com/HugoFara/lwt/pull/155), thanks to
[@ProgramComputer](https://github.com/ProgramComputer).
* Since 2.8.1, japanese word romanization was not displayed any more.
Thanks to 아르노 for signalling the bug on Discord!
* The go slower/faster feature on audio was broken
([#138](https://github.com/HugoFara/lwt/issues/138)), as functions `click_slower`
and `click_faster` were declared two times in `src/js/audio_controller.js`.

### Deprecated

Expand Down
14 changes: 10 additions & 4 deletions docs/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2200,14 +2200,20 @@ <h4>Changed</h4>
</ul>
<h4>Fixed</h4>
<ul>
<li>Fixes <a href="https://github.com/HugoFara/lwt/issues/113">#113</a>: changing a language name was making text-to-speech unusable and may prompt a warning.</li>
<li>Since 2.9.0, tests may be unable to run due to a missing key in an AJAX request ("type"). This is fixed.</li>
<li>Fixes <a href="https://github.com/HugoFara/lwt/issues/113">#113</a>: changing a language name
was making text-to-speech unusable and may prompt a warning.</li>
<li>Since 2.9.0, tests may be unable to run due to a missing key in an AJAX request ("type").</li>
<li>Since 2.9.0, audio position was not saved properly.</li>
<li>On <code>upload_words.php</code>, "update only empty fields" was broken.</li>
<li>Translation were not set by default properly when editing terms translations table.</li>
<li>The field MeCab was set for japanese even when not asked for.
Signalled on PR <a href="https://github.com/HugoFara/lwt/pull/155">#155</a>, thanks to <a href="https://github.com/ProgramComputer">@ProgramComputer</a>.</li>
<li>Since 2.8.1, japanese word romanization was not displayed any more. Thanks to 아르노 for signalling the bug on Discord!</li>
Signalled on PR <a href="https://github.com/HugoFara/lwt/pull/155">#155</a>, thanks to
<a href="https://github.com/ProgramComputer">@ProgramComputer</a>.</li>
<li>Since 2.8.1, japanese word romanization was not displayed any more.
Thanks to 아르노 for signalling the bug on Discord!</li>
<li>The go slower/faster feature on audio was broken
(<a href="https://github.com/HugoFara/lwt/issues/138">#138</a>), as functions <code>click_slower</code>
and <code>click_faster</code> were declared two times in <code>src/js/audio_controller.js</code>.</li>
</ul>
<h4>Deprecated</h4>
<ul>
Expand Down
17 changes: 11 additions & 6 deletions inc/session_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -5184,13 +5184,18 @@ function addjPlayerMedia () {
if ($('#jquery_jplayer_1').data().jPlayer.status.playbackRateEnabled) {
$("#playbackrateContainer").css("margin-top",".2em")
.html(
`<span id="pbSlower" style="position:absolute;top: 0; left: 0; bottom: 0; right: 50%;" title="Slower" onclick="click_slower();">
`<span id="pbSlower"
style="position:absolute;top: 0; left: 0; bottom: 0; right: 50%;"
title="Slower" onclick="lwt_audio_controller.clickSlower();">
&nbsp;
</span>
<span id="pbFaster" style="position:absolute;top: 0; left: 50%; bottom: 0; right: 0;" title="Faster" onclick="click_faster();">
<span id="pbFaster"
style="position:absolute;top: 0; left: 50%; bottom: 0; right: 0;"
title="Faster" onclick="lwt_audio_controller.clickFaster();">
&nbsp;
</span>
<span class="ui-widget ui-state-default ui-corner-all" style="padding-left: 0.2em;padding-right: 0.2em;color:grey">
<span class="ui-widget ui-state-default ui-corner-all"
style="padding-left: 0.2em;padding-right: 0.2em;color:grey">
<span id="playbackSlower" style="padding-right: 0.15em;">≪</span>
<span id="pbvalue">1.0</span>
<span id="playbackFaster" style="padding-left: 0.15em;">≫</span>
Expand Down Expand Up @@ -5228,9 +5233,9 @@ function prepareMediaInteractions() {
set_current_playbackrate();
});

$("#slower").on('click', click_slower);
$("#faster").on('click', click_faster);
$("#stdspeed").on('click', click_stdspeed);
$("#slower").on('click', lwt_audio_controller.setSlower);
$("#faster").on('click', lwt_audio_controller.setFaster);
$("#stdspeed").on('click', lwt_audio_controller.setStdSpeed);
$("#backbutt").on('click', click_back);
$("#forwbutt").on('click', click_forw);
$("#do-single").on('click', click_single);
Expand Down
10 changes: 5 additions & 5 deletions js/pgm.js

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

20 changes: 10 additions & 10 deletions src/js/audio_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const lwt_audio_controller = {
do_ajax_save_setting('currentplayerseconds', newval);
},

setNewPlaybackrate: function () {
setNewPlaybackRate: function () {
const newval = $("#playbackrate :selected").val();
do_ajax_save_setting('currentplaybackrate', newval);
$("#jquery_jplayer_1").jPlayer("option","playbackRate", newval * 0.1);
Expand Down Expand Up @@ -93,26 +93,26 @@ const lwt_audio_controller = {
}
},

clickStdSpeed: function () {
setStdSpeed: function () {
$("#playbackrate").val(10);
this.setNewPlaybackRate();
lwt_audio_controller.setNewPlaybackRate();
},

clickSlower: function () {
setSlower: function () {
let val = $("#playbackrate :selected").val();
if (val > 5) {
val--;
$("#playbackrate").val(val);
this.setNewPlaybackRate();
lwt_audio_controller.setNewPlaybackRate();
}
},

clickFaster: function () {
setFaster: function () {
let val = $("#playbackrate :selected").val();
if (val < 15) {
val++;
$("#playbackrate").val(val);
this.setNewPlaybackRate();
lwt_audio_controller.setNewPlaybackRate();
}
},

Expand Down Expand Up @@ -166,13 +166,13 @@ function click_faster() {
}

function click_stdspeed() {
return lwt_audio_controller.clickStdSpeed();
return lwt_audio_controller.setStdSpeed();
}

function click_slower() {
return lwt_audio_controller.clickSlower();
return lwt_audio_controller.setSlower();
}

function click_faster() {
return lwt_audio_controller.clickFaster();
return lwt_audio_controller.setFaster();
}

0 comments on commit 6775029

Please sign in to comment.