UserCSS Number variable now accepts a range
This commit is contained in:
		
							parent
							
								
									d9c748d92f
								
							
						
					
					
						commit
						2291197277
					
				|  | @ -217,6 +217,7 @@ var usercss = (() => { | |||
|         break; | ||||
|       } | ||||
| 
 | ||||
|       case 'number': | ||||
|       case 'range': { | ||||
|         state.errorPrefix = 'Invalid JSON: '; | ||||
|         parseJSONValue(state); | ||||
|  |  | |||
|  | @ -104,7 +104,7 @@ | |||
|   margin-right: 4px; | ||||
| } | ||||
| 
 | ||||
| .config-range span { | ||||
| .config-number span, .config-range span { | ||||
|   line-height: 22px; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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), | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user