Added config entries and setter function

This commit is contained in:
willerbee 2020-10-12 00:10:39 +08:00 committed by GitHub
parent 36af4de510
commit 08cd376fa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,7 @@ let defaultConfig = {
smoothLineScroll: false,
alwaysShowDecimalPlaces: false,
alwaysShowWordsHistory: false,
singleListCommandLine: "manual",
playSoundOnError: false,
playSoundOnClick: "off",
startGraphsAtZero: true,
@ -190,6 +191,7 @@ function applyConfig(configObj) {
setShowTimerProgress(configObj.showTimerProgress, true);
setAlwaysShowDecimalPlaces(configObj.alwaysShowDecimalPlaces, true);
setAlwaysShowWordsHistory(configObj.alwaysShowWordsHistory, true);
setSingleListCommandLine(configObj.singleListCommandLine, true);
setPlaySoundOnError(configObj.playSoundOnError, true);
setPlaySoundOnClick(configObj.playSoundOnClick, true);
setStopOnError(configObj.stopOnError, true);
@ -429,6 +431,13 @@ function setAlwaysShowWordsHistory(val, nosave) {
if (!nosave) saveConfigToCookie();
}
//single list command line
function setSingleListCommandLine(option, nosave) {
if (!option) option = "manual";
config.singleListCommandLine = option;
if (!nosave) saveConfigToCookie();
}
//show all lines
function toggleShowAllLines() {
sal = !config.showAllLines;