Add options

This commit is contained in:
toasted-nutbread 2020-03-01 14:38:16 -05:00
parent 803a464fb9
commit cbc7e2646d
6 changed files with 54 additions and 2 deletions

View File

@ -105,7 +105,10 @@
"customPopupCss",
"customPopupOuterCss",
"enableWanakana",
"enableClipboardMonitor"
"enableClipboardMonitor",
"showPitchAccentDownstepNotation",
"showPitchAccentPositionNotation",
"showPitchAccentGraph"
],
"properties": {
"enable": {
@ -227,6 +230,18 @@
"enableClipboardMonitor": {
"type": "boolean",
"default": false
},
"showPitchAccentDownstepNotation": {
"type": "boolean",
"default": true
},
"showPitchAccentPositionNotation": {
"type": "boolean",
"default": true
},
"showPitchAccentGraph": {
"type": "boolean",
"default": false
}
}
},

View File

@ -124,7 +124,10 @@ function profileOptionsCreateDefaults() {
customPopupCss: '',
customPopupOuterCss: '',
enableWanakana: true,
enableClipboardMonitor: false
enableClipboardMonitor: false,
showPitchAccentDownstepNotation: true,
showPitchAccentPositionNotation: true,
showPitchAccentGraph: false
},
audio: {

View File

@ -84,6 +84,9 @@ async function formRead(options) {
options.general.popupScalingFactor = parseFloat($('#popup-scaling-factor').val());
options.general.popupScaleRelativeToPageZoom = $('#popup-scale-relative-to-page-zoom').prop('checked');
options.general.popupScaleRelativeToVisualViewport = $('#popup-scale-relative-to-visual-viewport').prop('checked');
options.general.showPitchAccentDownstepNotation = $('#show-pitch-accent-downstep-notation').prop('checked');
options.general.showPitchAccentPositionNotation = $('#show-pitch-accent-position-notation').prop('checked');
options.general.showPitchAccentGraph = $('#show-pitch-accent-graph').prop('checked');
options.general.popupTheme = $('#popup-theme').val();
options.general.popupOuterTheme = $('#popup-outer-theme').val();
options.general.customPopupCss = $('#custom-popup-css').val();
@ -161,6 +164,9 @@ async function formWrite(options) {
$('#popup-scaling-factor').val(options.general.popupScalingFactor);
$('#popup-scale-relative-to-page-zoom').prop('checked', options.general.popupScaleRelativeToPageZoom);
$('#popup-scale-relative-to-visual-viewport').prop('checked', options.general.popupScaleRelativeToVisualViewport);
$('#show-pitch-accent-downstep-notation').prop('checked', options.general.showPitchAccentDownstepNotation);
$('#show-pitch-accent-position-notation').prop('checked', options.general.showPitchAccentPositionNotation);
$('#show-pitch-accent-graph').prop('checked', options.general.showPitchAccentGraph);
$('#popup-theme').val(options.general.popupTheme);
$('#popup-outer-theme').val(options.general.popupOuterTheme);
$('#custom-popup-css').val(options.general.customPopupCss);

View File

@ -162,6 +162,18 @@
<label><input type="checkbox" id="popup-scale-relative-to-visual-viewport"> Change popup size relative to page viewport</label>
</div>
<div class="checkbox options-advanced">
<label><input type="checkbox" id="show-pitch-accent-downstep-notation"> Show downstep notation for pitch accents</label>
</div>
<div class="checkbox options-position">
<label><input type="checkbox" id="show-pitch-accent-position-notation"> Show position notation for pitch accents</label>
</div>
<div class="checkbox options-advanced">
<label><input type="checkbox" id="show-pitch-accent-graph"> Show graph for pitch accents</label>
</div>
<div class="checkbox options-advanced">
<label><input type="checkbox" id="show-debug-info"> Show debug information</label>
</div>

View File

@ -537,6 +537,19 @@ button.action-button {
}
:root[data-show-pitch-accent-downstep-notation=false] .term-pitch-accent-characters {
display: none;
}
:root[data-show-pitch-accent-position-notation=false] .term-pitch-accent-position {
display: none;
}
:root[data-show-pitch-accent-graph=false] .term-pitch-accent-details {
display: none;
}
/*
* Pitch accent graph styles
*/

View File

@ -385,6 +385,9 @@ class Display {
data.audioEnabled = `${options.audio.enabled}`;
data.compactGlossaries = `${options.general.compactGlossaries}`;
data.enableSearchTags = `${options.scanning.enableSearchTags}`;
data.showPitchAccentDownstepNotation = `${options.general.showPitchAccentDownstepNotation}`;
data.showPitchAccentPositionNotation = `${options.general.showPitchAccentPositionNotation}`;
data.showPitchAccentGraph = `${options.general.showPitchAccentGraph}`;
data.debug = `${options.general.debugInfo}`;
}