store max number of results to display

This commit is contained in:
Alex Yatskov 2017-01-27 09:01:12 -08:00
parent 0e0a0a3e51
commit 3fa393354b
3 changed files with 14 additions and 6 deletions

View File

@ -30,9 +30,10 @@ function getFormData() {
optionsNew.general.autoStart = $('#activate-on-startup').prop('checked'); optionsNew.general.autoStart = $('#activate-on-startup').prop('checked');
optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked'); optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked');
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
optionsNew.general.groupResults = $('#group-terms-results').prop('checked'); optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked'); optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10);
optionsNew.scanning.requireShift = $('#hold-shift-to-scan').prop('checked'); optionsNew.scanning.requireShift = $('#hold-shift-to-scan').prop('checked');
optionsNew.scanning.selectText = $('#select-matched-text').prop('checked'); optionsNew.scanning.selectText = $('#select-matched-text').prop('checked');
@ -86,9 +87,10 @@ $(document).ready(() => {
optionsLoad().then(options => { optionsLoad().then(options => {
$('#activate-on-startup').prop('checked', options.general.autoStart); $('#activate-on-startup').prop('checked', options.general.autoStart);
$('#audio-playback-buttons').prop('checked', options.general.audioPlayback); $('#audio-playback-buttons').prop('checked', options.general.audioPlayback);
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
$('#group-terms-results').prop('checked', options.general.groupResults); $('#group-terms-results').prop('checked', options.general.groupResults);
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
$('#show-advanced-options').prop('checked', options.general.showAdvanced); $('#show-advanced-options').prop('checked', options.general.showAdvanced);
$('#max-displayed-results').val(options.general.maxResults);
$('#hold-shift-to-scan').prop('checked', options.scanning.requireShift); $('#hold-shift-to-scan').prop('checked', options.scanning.requireShift);
$('#select-matched-text').prop('checked', options.scanning.selectText); $('#select-matched-text').prop('checked', options.scanning.selectText);

View File

@ -22,8 +22,9 @@ function optionsSetDefaults(options) {
general: { general: {
autoStart: true, autoStart: true,
audioPlayback: true, audioPlayback: true,
softKatakana: true,
groupResults: true, groupResults: true,
softKatakana: true,
maxResults: 32,
showAdvanced: false showAdvanced: false
}, },

View File

@ -33,16 +33,21 @@
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label> <label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
</div> </div>
<div class="checkbox">
<label><input type="checkbox" id="group-terms-results"> Group term results</label>
</div>
<div class="checkbox options-advanced"> <div class="checkbox options-advanced">
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label> <label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label><input type="checkbox" id="group-terms-results"> Group term results</label> <label><input type="checkbox" id="show-advanced-options"> Show advanced options</label>
</div> </div>
<div class="checkbox"> <div class="form-group options-advanced">
<label><input type="checkbox" id="show-advanced-options"> Show advanced options</label> <label for="max-displayed-results">Maximum displayed results</label>
<input type="number" min="1" id="max-displayed-results" class="form-control">
</div> </div>
</div> </div>