Fix: add styleMetaErrorSelectValueMismatch

This commit is contained in:
eight 2017-11-01 09:46:03 +08:00
parent 45e70b2b6a
commit f35fbb5b36
2 changed files with 5 additions and 1 deletions

View File

@ -773,6 +773,10 @@
}
}
},
"styleMetaErrorSelectValueMismatch": {
"message": "Invalid @select: value doesn't exist in the list",
"description": "Error displayed when the value of @select is invalid"
},
"styleMissingMeta": {
"message": "Missing metadata @$key$",
"description": "Error displayed when a mandatory metadata is missing",

View File

@ -512,7 +512,7 @@ var usercss = (() => {
function validVar(va, value = 'default') {
if (va.type === 'select' || va.type === 'dropdown') {
if (va.options.every(o => o.value !== va[value])) {
throw new Error(chrome.i18n.getMessage('invalid select value'));
throw new Error(chrome.i18n.getMessage('styleMetaErrorSelectValueMismatch'));
}
} else if (va.type === 'checkbox' && !/^[01]$/.test(va[value])) {
throw new Error(chrome.i18n.getMessage('styleMetaErrorCheckbox'));