UserCSS Number variable now accepts a range

This commit is contained in:
Rob Garrison 2018-09-07 08:47:14 -05:00
parent d9c748d92f
commit 2291197277
3 changed files with 6 additions and 5 deletions

View File

@ -217,6 +217,7 @@ var usercss = (() => {
break;
}
case 'number':
case 'range': {
state.errorPrefix = 'Invalid JSON: ';
parseJSONValue(state);

View File

@ -104,7 +104,7 @@
margin-right: 4px;
}
.config-range span {
.config-number span, .config-range span {
line-height: 22px;
}

View File

@ -267,7 +267,8 @@ function configDialog(style) {
onfocus: selectAllOnFocus,
};
const dataset = {};
if (va.type === 'range') {
if (va.type === 'range' || va.type === 'number') {
children = va.type === 'range' ? [$create('span.current-value', {textContent: va.value})] : [];
options.value = va.default;
if (typeof va.range[0] !== 'undefined') {
options.min = dataset.min = va.range[0];
@ -278,12 +279,11 @@ function configDialog(style) {
if (va.range[2]) {
options.step = va.range[2];
}
children = [
$create('span.current-value', {textContent: va.value}),
children.push(
$create('span.current-range', {dataset}, [
va.input = $create('input.config-value', options),
])
];
);
} else {
children = [
va.input = $create('input.config-value', options),