support for audio volume adjustment (fixes #39)
This commit is contained in:
parent
f556c95038
commit
4de9e5e9e0
@ -26,6 +26,7 @@ function formRead() {
|
||||
const optionsNew = $.extend(true, {}, optionsOld);
|
||||
|
||||
optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked');
|
||||
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
|
||||
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
|
||||
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
|
||||
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
|
||||
@ -111,6 +112,7 @@ $(document).ready(() => {
|
||||
|
||||
optionsLoad().then(options => {
|
||||
$('#audio-playback-buttons').prop('checked', options.general.audioPlayback);
|
||||
$('#audio-playback-volume').val(options.general.audioVolume);
|
||||
$('#group-terms-results').prop('checked', options.general.groupResults);
|
||||
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
|
||||
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
|
||||
|
@ -85,6 +85,7 @@ function optionsSetDefaults(options) {
|
||||
general: {
|
||||
enable: true,
|
||||
audioPlayback: true,
|
||||
audioVolume: 100,
|
||||
groupResults: true,
|
||||
softKatakana: true,
|
||||
maxResults: 32,
|
||||
|
@ -25,10 +25,6 @@
|
||||
<div>
|
||||
<h3>General Options</h3>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="group-terms-results"> Group term results</label>
|
||||
</div>
|
||||
@ -41,6 +37,15 @@
|
||||
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group options-advanced">
|
||||
<label for="audio-playback-volume">Audio playback volume (percent)</label>
|
||||
<input type="number" min="0" max="100" id="audio-playback-volume" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group options-advanced">
|
||||
<label for="max-displayed-results">Maximum displayed results</label>
|
||||
<input type="number" min="1" id="max-displayed-results" class="form-control">
|
||||
|
@ -343,6 +343,7 @@ class Display {
|
||||
let audio = this.audioCache[url];
|
||||
if (audio) {
|
||||
audio.currentTime = 0;
|
||||
audio.volume = this.options.general.audioVolume / 100.0;
|
||||
audio.play();
|
||||
} else {
|
||||
audio = new Audio(url);
|
||||
@ -352,6 +353,7 @@ class Display {
|
||||
}
|
||||
|
||||
this.audioCache[url] = audio;
|
||||
audio.volume = this.options.general.audioVolume / 100.0;
|
||||
audio.play();
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user